add to shopping from meal plan editor

This commit is contained in:
vabene1111
2024-12-22 15:36:58 +01:00
parent 5ce859f267
commit 0c547353cd
43 changed files with 96 additions and 62 deletions

View File

@@ -1104,6 +1104,7 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
servings = CustomDecimalField()
shared = UserSerializer(many=True, required=False, allow_null=True)
shopping = serializers.SerializerMethodField('in_shopping')
addshopping = serializers.BooleanField(write_only=True)
to_date = serializers.DateTimeField(required=False)
@@ -1121,8 +1122,14 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
if 'to_date' not in validated_data or validated_data['to_date'] is None:
validated_data['to_date'] = validated_data['from_date']
add_to_shopping = False
try:
add_to_shopping = validated_data.pop('addshopping', False)
except KeyError:
pass
mealplan = super().create(validated_data)
if self.context['request'].data.get('addshopping', False) and self.context['request'].data.get('recipe', None):
if add_to_shopping and self.context['request'].data.get('recipe', None):
SLR = RecipeShoppingEditor(user=validated_data['created_by'], space=validated_data['space'])
SLR.create(mealplan=mealplan, servings=validated_data['servings'])
return mealplan
@@ -1132,7 +1139,7 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
fields = (
'id', 'title', 'recipe', 'servings', 'note', 'note_markdown',
'from_date', 'to_date', 'meal_type', 'created_by', 'shared', 'recipe_name',
'meal_type_name', 'shopping'
'meal_type_name', 'shopping','addshopping'
)
read_only_fields = ('created_by',)

View File

@@ -120,37 +120,6 @@ def update_food_inheritance(sender, instance=None, created=False, **kwargs):
child.save()
@receiver(post_save, sender=MealPlan)
def auto_add_shopping(sender, instance=None, created=False, weak=False, **kwargs):
print("MEAL_AUTO_ADD Signal trying to auto add to shopping")
if not instance:
print("MEAL_AUTO_ADD Instance is none")
return
try:
space = instance.get_space()
user = instance.get_owner()
with scope(space=space):
slr_exists = instance.shoppinglistrecipe_set.exists()
if not created and slr_exists:
for x in instance.shoppinglistrecipe_set.all():
# assuming that permissions checks for the MealPlan have happened upstream
if instance.servings != x.servings:
SLR = RecipeShoppingEditor(id=x.id, user=user, space=instance.space)
SLR.edit_servings(servings=instance.servings)
elif not user.userpreference.mealplan_autoadd_shopping or not instance.recipe:
print("MEAL_AUTO_ADD No recipe or no setting")
return
if created:
SLR = RecipeShoppingEditor(user=user, space=space)
SLR.create(mealplan=instance, servings=instance.servings)
print("MEAL_AUTO_ADD Created SLR")
except AttributeError:
pass
@receiver(post_save, sender=Unit)
def clear_unit_cache(sender, instance=None, created=False, **kwargs):
if instance:

View File

@@ -130,6 +130,8 @@ function loadRecipes() {
keyword.value = r.results[0]
requestParameters.keywords = [keyword.value.id!]
doRecipeRequest(requestParameters)
} else {
loading.value = false
}
})
return;

View File

