model changes and GenericAutoSchema
This commit is contained in:
@ -781,17 +781,16 @@ class MealPlan(ExportModelOperationsMixin('meal_plan'), models.Model, Permission
|
|||||||
space = models.ForeignKey(Space, on_delete=models.CASCADE)
|
space = models.ForeignKey(Space, on_delete=models.CASCADE)
|
||||||
objects = ScopedManager(space='space')
|
objects = ScopedManager(space='space')
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
# TODO override create method to check if recipes are always added
|
||||||
super().save(*args, **kwargs)
|
# @classmethod
|
||||||
if self.get_owner().userpreference.mealplan_autoadd_shopping:
|
# def generate_shoppinglist(self, ingredients=None):
|
||||||
kwargs = {
|
# recipe_list = ShoppingListRecipe.objects.create()
|
||||||
'mealplan': self,
|
# if not ingredients:
|
||||||
'space': self.space,
|
# ingredients = Ingredient.objects.filter(step__recipe=self.recipe)
|
||||||
'created_by': self.get_owner()
|
# for i in ingredients:
|
||||||
}
|
# ShoppingListEntry.objects.create(
|
||||||
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)
|
|
||||||
|
|
||||||
def get_label(self):
|
def get_label(self):
|
||||||
if self.title:
|
if self.title:
|
||||||
@ -831,20 +830,50 @@ class ShoppingListRecipe(ExportModelOperationsMixin('shopping_list_recipe'), mod
|
|||||||
|
|
||||||
|
|
||||||
class ShoppingListEntry(ExportModelOperationsMixin('shopping_list_entry'), models.Model, PermissionModelMixin):
|
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)
|
food = models.ForeignKey(Food, on_delete=models.CASCADE)
|
||||||
unit = models.ForeignKey(Unit, on_delete=models.SET_NULL, null=True, blank=True)
|
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)
|
ingredient = models.ForeignKey(Ingredient, on_delete=models.CASCADE, null=True, blank=True)
|
||||||
amount = models.DecimalField(default=0, decimal_places=16, max_digits=32)
|
amount = models.DecimalField(default=0, decimal_places=16, max_digits=32)
|
||||||
order = models.IntegerField(default=0)
|
order = models.IntegerField(default=0)
|
||||||
checked = models.BooleanField(default=False)
|
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_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
completed_at = models.DateTimeField(null=True, blank=True)
|
completed_at = models.DateTimeField(null=True, blank=True)
|
||||||
|
|
||||||
space = models.ForeignKey(Space, on_delete=models.CASCADE)
|
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
|
@classmethod
|
||||||
@atomic
|
@atomic
|
||||||
|
@ -3,11 +3,10 @@ from rest_framework.schemas.utils import is_list_view
|
|||||||
|
|
||||||
|
|
||||||
class QueryParam(object):
|
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.name = name
|
||||||
self.description = description
|
self.description = description
|
||||||
self.qtype = qtype
|
self.qtype = qtype
|
||||||
self.required = required
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.name}, {self.qtype}, {self.description}'
|
return f'{self.name}, {self.qtype}, {self.description}'
|
||||||
@ -20,7 +19,7 @@ class QueryParamAutoSchema(AutoSchema):
|
|||||||
parameters = super().get_path_parameters(path, method)
|
parameters = super().get_path_parameters(path, method)
|
||||||
for q in self.view.query_params:
|
for q in self.view.query_params:
|
||||||
parameters.append({
|
parameters.append({
|
||||||
"name": q.name, "in": "query", "required": q.required,
|
"name": q.name, "in": "query", "required": False,
|
||||||
"description": q.description,
|
"description": q.description,
|
||||||
'schema': {'type': q.qtype, },
|
'schema': {'type': q.qtype, },
|
||||||
})
|
})
|
||||||
|
@ -35,20 +35,13 @@ class ExtendedRecipeMixin(serializers.ModelSerializer):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
api_serializer = None
|
api_serializer = None
|
||||||
# extended values are computationally expensive and not needed in normal circumstances
|
# extended values are computationally expensive and not needed in normal circumstances
|
||||||
try:
|
# another choice is to only return the fields when self.__class__ = serializer and not worry about 'extended'
|
||||||
if bool(int(
|
if self.context['request'] and bool(int(self.context['request'].query_params.get('extended', False))) and self.__class__ == api_serializer:
|
||||||
self.context['request'].query_params.get('extended', False))) and self.__class__ == api_serializer:
|
return fields
|
||||||
return fields
|
else:
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
del fields['image']
|
del fields['image']
|
||||||
del fields['numrecipe']
|
del fields['numrecipe']
|
||||||
except KeyError:
|
return fields
|
||||||
pass
|
|
||||||
return fields
|
|
||||||
|
|
||||||
def get_image(self, obj):
|
def get_image(self, obj):
|
||||||
# TODO add caching
|
# TODO add caching
|
||||||
@ -634,37 +627,18 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
|
|||||||
read_only_fields = ('created_by',)
|
read_only_fields = ('created_by',)
|
||||||
|
|
||||||
|
|
||||||
# TODO deprecate
|
|
||||||
class ShoppingListRecipeSerializer(serializers.ModelSerializer):
|
class ShoppingListRecipeSerializer(serializers.ModelSerializer):
|
||||||
name = serializers.SerializerMethodField('get_name') # should this be done at the front end?
|
name = serializers.SerializerMethodField('get_name') # should this be done at the front end?
|
||||||
recipe_name = serializers.ReadOnlyField(source='recipe.name')
|
recipe_name = serializers.ReadOnlyField(source='recipe.name')
|
||||||
mealplan_note = serializers.ReadOnlyField(source='mealplan.note')
|
mealplan_note = serializers.SerializerMethodField('get_note_markdown')
|
||||||
servings = CustomDecimalField()
|
servings = CustomDecimalField()
|
||||||
|
|
||||||
def get_name(self, obj):
|
def get_note_markdown(self, obj):
|
||||||
if not isinstance(value := obj.servings, Decimal):
|
return obj.mealplan and markdown(obj.mealplan.note)
|
||||||
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)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ShoppingListRecipe
|
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',)
|
read_only_fields = ('id',)
|
||||||
|
|
||||||
|
|
||||||
@ -674,36 +648,63 @@ class ShoppingListEntrySerializer(WritableNestedModelSerializer):
|
|||||||
ingredient_note = serializers.ReadOnlyField(source='ingredient.note')
|
ingredient_note = serializers.ReadOnlyField(source='ingredient.note')
|
||||||
recipe_mealplan = ShoppingListRecipeSerializer(source='list_recipe', read_only=True)
|
recipe_mealplan = ShoppingListRecipeSerializer(source='list_recipe', read_only=True)
|
||||||
amount = CustomDecimalField()
|
amount = CustomDecimalField()
|
||||||
created_by = UserNameSerializer(read_only=True)
|
created_by = UserNameSerializer()
|
||||||
completed_at = serializers.DateTimeField(allow_null=True)
|
|
||||||
|
|
||||||
def get_fields(self, *args, **kwargs):
|
def get_fields(self, *args, **kwargs):
|
||||||
fields = super().get_fields(*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
|
# 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))):
|
if self.context['request'] and bool(int(self.context['request'].query_params.get('autosync', False))):
|
||||||
for f in list(set(fields) - set(['id', 'checked'])):
|
for f in list(set(fields) - set(['id', 'checked'])):
|
||||||
del fields[f]
|
del fields[f]
|
||||||
# extended values are computationally expensive and not needed in normal circumstances
|
# 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:
|
# elif bool(int(self.context['request'].query_params.get('extended', False))) and self.__class__ == api_serializer:
|
||||||
del fields['notes']
|
# pass
|
||||||
|
# else:
|
||||||
|
# del fields['recipe_mealplan']
|
||||||
return fields
|
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):
|
def create(self, validated_data):
|
||||||
validated_data['space'] = self.context['request'].space
|
validated_data['space'] = self.context['request'].space
|
||||||
validated_data['created_by'] = self.context['request'].user
|
validated_data['created_by'] = self.context['request'].user
|
||||||
return super().create(validated_data)
|
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:
|
class Meta:
|
||||||
model = ShoppingListEntry
|
model = ShoppingListEntry
|
||||||
fields = (
|
fields = (
|
||||||
'id', 'list_recipe', 'food', 'unit', 'amount', 'order', 'checked',
|
'id', 'list_recipe', 'food', 'unit', 'ingredient', 'ingredient_note', 'amount', 'order', 'checked', 'recipe_mealplan',
|
||||||
'created_by', 'created_at', 'notes', 'completed_at'
|
'created_by', 'created_at', 'completed_at'
|
||||||
)
|
)
|
||||||
read_only_fields = ('id', 'created_by', 'created_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 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 = {
|
static RECIPE = {
|
||||||
name: i18n.t("Recipe"),
|
'name': i18n.t('Recipe'),
|
||||||
apiName: "Recipe",
|
'apiName': 'Recipe',
|
||||||
list: {
|
'list': {
|
||||||
params: ["query", "keywords", "foods", "units", "rating", "books", "keywordsOr", "foodsOr", "booksOr", "internal", "random", "_new", "page", "pageSize", "options"],
|
'params': ['query', 'keywords', 'foods', 'units', 'rating', 'books', 'keywordsOr', 'foodsOr', 'booksOr', 'internal', 'random', '_new', 'page', 'pageSize', 'options'],
|
||||||
// 'config': {
|
// 'config': {
|
||||||
// 'foods': {'type': 'string'},
|
// 'foods': {'type': 'string'},
|
||||||
// 'keywords': {'type': 'string'},
|
// 'keywords': {'type': 'string'},
|
||||||
// 'books': {'type': 'string'},
|
// 'books': {'type': 'string'},
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
shopping: {
|
|
||||||
params: ["id", ["id", "list_recipe", "ingredients", "servings"]],
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static USER_NAME = {
|
static USER_NAME = {
|
||||||
|
@ -227,12 +227,6 @@ export interface Food {
|
|||||||
* @memberof Food
|
* @memberof Food
|
||||||
*/
|
*/
|
||||||
parent?: string;
|
parent?: string;
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof Food
|
|
||||||
*/
|
|
||||||
numchild?: number;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@ -244,63 +238,7 @@ export interface Food {
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
* @memberof Food
|
* @memberof Food
|
||||||
*/
|
*/
|
||||||
inherit?: boolean;
|
on_hand?: 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;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -501,6 +439,18 @@ export interface ImportLogKeyword {
|
|||||||
* @memberof ImportLogKeyword
|
* @memberof ImportLogKeyword
|
||||||
*/
|
*/
|
||||||
numchild?: number;
|
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}
|
* @type {string}
|
||||||
* @memberof Keyword
|
* @memberof Keyword
|
||||||
*/
|
*/
|
||||||
name: string;
|
parent?: string;
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Keyword
|
|
||||||
*/
|
|
||||||
icon?: string | null;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@ -981,13 +925,7 @@ export interface Keyword {
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof Keyword
|
* @memberof Keyword
|
||||||
*/
|
*/
|
||||||
description?: string;
|
created_at?: string;
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof Keyword
|
|
||||||
*/
|
|
||||||
parent?: string;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {number}
|
* @type {number}
|
||||||
@ -1441,10 +1379,10 @@ export interface RecipeBook {
|
|||||||
icon?: string | null;
|
icon?: string | null;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {Array<RecipeBookShared>}
|
* @type {Array<ShoppingListCreatedBy>}
|
||||||
* @memberof RecipeBook
|
* @memberof RecipeBook
|
||||||
*/
|
*/
|
||||||
shared: Array<RecipeBookShared>;
|
shared: Array<ShoppingListCreatedBy>;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@ -1618,13 +1556,7 @@ export interface RecipeKeywords {
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof RecipeKeywords
|
* @memberof RecipeKeywords
|
||||||
*/
|
*/
|
||||||
name: string;
|
parent?: string;
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof RecipeKeywords
|
|
||||||
*/
|
|
||||||
icon?: string | null;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@ -1636,13 +1568,7 @@ export interface RecipeKeywords {
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof RecipeKeywords
|
* @memberof RecipeKeywords
|
||||||
*/
|
*/
|
||||||
description?: string;
|
created_at?: string;
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof RecipeKeywords
|
|
||||||
*/
|
|
||||||
parent?: string;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {number}
|
* @type {number}
|
||||||
@ -1993,10 +1919,10 @@ export interface ShoppingList {
|
|||||||
entries: Array<ShoppingListEntries> | null;
|
entries: Array<ShoppingListEntries> | null;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {Array<RecipeBookShared>}
|
* @type {Array<ShoppingListCreatedBy>}
|
||||||
* @memberof ShoppingList
|
* @memberof ShoppingList
|
||||||
*/
|
*/
|
||||||
shared: Array<RecipeBookShared>;
|
shared: Array<ShoppingListCreatedBy>;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@ -2077,6 +2003,18 @@ export interface ShoppingListEntries {
|
|||||||
* @memberof ShoppingListEntries
|
* @memberof ShoppingListEntries
|
||||||
*/
|
*/
|
||||||
ingredient?: number | null;
|
ingredient?: number | null;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {FoodSupermarketCategory}
|
||||||
|
* @memberof ShoppingListEntries
|
||||||
|
*/
|
||||||
|
unit?: FoodSupermarketCategory | null;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof ShoppingListEntries
|
||||||
|
*/
|
||||||
|
ingredient?: number | null;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@ -2112,7 +2050,7 @@ export interface ShoppingListEntries {
|
|||||||
* @type {ShoppingListCreatedBy}
|
* @type {ShoppingListCreatedBy}
|
||||||
* @memberof ShoppingListEntries
|
* @memberof ShoppingListEntries
|
||||||
*/
|
*/
|
||||||
created_by?: ShoppingListCreatedBy;
|
created_by: ShoppingListCreatedBy;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@ -2124,7 +2062,7 @@ export interface ShoppingListEntries {
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof ShoppingListEntries
|
* @memberof ShoppingListEntries
|
||||||
*/
|
*/
|
||||||
completed_at?: string;
|
completed_at?: string | null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -2231,10 +2169,22 @@ export interface ShoppingListRecipe {
|
|||||||
name?: string;
|
name?: string;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {number}
|
* @type {FoodSupermarketCategory}
|
||||||
* @memberof ShoppingListRecipe
|
* @memberof ShoppingListEntry
|
||||||
*/
|
*/
|
||||||
recipe?: number | null;
|
unit?: FoodSupermarketCategory | null;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof ShoppingListEntry
|
||||||
|
*/
|
||||||
|
ingredient?: number | null;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ShoppingListEntry
|
||||||
|
*/
|
||||||
|
ingredient_note?: string;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {number}
|
* @type {number}
|
||||||
@ -2252,7 +2202,31 @@ export interface ShoppingListRecipe {
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
* @memberof ShoppingListRecipe
|
* @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}
|
* @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
|
* @memberof ShoppingListRecipeMealplan
|
||||||
*/
|
*/
|
||||||
mealplan?: number | null;
|
mealplan?: number | null;
|
||||||
@ -2309,12 +2338,6 @@ export interface ShoppingListRecipes {
|
|||||||
* @memberof ShoppingListRecipes
|
* @memberof ShoppingListRecipes
|
||||||
*/
|
*/
|
||||||
id?: number;
|
id?: number;
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof ShoppingListRecipes
|
|
||||||
*/
|
|
||||||
name?: string;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {number}
|
* @type {number}
|
||||||
@ -2327,6 +2350,12 @@ export interface ShoppingListRecipes {
|
|||||||
* @memberof ShoppingListRecipes
|
* @memberof ShoppingListRecipes
|
||||||
*/
|
*/
|
||||||
mealplan?: number | null;
|
mealplan?: number | null;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ShoppingListRecipes
|
||||||
|
*/
|
||||||
|
recipe_name?: string;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@ -2530,6 +2559,147 @@ export enum StepTypeEnum {
|
|||||||
Recipe = 'RECIPE'
|
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
|
* @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 {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.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @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/`;
|
const localVarPath = `/api/shopping-list-entry/`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
@ -5256,16 +5425,12 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
|
|||||||
const localVarHeaderParameter = {} as any;
|
const localVarHeaderParameter = {} as any;
|
||||||
const localVarQueryParameter = {} as any;
|
const localVarQueryParameter = {} as any;
|
||||||
|
|
||||||
if (id !== undefined) {
|
|
||||||
localVarQueryParameter['id'] = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checked !== undefined) {
|
if (checked !== undefined) {
|
||||||
localVarQueryParameter['checked'] = checked;
|
localVarQueryParameter['checked'] = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supermarket !== undefined) {
|
if (id !== undefined) {
|
||||||
localVarQueryParameter['supermarket'] = supermarket;
|
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 {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.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async listShoppingListEntrys(id?: number, checked?: string, supermarket?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ShoppingListEntry>>> {
|
async listShoppingListEntrys(checked?: string, id?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ShoppingListEntry>>> {
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.listShoppingListEntrys(id, checked, supermarket, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.listShoppingListEntrys(checked, id, options);
|
||||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
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 {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.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
listShoppingListEntrys(id?: number, checked?: string, supermarket?: number, options?: any): AxiosPromise<Array<ShoppingListEntry>> {
|
listShoppingListEntrys(checked?: string, id?: number, options?: any): AxiosPromise<Array<ShoppingListEntry>> {
|
||||||
return localVarFp.listShoppingListEntrys(id, checked, supermarket, options).then((request) => request(axios, basePath));
|
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 {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.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
* @memberof ApiApi
|
* @memberof ApiApi
|
||||||
*/
|
*/
|
||||||
public listShoppingListEntrys(id?: number, checked?: string, supermarket?: number, options?: any) {
|
public listShoppingListEntrys(checked?: string, id?: number, options?: any) {
|
||||||
return ApiApiFp(this.configuration).listShoppingListEntrys(id, checked, supermarket, options).then((request) => request(this.axios, this.basePath));
|
return ApiApiFp(this.configuration).listShoppingListEntrys(checked, id, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user