shopping from meal plan edit

This commit is contained in:
vabene1111
2024-12-28 23:26:22 +01:00
parent bf4fc9a7aa
commit c1bfa563a3
45 changed files with 299 additions and 160 deletions

View File

@@ -1244,7 +1244,7 @@ export interface ApiShoppingListEntryBulkCreateRequest {
}
export interface ApiShoppingListEntryCreateRequest {
shoppingListEntry: Omit<ShoppingListEntry, 'recipe_mealplan'|'created_by'|'created_at'|'updated_at'>;
shoppingListEntry: Omit<ShoppingListEntry, 'list_recipe_data'|'created_by'|'created_at'|'updated_at'>;
}
export interface ApiShoppingListEntryDestroyRequest {
@@ -1260,7 +1260,7 @@ export interface ApiShoppingListEntryListRequest {
export interface ApiShoppingListEntryPartialUpdateRequest {
id: number;
patchedShoppingListEntry?: Omit<PatchedShoppingListEntry, 'recipe_mealplan'|'created_by'|'created_at'|'updated_at'>;
patchedShoppingListEntry?: Omit<PatchedShoppingListEntry, 'list_recipe_data'|'created_by'|'created_at'|'updated_at'>;
}
export interface ApiShoppingListEntryRetrieveRequest {
@@ -1269,7 +1269,7 @@ export interface ApiShoppingListEntryRetrieveRequest {
export interface ApiShoppingListEntryUpdateRequest {
id: number;
shoppingListEntry: Omit<ShoppingListEntry, 'recipe_mealplan'|'created_by'|'created_at'|'updated_at'>;
shoppingListEntry: Omit<ShoppingListEntry, 'list_recipe_data'|'created_by'|'created_at'|'updated_at'>;
}
export interface ApiShoppingListRecipeBulkCreateEntriesCreateRequest {
@@ -1278,7 +1278,7 @@ export interface ApiShoppingListRecipeBulkCreateEntriesCreateRequest {
}
export interface ApiShoppingListRecipeCreateRequest {
shoppingListRecipe: Omit<ShoppingListRecipe, 'recipe_name'|'mealplan_note'|'mealplan_from_date'|'mealplan_type'>;
shoppingListRecipe: Omit<ShoppingListRecipe, 'recipe_data'|'meal_plan_data'>;
}
export interface ApiShoppingListRecipeDestroyRequest {
@@ -1293,7 +1293,7 @@ export interface ApiShoppingListRecipeListRequest {
export interface ApiShoppingListRecipePartialUpdateRequest {
id: number;
patchedShoppingListRecipe?: Omit<PatchedShoppingListRecipe, 'recipe_name'|'mealplan_note'|'mealplan_from_date'|'mealplan_type'>;
patchedShoppingListRecipe?: Omit<PatchedShoppingListRecipe, 'recipe_data'|'meal_plan_data'>;
}
export interface ApiShoppingListRecipeRetrieveRequest {
@@ -1302,7 +1302,7 @@ export interface ApiShoppingListRecipeRetrieveRequest {
export interface ApiShoppingListRecipeUpdateRequest {
id: number;
shoppingListRecipe: Omit<ShoppingListRecipe, 'recipe_name'|'mealplan_note'|'mealplan_from_date'|'mealplan_type'>;
shoppingListRecipe: Omit<ShoppingListRecipe, 'recipe_data'|'meal_plan_data'>;
}
export interface ApiSpaceListRequest {

View File

@@ -95,7 +95,7 @@ export interface PatchedShoppingListEntry {
* @type {ShoppingListRecipe}
* @memberof PatchedShoppingListEntry
*/
readonly recipeMealplan?: ShoppingListRecipe;
readonly listRecipeData?: ShoppingListRecipe;
/**
*
* @type {User}
@@ -126,6 +126,12 @@ export interface PatchedShoppingListEntry {
* @memberof PatchedShoppingListEntry
*/
delayUntil?: Date | null;
/**
* If a mealplan id is given try to find existing or create new ShoppingListRecipe with that meal plan and link entry to it
* @type {number}
* @memberof PatchedShoppingListEntry
*/
mealplanId?: number;
}
/**
@@ -152,12 +158,13 @@ export function PatchedShoppingListEntryFromJSONTyped(json: any, ignoreDiscrimin
'amount': json['amount'] == null ? undefined : json['amount'],
'order': json['order'] == null ? undefined : json['order'],
'checked': json['checked'] == null ? undefined : json['checked'],
'recipeMealplan': json['recipe_mealplan'] == null ? undefined : ShoppingListRecipeFromJSON(json['recipe_mealplan']),
'listRecipeData': json['list_recipe_data'] == null ? undefined : ShoppingListRecipeFromJSON(json['list_recipe_data']),
'createdBy': json['created_by'] == null ? undefined : UserFromJSON(json['created_by']),
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
'updatedAt': json['updated_at'] == null ? undefined : (new Date(json['updated_at'])),
'completedAt': json['completed_at'] == null ? undefined : (new Date(json['completed_at'])),
'delayUntil': json['delay_until'] == null ? undefined : (new Date(json['delay_until'])),
'mealplanId': json['mealplan_id'] == null ? undefined : json['mealplan_id'],
};
}
@@ -165,7 +172,7 @@ export function PatchedShoppingListEntryToJSON(json: any): PatchedShoppingListEn
return PatchedShoppingListEntryToJSONTyped(json, false);
}
export function PatchedShoppingListEntryToJSONTyped(value?: Omit<PatchedShoppingListEntry, 'recipe_mealplan'|'created_by'|'created_at'|'updated_at'> | null, ignoreDiscriminator: boolean = false): any {
export function PatchedShoppingListEntryToJSONTyped(value?: Omit<PatchedShoppingListEntry, 'list_recipe_data'|'created_by'|'created_at'|'updated_at'> | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
@@ -181,6 +188,7 @@ export function PatchedShoppingListEntryToJSONTyped(value?: Omit<PatchedShopping
'checked': value['checked'],
'completed_at': value['completedAt'] == null ? undefined : ((value['completedAt'] as any).toISOString()),
'delay_until': value['delayUntil'] == null ? undefined : ((value['delayUntil'] as any).toISOString()),
'mealplan_id': value['mealplanId'],
};
}

View File

@@ -13,6 +13,21 @@
*/
import { mapValues } from '../runtime';
import type { MealPlan } from './MealPlan';
import {
MealPlanFromJSON,
MealPlanFromJSONTyped,
MealPlanToJSON,
MealPlanToJSONTyped,
} from './MealPlan';
import type { RecipeOverview } from './RecipeOverview';
import {
RecipeOverviewFromJSON,
RecipeOverviewFromJSONTyped,
RecipeOverviewToJSON,
RecipeOverviewToJSONTyped,
} from './RecipeOverview';
/**
*
* @export
@@ -25,12 +40,6 @@ export interface PatchedShoppingListRecipe {
* @memberof PatchedShoppingListRecipe
*/
id?: number;
/**
*
* @type {string}
* @memberof PatchedShoppingListRecipe
*/
readonly recipeName?: string;
/**
*
* @type {string}
@@ -43,36 +52,30 @@ export interface PatchedShoppingListRecipe {
* @memberof PatchedShoppingListRecipe
*/
recipe?: number | null;
/**
*
* @type {RecipeOverview}
* @memberof PatchedShoppingListRecipe
*/
readonly recipeData?: RecipeOverview;
/**
*
* @type {number}
* @memberof PatchedShoppingListRecipe
*/
mealplan?: number | null;
/**
*
* @type {MealPlan}
* @memberof PatchedShoppingListRecipe
*/
readonly mealPlanData?: MealPlan;
/**
*
* @type {number}
* @memberof PatchedShoppingListRecipe
*/
servings?: number;
/**
*
* @type {string}
* @memberof PatchedShoppingListRecipe
*/
readonly mealplanNote?: string;
/**
*
* @type {Date}
* @memberof PatchedShoppingListRecipe
*/
readonly mealplanFromDate?: Date;
/**
*
* @type {string}
* @memberof PatchedShoppingListRecipe
*/
readonly mealplanType?: string;
}
/**
@@ -93,14 +96,12 @@ export function PatchedShoppingListRecipeFromJSONTyped(json: any, ignoreDiscrimi
return {
'id': json['id'] == null ? undefined : json['id'],
'recipeName': json['recipe_name'] == null ? undefined : json['recipe_name'],
'name': json['name'] == null ? undefined : json['name'],
'recipe': json['recipe'] == null ? undefined : json['recipe'],
'recipeData': json['recipe_data'] == null ? undefined : RecipeOverviewFromJSON(json['recipe_data']),
'mealplan': json['mealplan'] == null ? undefined : json['mealplan'],
'mealPlanData': json['meal_plan_data'] == null ? undefined : MealPlanFromJSON(json['meal_plan_data']),
'servings': json['servings'] == null ? undefined : json['servings'],
'mealplanNote': json['mealplan_note'] == null ? undefined : json['mealplan_note'],
'mealplanFromDate': json['mealplan_from_date'] == null ? undefined : (new Date(json['mealplan_from_date'])),
'mealplanType': json['mealplan_type'] == null ? undefined : json['mealplan_type'],
};
}
@@ -108,7 +109,7 @@ export function PatchedShoppingListRecipeToJSON(json: any): PatchedShoppingListR
return PatchedShoppingListRecipeToJSONTyped(json, false);
}
export function PatchedShoppingListRecipeToJSONTyped(value?: Omit<PatchedShoppingListRecipe, 'recipe_name'|'mealplan_note'|'mealplan_from_date'|'mealplan_type'> | null, ignoreDiscriminator: boolean = false): any {
export function PatchedShoppingListRecipeToJSONTyped(value?: Omit<PatchedShoppingListRecipe, 'recipe_data'|'meal_plan_data'> | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}

View File

@@ -95,7 +95,7 @@ export interface ShoppingListEntry {
* @type {ShoppingListRecipe}
* @memberof ShoppingListEntry
*/
readonly recipeMealplan: ShoppingListRecipe;
readonly listRecipeData: ShoppingListRecipe;
/**
*
* @type {User}
@@ -126,6 +126,12 @@ export interface ShoppingListEntry {
* @memberof ShoppingListEntry
*/
delayUntil?: Date | null;
/**
* If a mealplan id is given try to find existing or create new ShoppingListRecipe with that meal plan and link entry to it
* @type {number}
* @memberof ShoppingListEntry
*/
mealplanId?: number;
}
/**
@@ -134,7 +140,7 @@ export interface ShoppingListEntry {
export function instanceOfShoppingListEntry(value: object): value is ShoppingListEntry {
if (!('food' in value) || value['food'] === undefined) return false;
if (!('amount' in value) || value['amount'] === undefined) return false;
if (!('recipeMealplan' in value) || value['recipeMealplan'] === undefined) return false;
if (!('listRecipeData' in value) || value['listRecipeData'] === undefined) return false;
if (!('createdBy' in value) || value['createdBy'] === undefined) return false;
if (!('createdAt' in value) || value['createdAt'] === undefined) return false;
if (!('updatedAt' in value) || value['updatedAt'] === undefined) return false;
@@ -158,12 +164,13 @@ export function ShoppingListEntryFromJSONTyped(json: any, ignoreDiscriminator: b
'amount': json['amount'],
'order': json['order'] == null ? undefined : json['order'],
'checked': json['checked'] == null ? undefined : json['checked'],
'recipeMealplan': ShoppingListRecipeFromJSON(json['recipe_mealplan']),
'listRecipeData': ShoppingListRecipeFromJSON(json['list_recipe_data']),
'createdBy': UserFromJSON(json['created_by']),
'createdAt': (new Date(json['created_at'])),
'updatedAt': (new Date(json['updated_at'])),
'completedAt': json['completed_at'] == null ? undefined : (new Date(json['completed_at'])),
'delayUntil': json['delay_until'] == null ? undefined : (new Date(json['delay_until'])),
'mealplanId': json['mealplan_id'] == null ? undefined : json['mealplan_id'],
};
}
@@ -171,7 +178,7 @@ export function ShoppingListEntryToJSON(json: any): ShoppingListEntry {
return ShoppingListEntryToJSONTyped(json, false);
}
export function ShoppingListEntryToJSONTyped(value?: Omit<ShoppingListEntry, 'recipe_mealplan'|'created_by'|'created_at'|'updated_at'> | null, ignoreDiscriminator: boolean = false): any {
export function ShoppingListEntryToJSONTyped(value?: Omit<ShoppingListEntry, 'list_recipe_data'|'created_by'|'created_at'|'updated_at'> | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
@@ -187,6 +194,7 @@ export function ShoppingListEntryToJSONTyped(value?: Omit<ShoppingListEntry, 're
'checked': value['checked'],
'completed_at': value['completedAt'] == null ? undefined : ((value['completedAt'] as any).toISOString()),
'delay_until': value['delayUntil'] == null ? undefined : ((value['delayUntil'] as any).toISOString()),
'mealplan_id': value['mealplanId'],
};
}

View File

@@ -13,6 +13,21 @@
*/
import { mapValues } from '../runtime';
import type { MealPlan } from './MealPlan';
import {
MealPlanFromJSON,
MealPlanFromJSONTyped,
MealPlanToJSON,
MealPlanToJSONTyped,
} from './MealPlan';
import type { RecipeOverview } from './RecipeOverview';
import {
RecipeOverviewFromJSON,
RecipeOverviewFromJSONTyped,
RecipeOverviewToJSON,
RecipeOverviewToJSONTyped,
} from './RecipeOverview';
/**
*
* @export
@@ -25,12 +40,6 @@ export interface ShoppingListRecipe {
* @memberof ShoppingListRecipe
*/
id?: number;
/**
*
* @type {string}
* @memberof ShoppingListRecipe
*/
readonly recipeName: string;
/**
*
* @type {string}
@@ -43,47 +52,39 @@ export interface ShoppingListRecipe {
* @memberof ShoppingListRecipe
*/
recipe?: number | null;
/**
*
* @type {RecipeOverview}
* @memberof ShoppingListRecipe
*/
readonly recipeData: RecipeOverview;
/**
*
* @type {number}
* @memberof ShoppingListRecipe
*/
mealplan?: number | null;
/**
*
* @type {MealPlan}
* @memberof ShoppingListRecipe
*/
readonly mealPlanData: MealPlan;
/**
*
* @type {number}
* @memberof ShoppingListRecipe
*/
servings: number;
/**
*
* @type {string}
* @memberof ShoppingListRecipe
*/
readonly mealplanNote: string;
/**
*
* @type {Date}
* @memberof ShoppingListRecipe
*/
readonly mealplanFromDate: Date;
/**
*
* @type {string}
* @memberof ShoppingListRecipe
*/
readonly mealplanType: string;
}
/**
* Check if a given object implements the ShoppingListRecipe interface.
*/
export function instanceOfShoppingListRecipe(value: object): value is ShoppingListRecipe {
if (!('recipeName' in value) || value['recipeName'] === undefined) return false;
if (!('recipeData' in value) || value['recipeData'] === undefined) return false;
if (!('mealPlanData' in value) || value['mealPlanData'] === undefined) return false;
if (!('servings' in value) || value['servings'] === undefined) return false;
if (!('mealplanNote' in value) || value['mealplanNote'] === undefined) return false;
if (!('mealplanFromDate' in value) || value['mealplanFromDate'] === undefined) return false;
if (!('mealplanType' in value) || value['mealplanType'] === undefined) return false;
return true;
}
@@ -98,14 +99,12 @@ export function ShoppingListRecipeFromJSONTyped(json: any, ignoreDiscriminator:
return {
'id': json['id'] == null ? undefined : json['id'],
'recipeName': json['recipe_name'],
'name': json['name'] == null ? undefined : json['name'],
'recipe': json['recipe'] == null ? undefined : json['recipe'],
'recipeData': RecipeOverviewFromJSON(json['recipe_data']),
'mealplan': json['mealplan'] == null ? undefined : json['mealplan'],
'mealPlanData': MealPlanFromJSON(json['meal_plan_data']),
'servings': json['servings'],
'mealplanNote': json['mealplan_note'],
'mealplanFromDate': (new Date(json['mealplan_from_date'])),
'mealplanType': json['mealplan_type'],
};
}
@@ -113,7 +112,7 @@ export function ShoppingListRecipeToJSON(json: any): ShoppingListRecipe {
return ShoppingListRecipeToJSONTyped(json, false);
}
export function ShoppingListRecipeToJSONTyped(value?: Omit<ShoppingListRecipe, 'recipe_name'|'mealplan_note'|'mealplan_from_date'|'mealplan_type'> | null, ignoreDiscriminator: boolean = false): any {
export function ShoppingListRecipeToJSONTyped(value?: Omit<ShoppingListRecipe, 'recipe_data'|'meal_plan_data'> | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}