@@ -178,8 +178,10 @@
{{ r.recipeName }}
</span>
<template #append>
<v-btn icon="$delete" color="delete"></v-btn>
<v-btn icon color="delete">
<v-icon icon="$delete"></v-icon>
<delete-confirm-dialog :object-name="r.recipeName" :model-name="$t('ShoppingListRecipe')" @delete="deleteListRecipe(r)"></delete-confirm-dialog>
</v-btn>
</template>
</v-list-item>
</v-list>
@@ -211,7 +213,7 @@
import {computed, onMounted, ref} from "vue";
import {useShoppingStore} from "@/stores/ShoppingStore";
import {ApiApi, Food, IngredientString, ResponseError, ShoppingListEntry, ShoppingListRecipe, Supermarket, Unit} from "@/openapi";
import {ApiApi, IngredientString, ResponseError, ShoppingListEntry, ShoppingListRecipe, Supermarket} from "@/openapi";
import {ErrorMessageType, PreparedMessage, useMessageStore} from "@/stores/MessageStore";
import ShoppingLineItem from "@/components/display/ShoppingLineItem.vue";
import {useUserPreferenceStore} from "@/stores/UserPreferenceStore";
@@ -221,6 +223,7 @@ import {IShoppingListCategory, IShoppingListFood, ShoppingGroupingOptions} from
import {useI18n} from "vue-i18n";
import NumberScalerDialog from "@/components/inputs/NumberScalerDialog.vue";
import SupermarketEditor from "@/components/model_editors/SupermarketEditor.vue";
import DeleteConfirmDialog from "@/components/dialogs/DeleteConfirmDialog.vue";
const {t} = useI18n()
@@ -340,6 +343,20 @@ function autoSyncLoop() {
}, timeout)
}
/**
* delete shopping list recipe
*/
function deleteListRecipe(slr: ShoppingListRecipe){
let api = new ApiApi()
api.apiShoppingListRecipeDestroy({id: slr.id!}).then(r => {
useShoppingStore().refreshFromAPI()
useMessageStore().addPreparedMessage(PreparedMessage.DELETE_SUCCESS)
}).catch(err => {
useMessageStore().addError(ErrorMessageType.DELETE_ERROR, err)
})
}
</script>
<style scoped>

View File

