model changes and GenericAutoSchema
This commit is contained in:
parent
1642224205
commit
3d674cfca6
@ -781,17 +781,16 @@ class MealPlan(ExportModelOperationsMixin('meal_plan'), models.Model, Permission
|
||||
space = models.ForeignKey(Space, on_delete=models.CASCADE)
|
||||
objects = ScopedManager(space='space')
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
super().save(*args, **kwargs)
|
||||
if self.get_owner().userpreference.mealplan_autoadd_shopping:
|
||||
kwargs = {
|
||||
'mealplan': self,
|
||||
'space': self.space,
|
||||
'created_by': self.get_owner()
|
||||
}
|
||||
if self.get_owner().userpreference.mealplan_autoexclude_onhand:
|
||||
kwargs['ingredients'] = Ingredient.objects.filter(step__recipe=self.recipe, food__on_hand=False, space=self.space).values_list('id', flat=True)
|
||||
ShoppingListEntry.list_from_recipe(**kwargs)
|
||||
# TODO override create method to check if recipes are always added
|
||||
# @classmethod
|
||||
# def generate_shoppinglist(self, ingredients=None):
|
||||
# recipe_list = ShoppingListRecipe.objects.create()
|
||||
# if not ingredients:
|
||||
# ingredients = Ingredient.objects.filter(step__recipe=self.recipe)
|
||||
# for i in ingredients:
|
||||
# ShoppingListEntry.objects.create(
|
||||
|
||||
# )
|
||||
|
||||
def get_label(self):
|
||||
if self.title:
|
||||
@ -831,20 +830,50 @@ class ShoppingListRecipe(ExportModelOperationsMixin('shopping_list_recipe'), mod
|
||||
|
||||
|
||||
class ShoppingListEntry(ExportModelOperationsMixin('shopping_list_entry'), models.Model, PermissionModelMixin):
|
||||
list_recipe = models.ForeignKey(ShoppingListRecipe, on_delete=models.CASCADE, null=True, blank=True) # TODO deprecate
|
||||
list_recipe = models.ForeignKey(ShoppingListRecipe, on_delete=models.CASCADE, null=True, blank=True) # TODO remove when shoppinglist is deprecated
|
||||
food = models.ForeignKey(Food, on_delete=models.CASCADE)
|
||||
unit = models.ForeignKey(Unit, on_delete=models.SET_NULL, null=True, blank=True)
|
||||
ingredient = models.ForeignKey(Ingredient, on_delete=models.CASCADE, null=True, blank=True)
|
||||
amount = models.DecimalField(default=0, decimal_places=16, max_digits=32)
|
||||
order = models.IntegerField(default=0)
|
||||
checked = models.BooleanField(default=False)
|
||||
recipe = models.ForeignKey(Recipe, on_delete=models.SET_NULL, null=True, blank=True)
|
||||
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
completed_at = models.DateTimeField(null=True, blank=True)
|
||||
|
||||
space = models.ForeignKey(Space, on_delete=models.CASCADE)
|
||||
objects = ScopedManager(space='shoppinglist__space')
|
||||
objects = ScopedManager(space='space')
|
||||
|
||||
@classmethod
|
||||
def list_from_recipe(self, recipe=None, mealplan=None, servings=None, ingredients=None, created_by=None, space=None):
|
||||
try:
|
||||
r = recipe or mealplan.recipe
|
||||
except AttributeError:
|
||||
raise ValueError(_("You must supply a recipe or mealplan"))
|
||||
|
||||
created_by = created_by or getattr(mealplan, 'created_by', None)
|
||||
if not created_by:
|
||||
raise ValueError(_("You must supply a created_by"))
|
||||
|
||||
servings = servings or getattr(mealplan, 'servings', 1.0)
|
||||
if ingredients:
|
||||
ingredients = Ingredient.objects.filter(pk__in=ingredients, space=space)
|
||||
else:
|
||||
ingredients = Ingredient.objects.filter(step__recipe=r, space=space)
|
||||
list_recipe = ShoppingListRecipe.objects.create(recipe=r, mealplan=mealplan, servings=servings)
|
||||
shoppinglist = [
|
||||
ShoppingListEntry(
|
||||
list_recipe=list_recipe,
|
||||
food=i.food,
|
||||
unit=i.unit,
|
||||
ingredient=i,
|
||||
amount=i.amount * Decimal(servings),
|
||||
created_by=created_by,
|
||||
space=space
|
||||
)
|
||||
for i in ingredients
|
||||
]
|
||||
return ShoppingListEntry.objects.bulk_create(shoppinglist)
|
||||
|
||||
@classmethod
|
||||
@atomic
|
||||
|
@ -3,11 +3,10 @@ from rest_framework.schemas.utils import is_list_view
|
||||
|
||||
|
||||
class QueryParam(object):
|
||||
def __init__(self, name, description=None, qtype='string', required=False):
|
||||
def __init__(self, name, description=None, qtype='string'):
|
||||
self.name = name
|
||||
self.description = description
|
||||
self.qtype = qtype
|
||||
self.required = required
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.name}, {self.qtype}, {self.description}'
|
||||
@ -20,7 +19,7 @@ class QueryParamAutoSchema(AutoSchema):
|
||||
parameters = super().get_path_parameters(path, method)
|
||||
for q in self.view.query_params:
|
||||
parameters.append({
|
||||
"name": q.name, "in": "query", "required": q.required,
|
||||
"name": q.name, "in": "query", "required": False,
|
||||
"description": q.description,
|
||||
'schema': {'type': q.qtype, },
|
||||
})
|
||||
|
@ -35,20 +35,13 @@ class ExtendedRecipeMixin(serializers.ModelSerializer):
|
||||
except KeyError:
|
||||
api_serializer = None
|
||||
# extended values are computationally expensive and not needed in normal circumstances
|
||||
try:
|
||||
if bool(int(
|
||||
self.context['request'].query_params.get('extended', False))) and self.__class__ == api_serializer:
|
||||
return fields
|
||||
except AttributeError:
|
||||
pass
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
# another choice is to only return the fields when self.__class__ = serializer and not worry about 'extended'
|
||||
if self.context['request'] and bool(int(self.context['request'].query_params.get('extended', False))) and self.__class__ == api_serializer:
|
||||
return fields
|
||||
else:
|
||||
del fields['image']
|
||||
del fields['numrecipe']
|
||||
except KeyError:
|
||||
pass
|
||||
return fields
|
||||
return fields
|
||||
|
||||
def get_image(self, obj):
|
||||
# TODO add caching
|
||||
@ -634,37 +627,18 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
|
||||
read_only_fields = ('created_by',)
|
||||
|
||||
|
||||
# TODO deprecate
|
||||
class ShoppingListRecipeSerializer(serializers.ModelSerializer):
|
||||
name = serializers.SerializerMethodField('get_name') # should this be done at the front end?
|
||||
recipe_name = serializers.ReadOnlyField(source='recipe.name')
|
||||
mealplan_note = serializers.ReadOnlyField(source='mealplan.note')
|
||||
mealplan_note = serializers.SerializerMethodField('get_note_markdown')
|
||||
servings = CustomDecimalField()
|
||||
|
||||
def get_name(self, obj):
|
||||
if not isinstance(value := obj.servings, Decimal):
|
||||
value = Decimal(value)
|
||||
value = value.quantize(Decimal(1)) if value == value.to_integral() else value.normalize() # strips trailing zero
|
||||
return (
|
||||
obj.name
|
||||
or getattr(obj.mealplan, 'title', None)
|
||||
or (d := getattr(obj.mealplan, 'date', None)) and ': '.join([obj.mealplan.recipe.name, str(d)])
|
||||
or obj.recipe.name
|
||||
) + f' ({value:.2g})'
|
||||
|
||||
def update(self, instance, validated_data):
|
||||
if 'servings' in validated_data:
|
||||
ShoppingListEntry.list_from_recipe(
|
||||
list_recipe=instance,
|
||||
servings=validated_data['servings'],
|
||||
created_by=self.context['request'].user,
|
||||
space=self.context['request'].space
|
||||
)
|
||||
return super().update(instance, validated_data)
|
||||
def get_note_markdown(self, obj):
|
||||
return obj.mealplan and markdown(obj.mealplan.note)
|
||||
|
||||
class Meta:
|
||||
model = ShoppingListRecipe
|
||||
fields = ('id', 'recipe_name', 'name', 'recipe', 'mealplan', 'servings', 'mealplan_note')
|
||||
fields = ('id', 'recipe', 'mealplan', 'recipe_name', 'servings', 'mealplan_note')
|
||||
read_only_fields = ('id',)
|
||||
|
||||
|
||||
@ -674,36 +648,63 @@ class ShoppingListEntrySerializer(WritableNestedModelSerializer):
|
||||
ingredient_note = serializers.ReadOnlyField(source='ingredient.note')
|
||||
recipe_mealplan = ShoppingListRecipeSerializer(source='list_recipe', read_only=True)
|
||||
amount = CustomDecimalField()
|
||||
created_by = UserNameSerializer(read_only=True)
|
||||
completed_at = serializers.DateTimeField(allow_null=True)
|
||||
created_by = UserNameSerializer()
|
||||
|
||||
def get_fields(self, *args, **kwargs):
|
||||
fields = super().get_fields(*args, **kwargs)
|
||||
print('shoppinglist', self.__class__, self.parent.__class__)
|
||||
# try:
|
||||
# # this serializer is the parent serializer for the API
|
||||
# api_serializer = self.context['view'].serializer_class
|
||||
# except Exception:
|
||||
# # this serializer is probably nested or a foreign key
|
||||
# api_serializer = None
|
||||
|
||||
# autosync values are only needed for frequent 'checked' value updating
|
||||
if self.context['request'] and bool(int(self.context['request'].query_params.get('autosync', False))):
|
||||
for f in list(set(fields) - set(['id', 'checked'])):
|
||||
del fields[f]
|
||||
# extended values are computationally expensive and not needed in normal circumstances
|
||||
elif not bool(int(self.context['request'].query_params.get('extended', False))) or not self.parent:
|
||||
del fields['notes']
|
||||
# elif bool(int(self.context['request'].query_params.get('extended', False))) and self.__class__ == api_serializer:
|
||||
# pass
|
||||
# else:
|
||||
# del fields['recipe_mealplan']
|
||||
return fields
|
||||
|
||||
def run_validation(self, data):
|
||||
if (
|
||||
data.get('checked', False)
|
||||
and not (id := data.get('id', None))
|
||||
and not ShoppingListEntry.objects.get(id=id).checked
|
||||
):
|
||||
# if checked flips from false to true set completed datetime
|
||||
data['completed_at'] = timezone.now()
|
||||
|
||||
############################################################
|
||||
# temporary while old and new shopping lists are both in use
|
||||
try:
|
||||
# this serializer is the parent serializer for the API
|
||||
api_serializer = self.context['view'].serializer_class
|
||||
except Exception:
|
||||
# this serializer is probably nested or a foreign key
|
||||
api_serializer = None
|
||||
if self.context['request'].method == 'POST' and not self.__class__ == api_serializer:
|
||||
data['space'] = self.context['request'].space.id
|
||||
data['created_by'] = self.context['request'].user.id
|
||||
############################################################
|
||||
if self.context['request'].method == 'POST' and self.__class__ == api_serializer:
|
||||
data['created_by'] = {'id': self.context['request'].user.id}
|
||||
return super().run_validation(data)
|
||||
|
||||
def create(self, validated_data):
|
||||
validated_data['space'] = self.context['request'].space
|
||||
validated_data['created_by'] = self.context['request'].user
|
||||
return super().create(validated_data)
|
||||
|
||||
def update(self, instance, validated_data):
|
||||
if validated_data['checked']:
|
||||
validated_data['completed_at'] = timezone.now()
|
||||
return super().update(instance, validated_data)
|
||||
|
||||
class Meta:
|
||||
model = ShoppingListEntry
|
||||
fields = (
|
||||
'id', 'list_recipe', 'food', 'unit', 'amount', 'order', 'checked',
|
||||
'created_by', 'created_at', 'notes', 'completed_at'
|
||||
'id', 'list_recipe', 'food', 'unit', 'ingredient', 'ingredient_note', 'amount', 'order', 'checked', 'recipe_mealplan',
|
||||
'created_by', 'created_at', 'completed_at'
|
||||
)
|
||||
read_only_fields = ('id', 'created_by', 'created_at',)
|
||||
|
||||
|
@ -120,4 +120,7 @@ def test_delete(u1_s1, u1_s2, obj_1):
|
||||
|
||||
|
||||
# test sharing
|
||||
# test completed entries still visible if today, but not yesterday
|
||||
# test completed entries still visible if today, but not yesterday
|
||||
# test create shopping list from recipe
|
||||
# test create shopping list from mealplan
|
||||
# test create shopping list from recipe, excluding ingredients
|
@ -404,19 +404,16 @@ export class Models {
|
||||
}
|
||||
|
||||
static RECIPE = {
|
||||
name: i18n.t("Recipe"),
|
||||
apiName: "Recipe",
|
||||
list: {
|
||||
params: ["query", "keywords", "foods", "units", "rating", "books", "keywordsOr", "foodsOr", "booksOr", "internal", "random", "_new", "page", "pageSize", "options"],
|
||||
'name': i18n.t('Recipe'),
|
||||
'apiName': 'Recipe',
|
||||
'list': {
|
||||
'params': ['query', 'keywords', 'foods', 'units', 'rating', 'books', 'keywordsOr', 'foodsOr', 'booksOr', 'internal', 'random', '_new', 'page', 'pageSize', 'options'],
|
||||
// 'config': {
|
||||
// 'foods': {'type': 'string'},
|
||||
// 'keywords': {'type': 'string'},
|
||||
// 'books': {'type': 'string'},
|
||||
// }
|
||||
},
|
||||
shopping: {
|
||||
params: ["id", ["id", "list_recipe", "ingredients", "servings"]],
|
||||
},
|
||||
}
|
||||
|
||||
static USER_NAME = {
|
||||
|
@ -227,12 +227,6 @@ export interface Food {
|
||||
* @memberof Food
|
||||
*/
|
||||
parent?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Food
|
||||
*/
|
||||
numchild?: number;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@ -244,63 +238,7 @@ export interface Food {
|
||||
* @type {boolean}
|
||||
* @memberof Food
|
||||
*/
|
||||
inherit?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {Array<FoodIgnoreInherit>}
|
||||
* @memberof Food
|
||||
*/
|
||||
ignore_inherit?: Array<FoodIgnoreInherit> | null;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface FoodIgnoreInherit
|
||||
*/
|
||||
export interface FoodIgnoreInherit {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof FoodIgnoreInherit
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof FoodIgnoreInherit
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof FoodIgnoreInherit
|
||||
*/
|
||||
field?: string;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface FoodInheritField
|
||||
*/
|
||||
export interface FoodInheritField {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof FoodInheritField
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof FoodInheritField
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof FoodInheritField
|
||||
*/
|
||||
field?: string;
|
||||
on_hand?: boolean;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@ -501,6 +439,18 @@ export interface ImportLogKeyword {
|
||||
* @memberof ImportLogKeyword
|
||||
*/
|
||||
numchild?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ImportLogKeyword
|
||||
*/
|
||||
created_at?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ImportLogKeyword
|
||||
*/
|
||||
updated_at?: string;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@ -963,13 +913,7 @@ export interface Keyword {
|
||||
* @type {string}
|
||||
* @memberof Keyword
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Keyword
|
||||
*/
|
||||
icon?: string | null;
|
||||
parent?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -981,13 +925,7 @@ export interface Keyword {
|
||||
* @type {string}
|
||||
* @memberof Keyword
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Keyword
|
||||
*/
|
||||
parent?: string;
|
||||
created_at?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@ -1441,10 +1379,10 @@ export interface RecipeBook {
|
||||
icon?: string | null;
|
||||
/**
|
||||
*
|
||||
* @type {Array<RecipeBookShared>}
|
||||
* @type {Array<ShoppingListCreatedBy>}
|
||||
* @memberof RecipeBook
|
||||
*/
|
||||
shared: Array<RecipeBookShared>;
|
||||
shared: Array<ShoppingListCreatedBy>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -1618,13 +1556,7 @@ export interface RecipeKeywords {
|
||||
* @type {string}
|
||||
* @memberof RecipeKeywords
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof RecipeKeywords
|
||||
*/
|
||||
icon?: string | null;
|
||||
parent?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -1636,13 +1568,7 @@ export interface RecipeKeywords {
|
||||
* @type {string}
|
||||
* @memberof RecipeKeywords
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof RecipeKeywords
|
||||
*/
|
||||
parent?: string;
|
||||
created_at?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@ -1993,10 +1919,10 @@ export interface ShoppingList {
|
||||
entries: Array<ShoppingListEntries> | null;
|
||||
/**
|
||||
*
|
||||
* @type {Array<RecipeBookShared>}
|
||||
* @type {Array<ShoppingListCreatedBy>}
|
||||
* @memberof ShoppingList
|
||||
*/
|
||||
shared: Array<RecipeBookShared>;
|
||||
shared: Array<ShoppingListCreatedBy>;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@ -2077,6 +2003,18 @@ export interface ShoppingListEntries {
|
||||
* @memberof ShoppingListEntries
|
||||
*/
|
||||
ingredient?: number | null;
|
||||
/**
|
||||
*
|
||||
* @type {FoodSupermarketCategory}
|
||||
* @memberof ShoppingListEntries
|
||||
*/
|
||||
unit?: FoodSupermarketCategory | null;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ShoppingListEntries
|
||||
*/
|
||||
ingredient?: number | null;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -2112,7 +2050,7 @@ export interface ShoppingListEntries {
|
||||
* @type {ShoppingListCreatedBy}
|
||||
* @memberof ShoppingListEntries
|
||||
*/
|
||||
created_by?: ShoppingListCreatedBy;
|
||||
created_by: ShoppingListCreatedBy;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -2124,7 +2062,7 @@ export interface ShoppingListEntries {
|
||||
* @type {string}
|
||||
* @memberof ShoppingListEntries
|
||||
*/
|
||||
completed_at?: string;
|
||||
completed_at?: string | null;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@ -2231,10 +2169,22 @@ export interface ShoppingListRecipe {
|
||||
name?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ShoppingListRecipe
|
||||
* @type {FoodSupermarketCategory}
|
||||
* @memberof ShoppingListEntry
|
||||
*/
|
||||
recipe?: number | null;
|
||||
unit?: FoodSupermarketCategory | null;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ShoppingListEntry
|
||||
*/
|
||||
ingredient?: number | null;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ShoppingListEntry
|
||||
*/
|
||||
ingredient_note?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@ -2252,7 +2202,31 @@ export interface ShoppingListRecipe {
|
||||
* @type {string}
|
||||
* @memberof ShoppingListRecipe
|
||||
*/
|
||||
mealplan_note?: string;
|
||||
checked?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {ShoppingListRecipeMealplan}
|
||||
* @memberof ShoppingListEntry
|
||||
*/
|
||||
recipe_mealplan?: ShoppingListRecipeMealplan;
|
||||
/**
|
||||
*
|
||||
* @type {ShoppingListCreatedBy}
|
||||
* @memberof ShoppingListEntry
|
||||
*/
|
||||
created_by: ShoppingListCreatedBy;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ShoppingListEntry
|
||||
*/
|
||||
created_at?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ShoppingListEntry
|
||||
*/
|
||||
completed_at?: string | null;
|
||||
}
|
||||
/**
|
||||
*
|
||||
@ -2281,6 +2255,61 @@ export interface ShoppingListRecipeMealplan {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ShoppingListRecipe
|
||||
*/
|
||||
mealplan?: number | null;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ShoppingListRecipe
|
||||
*/
|
||||
mealplan?: number | null;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ShoppingListRecipeMealplan
|
||||
*/
|
||||
servings: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ShoppingListRecipe
|
||||
*/
|
||||
mealplan_note?: string;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface ShoppingListRecipeMealplan
|
||||
*/
|
||||
export interface ShoppingListRecipeMealplan {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ShoppingListRecipeMealplan
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ShoppingListRecipes
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ShoppingListRecipeMealplan
|
||||
*/
|
||||
recipe?: number | null;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ShoppingListRecipeMealplan
|
||||
*/
|
||||
mealplan?: number | null;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ShoppingListRecipeMealplan
|
||||
*/
|
||||
mealplan?: number | null;
|
||||
@ -2309,12 +2338,6 @@ export interface ShoppingListRecipes {
|
||||
* @memberof ShoppingListRecipes
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ShoppingListRecipes
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@ -2327,6 +2350,12 @@ export interface ShoppingListRecipes {
|
||||
* @memberof ShoppingListRecipes
|
||||
*/
|
||||
mealplan?: number | null;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ShoppingListRecipes
|
||||
*/
|
||||
recipe_name?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@ -2530,6 +2559,147 @@ export enum StepTypeEnum {
|
||||
Recipe = 'RECIPE'
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface StepFile
|
||||
*/
|
||||
export interface StepFile {
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof StepFile
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof StepFile
|
||||
*/
|
||||
file?: any;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof StepFile
|
||||
*/
|
||||
id?: number;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface StepFood
|
||||
*/
|
||||
export interface StepFood {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof StepFood
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof StepFood
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof StepFood
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
*
|
||||
* @type {FoodRecipe}
|
||||
* @memberof StepFood
|
||||
*/
|
||||
recipe?: FoodRecipe | null;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof StepFood
|
||||
*/
|
||||
ignore_shopping?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {FoodSupermarketCategory}
|
||||
* @memberof StepFood
|
||||
*/
|
||||
supermarket_category?: FoodSupermarketCategory | null;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof StepFood
|
||||
*/
|
||||
parent?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof StepFood
|
||||
*/
|
||||
numchild?: number;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof StepFood
|
||||
*/
|
||||
on_hand?: boolean;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface StepIngredients
|
||||
*/
|
||||
export interface StepIngredients {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof StepIngredients
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {StepFood}
|
||||
* @memberof StepIngredients
|
||||
*/
|
||||
food: StepFood | null;
|
||||
/**
|
||||
*
|
||||
* @type {FoodSupermarketCategory}
|
||||
* @memberof StepIngredients
|
||||
*/
|
||||
unit: FoodSupermarketCategory | null;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof StepIngredients
|
||||
*/
|
||||
amount: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof StepIngredients
|
||||
*/
|
||||
note?: string | null;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof StepIngredients
|
||||
*/
|
||||
order?: number;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof StepIngredients
|
||||
*/
|
||||
is_header?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof StepIngredients
|
||||
*/
|
||||
no_amount?: boolean;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -5237,13 +5407,12 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {string} [checked] Filter shopping list entries on checked. Valid values are true, false, both and <b>false+</b>.<br> - false+ includes unchecked items and recently completed items.
|
||||
* @param {number} [id] Returns the shopping list entry with a primary key of id. Multiple values allowed.
|
||||
* @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items.
|
||||
* @param {number} [supermarket] Returns the shopping list entries sorted by supermarket category order.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
listShoppingListEntrys: async (id?: number, checked?: string, supermarket?: number, options: any = {}): Promise<RequestArgs> => {
|
||||
listShoppingListEntrys: async (checked?: string, id?: number, options: any = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/shopping-list-entry/`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
@ -5256,16 +5425,12 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
if (id !== undefined) {
|
||||
localVarQueryParameter['id'] = id;
|
||||
}
|
||||
|
||||
if (checked !== undefined) {
|
||||
localVarQueryParameter['checked'] = checked;
|
||||
}
|
||||
|
||||
if (supermarket !== undefined) {
|
||||
localVarQueryParameter['supermarket'] = supermarket;
|
||||
if (id !== undefined) {
|
||||
localVarQueryParameter['id'] = id;
|
||||
}
|
||||
|
||||
|
||||
@ -9546,14 +9711,13 @@ export const ApiApiFp = function(configuration?: Configuration) {
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {string} [checked] Filter shopping list entries on checked. Valid values are true, false, both and <b>false+</b>.<br> - false+ includes unchecked items and recently completed items.
|
||||
* @param {number} [id] Returns the shopping list entry with a primary key of id. Multiple values allowed.
|
||||
* @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items.
|
||||
* @param {number} [supermarket] Returns the shopping list entries sorted by supermarket category order.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async listShoppingListEntrys(id?: number, checked?: string, supermarket?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ShoppingListEntry>>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.listShoppingListEntrys(id, checked, supermarket, options);
|
||||
async listShoppingListEntrys(checked?: string, id?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ShoppingListEntry>>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.listShoppingListEntrys(checked, id, options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
@ -11229,14 +11393,13 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {string} [checked] Filter shopping list entries on checked. Valid values are true, false, both and <b>false+</b>.<br> - false+ includes unchecked items and recently completed items.
|
||||
* @param {number} [id] Returns the shopping list entry with a primary key of id. Multiple values allowed.
|
||||
* @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items.
|
||||
* @param {number} [supermarket] Returns the shopping list entries sorted by supermarket category order.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
listShoppingListEntrys(id?: number, checked?: string, supermarket?: number, options?: any): AxiosPromise<Array<ShoppingListEntry>> {
|
||||
return localVarFp.listShoppingListEntrys(id, checked, supermarket, options).then((request) => request(axios, basePath));
|
||||
listShoppingListEntrys(checked?: string, id?: number, options?: any): AxiosPromise<Array<ShoppingListEntry>> {
|
||||
return localVarFp.listShoppingListEntrys(checked, id, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -12939,15 +13102,14 @@ export class ApiApi extends BaseAPI {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} [checked] Filter shopping list entries on checked. Valid values are true, false, both and <b>false+</b>.<br> - false+ includes unchecked items and recently completed items.
|
||||
* @param {number} [id] Returns the shopping list entry with a primary key of id. Multiple values allowed.
|
||||
* @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items.
|
||||
* @param {number} [supermarket] Returns the shopping list entries sorted by supermarket category order.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof ApiApi
|
||||
*/
|
||||
public listShoppingListEntrys(id?: number, checked?: string, supermarket?: number, options?: any) {
|
||||
return ApiApiFp(this.configuration).listShoppingListEntrys(id, checked, supermarket, options).then((request) => request(this.axios, this.basePath));
|
||||
public listShoppingListEntrys(checked?: string, id?: number, options?: any) {
|
||||
return ApiApiFp(this.configuration).listShoppingListEntrys(checked, id, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user