@@ -37,19 +37,24 @@
</v-col>
<v-col cols="12" md="6">
<ModelSelect model="Recipe" v-model="editingObj.recipe"
@update:modelValue="editingObj.servings = editingObj.recipe?.servings ? editingObj.recipe?.servings : 1"></ModelSelect>
@update:modelValue="editingObj.servings = editingObj.recipe ? editingObj.recipe.servings : 1"></ModelSelect>
<!-- <v-number-input label="Days" control-variant="split" :min="1"></v-number-input>-->
<!--TODO create days input with +/- synced to date -->
<recipe-card :recipe="editingObj.recipe" v-if="editingObj && editingObj.recipe"></recipe-card>
</v-col>
</v-row>
<v-row>
<v-col>
<v-textarea :label="$t('Note')" v-model="editingObj.note"></v-textarea>
<v-row dense>
<v-col cols="12" md="6">
<v-textarea :label="$t('Note')" v-model="editingObj.note" rows="3"></v-textarea>
</v-col>
<v-col cols="12" md="6" v-if="!isUpdate()">
<v-checkbox :label="$t('AddToShopping')" v-model="editingObj.addshopping" hide-details></v-checkbox>
<!-- <v-checkbox :label="$t('review_shopping')" v-model="addToShopping" hide-details></v-checkbox>-->
</v-col>
</v-row>
</v-form>
</v-card-text>
</model-editor-base>
@@ -109,6 +114,8 @@ onMounted(() => {
editingObj.value.servings = 1
editingObj.value.mealType = defaultMealType
editingObj.value.addshopping = !!useUserPreferenceStore().userSettings.mealplanAutoaddShopping
applyItemDefaults(props.itemDefaults)
initializeDateRange()

View File

@@ -280,6 +280,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "",
"Shopping_Category": "",
"Shopping_List_Empty": "",

View File

@@ -273,6 +273,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Категории за пазаруване",
"Shopping_Category": "Категория за пазаруване",
"Shopping_List_Empty": "Вашият списък за пазаруване в момента е празен, можете да добавяте артикули чрез контекстното меню на запис на план за хранене (щракнете с десния бутон върху картата или щракнете с левия бутон върху иконата на менюто)",

View File

@@ -353,6 +353,7 @@
"ShopNow": "",
"ShoppingBackgroundSyncWarning": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "",
"Shopping_Category": "",
"Shopping_List_Empty": "",

View File

@@ -350,6 +350,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Kategorie nákupního seznamu",
"Shopping_Category": "Kategorie nákupního seznamu",
"Shopping_List_Empty": "Váš nákupní seznam je momentálně prázdný, můžete přidat položky pomocí kontextového menu záznamu v jídelníčku (pravým kliknutím na kartu nebo levým kliknutím na ikonu menu)",

View File

@@ -332,6 +332,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Indkøbskategorier",
"Shopping_Category": "Indkøbskategori",
"Shopping_List_Empty": "Din indkøbsliste er i øjeblikket tom, du kan tilføje varer via menuen for et madplanspunkt (højreklik på punktet eller venstreklik på menu ikonet)",

View File

@@ -356,6 +356,7 @@
"ShopNow": "Jetzt kaufen",
"ShoppingBackgroundSyncWarning": "Schlechte Netzwerkverbindung, Warten auf Synchronisation ...",
"ShoppingListEntry": "Einkaufslisten Eintrag",
"ShoppingListRecipe": "Einkaufslisten Rezepte",
"Shopping_Categories": "Einkaufskategorien",
"Shopping_Category": "Einkaufskategorie",
"Shopping_List_Empty": "Deine Einkaufsliste ist aktuell leer. Einträge können über das Kontextmenü hinzugefügt werden (Rechtsklick auf einen Eintrag oder Klick auf das Menü-Icon)",

View File

@@ -324,6 +324,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Κατηγορίες αγορών",
"Shopping_Category": "Κατηγορία αγορών",
"Shopping_List_Empty": "Η λίστα αγορών σας είναι κενή, μπορείτε να προσθέσετε αντικείμενα από το μενού μιας εγγραφής στο πρόγραμμα γευμάτων (δεξί κλικ στην κάρτα ή αριστερό κλικ στο εικονίδιο του μενού)",

View File

@@ -355,6 +355,7 @@
"ShopNow": "Shop now",
"ShoppingBackgroundSyncWarning": "Bad network, waiting to sync ...",
"ShoppingListEntry": "Shoppinglist Entry",
"ShoppingListRecipe": "Shoppinglist Recipe",
"Shopping_Categories": "Shopping Categories",
"Shopping_Category": "Shopping Category",
"Shopping_List_Empty": "Your shopping list is currently empty, you can add items via the context menu of a meal plan entry (right click on the card or left click the menu icon)",

View File

@@ -352,6 +352,7 @@
"ShopNow": "",
"ShoppingBackgroundSyncWarning": "Red defectuosa, esperando para sincronizar ...",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Categorías Compras",
"Shopping_Category": "Categoría Compras",
"Shopping_List_Empty": "Tu lista de la compra esta actualmente vacía, puedes añadir nuevos elementos mediante el menú de un régimen de comidas (click derecho en la tarjeta o click sobre el menú de la misma)",

View File

@@ -205,6 +205,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Ostoskategoriat",
"Shopping_Category": "Ostosluokka",
"Shopping_List_Empty": "Ostoslistasi on tällä hetkellä tyhjä, voit lisätä tuotteita ateriasuunnitelmamerkinnän valikon kautta(klikkaa korttia hiiren kaksoispainikkeella tai valikkokuvaketta)",

View File

@@ -353,6 +353,7 @@
"ShopNow": "",
"ShoppingBackgroundSyncWarning": "Mauvais réseau, en attente de synchronisation ...",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Catégories de courses",
"Shopping_Category": "Catégorie de courses",
"Shopping_List_Empty": "Votre liste de courses est actuellement vide, vous pouvez ajouter des articles via le menu contextuel dune entrée de menu de la semaine (clic droit sur la carte ou clic gauche sur licône du menu)",

View File

@@ -354,6 +354,7 @@
"ShopNow": "",
"ShoppingBackgroundSyncWarning": "בעיית תקשורת, מחכה לסנכון...",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "קטגוריות קניות",
"Shopping_Category": "קטגוריית קניות",
"Shopping_List_Empty": "רשימת הקניות שלך ריקה כרגע. ניתן להוסיף פריטים דרך תפריט תוכנית אוכל (מקש ימני על הכרטיס או מקש שמאלי על האייקון בתפריט)",

View File

@@ -326,6 +326,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Vásárlási kategóriák",
"Shopping_Category": "Vásárlási kategória",
"Shopping_List_Empty": "A bevásárlólista jelenleg üres. A tételeket a menüterv menüjében (jobb klikk a kártyára vagy bal klikk a menü ikonjára) adhatja hozzá.",

View File

@@ -149,6 +149,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Category": "Գնումների կատեգորիա",
"Shopping_list": "Գնումների ցուցակ",
"Show_as_header": "Ցույց տալ որպես խորագիր",

View File

@@ -302,6 +302,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Kategori Belanja",
"Shopping_Category": "Kategori Belanja",
"Shopping_List_Empty": "",

View File

@@ -353,6 +353,7 @@
"ShopNow": "",
"ShoppingBackgroundSyncWarning": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "",
"Shopping_Category": "",
"Shopping_List_Empty": "",

View File

@@ -310,6 +310,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Categorie di spesa",
"Shopping_Category": "Categoria Spesa",
"Shopping_List_Empty": "La tua lista della spesa è vuota, puoi aggiungere elementi dal menù contestuale di una voce nel piano alimentare (clicca con il tasto destro sulla scheda o clicca con il tasto sinistro sull'icona del menù)",

View File

@@ -330,6 +330,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "",
"Shopping_Category": "",
"Shopping_List_Empty": "",

View File

@@ -322,6 +322,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Butikk Kategorier",
"Shopping_Category": "Butikk Kategori",
"Shopping_List_Empty": "",

View File

@@ -326,6 +326,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Boodschappen categorieën",
"Shopping_Category": "Boodschappencategorie",
"Shopping_List_Empty": "Je boodschappenlijst is op dit moment leeg, je kan artikelen via het context menu of een maaltijdplan (rechtermuisknop op de kaart of linkermuisknop op het menu icoon) toevoegen",

View File

@@ -355,6 +355,7 @@
"ShopNow": "",
"ShoppingBackgroundSyncWarning": "Słaba sieć, oczekiwanie na synchronizację...",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Kategorie zakupów",
"Shopping_Category": "Kategoria zakupów",
"Shopping_List_Empty": "Twoja lista zakupów jest obecnie pusta, możesz dodawać pozycje za pomocą menu kontekstowego wpisu planu posiłków (kliknij prawym przyciskiem myszy na karcie lub lewym przyciskiem myszy ikonę menu)",

View File

@@ -268,6 +268,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Categorias de Compras",
"Shopping_Category": "Categoria de Compras",
"Shopping_List_Empty": "A sua lista de compras encontra-se vazia, pode adicionar itens através do menu de contexto de um plano de refeições (carregar com o botão direito no cartão ou carregar com o botão esquerdo no ícone do menu)",

View File

@@ -342,6 +342,7 @@
"ShopNow": "",
"ShoppingBackgroundSyncWarning": "Rede ruim, aguardando sincronização...",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Categorias de Mercado",
"Shopping_Category": "Categoria de Mercado",
"Shopping_List_Empty": "Sua lista de compras está vazia. Você pode incluir itens pelo menu Plano de Refeição (click direiro no cartão ou click esquerdo no ícone do menu)",

View File

@@ -314,6 +314,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Categorii de cumpărături",
"Shopping_Category": "Categorie de cumpărături",
"Shopping_List_Empty": "Lista de cumpărături este în prezent goală, puteți adăuga articole prin meniul contextual al unei intrări în planul de alimentație (faceți click dreapta pe card sau faceți click stânga pe iconița meniului)",

View File

@@ -253,6 +253,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Категории покупок",
"Shopping_Category": "Категория покупок",
"Shopping_List_Empty": "В настоящее время ваш список покупок пуст, вы можете добавить пункты через контекстное меню записи плана питания (щелкните правой кнопкой мыши на карточке или щелкните левой кнопкой мыши на значке меню)",

View File

@@ -243,6 +243,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Kategorije nakupa",
"Shopping_Category": "Kategorija nakupa",
"Shopping_List_Empty": "Tvoj nakupovalni listek je trenutno prazen. Stvari lahko dodaš preko menija za načrt obroka (desni klik na kartico ali levi klik na ikono za meni)",

View File

@@ -355,6 +355,7 @@
"ShopNow": "",
"ShoppingBackgroundSyncWarning": "Dålig uppkoppling, inväntar synkronisering...",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Shopping kategorier",
"Shopping_Category": "Shopping kategori",
"Shopping_List_Empty": "Din inköpslista är för närvarande tom, du kan lägga till varor via snabbmenyn för en måltidsplan (högerklicka på kortet eller vänsterklicka på menyikonen)",

View File

@@ -354,6 +354,7 @@
"ShopNow": "",
"ShoppingBackgroundSyncWarning": "Kötü bağlantı, senkronizasyon bekleniyor...",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Alışveriş Kategorileri",
"Shopping_Category": "Alışveriş Kategorisi",
"Shopping_List_Empty": "Alışveriş listeniz şu anda boş, yemek planı girişinin içerik menüsü aracılığıyla öğeler ekleyebilirsiniz (karta sağ tıklayın veya menü simgesine sol tıklayın)",

View File

@@ -288,6 +288,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "Категорії Покупок",
"Shopping_Category": "Категорія Покупок",
"Shopping_List_Empty": "Ваш список покупок зараз пустий, ви можете додати товари за допомогою контекстного меню плану харчування (права кнопка мишки на картку або на ліву кнопку на іконку меню)",

View File

@@ -349,6 +349,7 @@
"ShopNow": "",
"ShoppingBackgroundSyncWarning": "网络状况不佳,正在等待进行同步……",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Shopping_Categories": "购物类别",
"Shopping_Category": "购物类别",
"Shopping_List_Empty": "您的购物列表当前为空,您可以通过用餐计划条目的上下文菜单添加项目(右键单击卡片或左键单击菜单图标)",

View File

@@ -121,6 +121,7 @@
"ShopLater": "",
"ShopNow": "",
"ShoppingListEntry": "",
"ShoppingListRecipe": "",
"Show_as_header": "顯示為標題",
"Size": "",
"Sort_by_new": "按最新排序",

View File

@@ -164,4 +164,3 @@ models/UserPreferenceNavTextColorEnum.ts
models/UserSpace.ts
models/ViewLog.ts
models/index.ts
runtime.ts

View File

@@ -1566,13 +1566,13 @@ export interface ApiUnitUpdateRequest {
export interface ApiUserFileCreateRequest {
name: string;
file: string;
fileDownload: string;
preview: string;
fileSizeKb: number;
createdBy: User;
createdAt: Date;
id?: number;
file?: string;
}
export interface ApiUserFileDestroyRequest {
@@ -1607,13 +1607,13 @@ export interface ApiUserFileRetrieveRequest {
export interface ApiUserFileUpdateRequest {
id: number;
name: string;
file: string;
fileDownload: string;
preview: string;
fileSizeKb: number;
createdBy: User;
createdAt: Date;
id2?: number;
file?: string;
}
export interface ApiUserListRequest {
@@ -11973,13 +11973,6 @@ export class ApiApi extends runtime.BaseAPI {
);
}
if (requestParameters['file'] == null) {
throw new runtime.RequiredError(
'file',
'Required parameter "file" was null or undefined when calling apiUserFileCreate().'
);
}
if (requestParameters['fileDownload'] == null) {
throw new runtime.RequiredError(
'fileDownload',
@@ -12317,13 +12310,6 @@ export class ApiApi extends runtime.BaseAPI {
);
}
if (requestParameters['file'] == null) {
throw new runtime.RequiredError(
'file',
'Required parameter "file" was null or undefined when calling apiUserFileUpdate().'
);
}
if (requestParameters['fileDownload'] == null) {
throw new runtime.RequiredError(
'fileDownload',

View File

@@ -125,6 +125,12 @@ export interface MealPlan {
* @memberof MealPlan
*/
readonly shopping: boolean;
/**
*
* @type {boolean}
* @memberof MealPlan
*/
addshopping: boolean;
}
/**
@@ -139,6 +145,7 @@ export function instanceOfMealPlan(value: object): value is MealPlan {
if (!('recipeName' in value) || value['recipeName'] === undefined) return false;
if (!('mealTypeName' in value) || value['mealTypeName'] === undefined) return false;
if (!('shopping' in value) || value['shopping'] === undefined) return false;
if (!('addshopping' in value) || value['addshopping'] === undefined) return false;
return true;
}
@@ -166,6 +173,7 @@ export function MealPlanFromJSONTyped(json: any, ignoreDiscriminator: boolean):
'recipeName': json['recipe_name'],
'mealTypeName': json['meal_type_name'],
'shopping': json['shopping'],
'addshopping': json['addshopping'],
};
}
@@ -189,6 +197,7 @@ export function MealPlanToJSONTyped(value?: Omit<MealPlan, 'note_markdown'|'crea
'to_date': value['toDate'] == null ? undefined : ((value['toDate']).toISOString()),
'meal_type': MealTypeToJSON(value['mealType']),
'shared': value['shared'] == null ? undefined : ((value['shared'] as Array<any>).map(UserToJSON)),
'addshopping': value['addshopping'],
};
}

View File

@@ -125,6 +125,12 @@ export interface PatchedMealPlan {
* @memberof PatchedMealPlan
*/
readonly shopping?: boolean;
/**
*
* @type {boolean}
* @memberof PatchedMealPlan
*/
addshopping?: boolean;
}
/**
@@ -158,6 +164,7 @@ export function PatchedMealPlanFromJSONTyped(json: any, ignoreDiscriminator: boo
'recipeName': json['recipe_name'] == null ? undefined : json['recipe_name'],
'mealTypeName': json['meal_type_name'] == null ? undefined : json['meal_type_name'],
'shopping': json['shopping'] == null ? undefined : json['shopping'],
'addshopping': json['addshopping'] == null ? undefined : json['addshopping'],
};
}
@@ -181,6 +188,7 @@ export function PatchedMealPlanToJSONTyped(value?: Omit<PatchedMealPlan, 'note_m
'to_date': value['toDate'] == null ? undefined : ((value['toDate']).toISOString()),
'meal_type': MealTypeToJSON(value['mealType']),
'shared': value['shared'] == null ? undefined : ((value['shared'] as Array<any>).map(UserToJSON)),
'addshopping': value['addshopping'],
};
}

View File

@@ -44,7 +44,7 @@ export interface UserFile {
* @type {string}
* @memberof UserFile
*/
file: string;
file?: string;
/**
*
* @type {string}
@@ -82,7 +82,6 @@ export interface UserFile {
*/
export function instanceOfUserFile(value: object): value is UserFile {
if (!('name' in value) || value['name'] === undefined) return false;
if (!('file' in value) || value['file'] === undefined) return false;
if (!('fileDownload' in value) || value['fileDownload'] === undefined) return false;
if (!('preview' in value) || value['preview'] === undefined) return false;
if (!('fileSizeKb' in value) || value['fileSizeKb'] === undefined) return false;
@@ -103,7 +102,7 @@ export function UserFileFromJSONTyped(json: any, ignoreDiscriminator: boolean):
'id': json['id'] == null ? undefined : json['id'],
'name': json['name'],
'file': json['file'],
'file': json['file'] == null ? undefined : json['file'],
'fileDownload': json['file_download'],
'preview': json['preview'],
'fileSizeKb': json['file_size_kb'],

View File

@@ -278,7 +278,7 @@ export const useShoppingStore = defineStore(_STORE_ID, () => {
/**
* returns a distinct list of recipes associated with unchecked shopping list entries
*/
function getAssociatedRecipes() {
function getAssociatedRecipes(): ShoppingListRecipe[] {
let recipes = [] as ShoppingListRecipe[]
entries.value.forEach(e => {

View File

@@ -69,7 +69,7 @@ export const useUserPreferenceStore = defineStore('user_preference_store', () =>
function updateUserSettings() {
let api = new ApiApi()
api.apiUserPreferencePartialUpdate({user: userSettings.value.user, patchedUserPreference: userSettings.value}).then(r => {
api.apiUserPreferencePartialUpdate({user: userSettings.value.user.id!, patchedUserPreference: userSettings.value}).then(r => {
userSettings.value = r
useMessageStore().addPreparedMessage(PreparedMessage.UPDATE_SUCCESS)
}).catch(err => {