diff --git a/.env.template b/.env.template index 0a56eec60..8a9ccc480 100644 --- a/.env.template +++ b/.env.template @@ -151,3 +151,7 @@ REVERSE_PROXY_AUTH=0 # Enables exporting PDF (see export docs) # Disabled by default, uncomment to enable # ENABLE_PDF_EXPORT=1 + +# Recipe exports are cached for a certain time by default, adjust time if needed +# EXPORT_FILE_CACHE_DURATION=600 + diff --git a/cookbook/integration/default.py b/cookbook/integration/default.py index 39c0bc666..951a5312c 100644 --- a/cookbook/integration/default.py +++ b/cookbook/integration/default.py @@ -32,11 +32,12 @@ class Default(Integration): return None def get_file_from_recipe(self, recipe): + export = RecipeExportSerializer(recipe).data return 'recipe.json', JSONRenderer().render(export).decode("utf-8") - def get_files_from_recipes(self, recipes, cookie): + def get_files_from_recipes(self, recipes, el, cookie): export_zip_stream = BytesIO() export_zip_obj = ZipFile(export_zip_stream, 'w') @@ -50,13 +51,20 @@ class Default(Integration): recipe_stream.write(data) recipe_zip_obj.writestr(filename, recipe_stream.getvalue()) recipe_stream.close() + try: recipe_zip_obj.writestr(f'image{get_filetype(r.image.file.name)}', r.image.file.read()) except ValueError: pass recipe_zip_obj.close() + export_zip_obj.writestr(str(r.pk) + '.zip', recipe_zip_stream.getvalue()) + + el.exported_recipes += 1 + el.msg += self.get_recipe_processed_msg(r) + el.save() + export_zip_obj.close() - return [[ 'export.zip', export_zip_stream.getvalue() ]] \ No newline at end of file + return [[ self.get_export_file_name(), export_zip_stream.getvalue() ]] \ No newline at end of file diff --git a/cookbook/integration/integration.py b/cookbook/integration/integration.py index 6fee602c6..48899d366 100644 --- a/cookbook/integration/integration.py +++ b/cookbook/integration/integration.py @@ -1,9 +1,12 @@ +import time import datetime import json import traceback import uuid from io import BytesIO, StringIO from zipfile import BadZipFile, ZipFile +from django.core.cache import cache +import datetime from bs4 import Tag from django.core.exceptions import ObjectDoesNotExist @@ -18,6 +21,7 @@ from cookbook.forms import ImportExportBase from cookbook.helper.image_processing import get_filetype, handle_image from cookbook.models import Keyword, Recipe from recipes.settings import DEBUG +from recipes.settings import EXPORT_FILE_CACHE_DURATION class Integration: @@ -61,35 +65,44 @@ class Integration: space=request.space ) - def do_export(self, recipes): - """ - Perform the export based on a list of recipes - :param recipes: list of recipe objects - :return: HttpResponse with the file of the requested export format that is directly downloaded (When that format involve multiple files they are zipped together) - """ - files = self.get_files_from_recipes(recipes, self.request.COOKIES) - if len(files) == 1: - filename, file = files[0] - export_filename = filename - export_file = file + def do_export(self, recipes, el): - else: - export_filename = "export.zip" - export_stream = BytesIO() - export_obj = ZipFile(export_stream, 'w') + with scope(space=self.request.space): + el.total_recipes = len(recipes) + el.cache_duration = EXPORT_FILE_CACHE_DURATION + el.save() - for filename, file in files: - export_obj.writestr(filename, file) + files = self.get_files_from_recipes(recipes, el, self.request.COOKIES) - export_obj.close() - export_file = export_stream.getvalue() + if len(files) == 1: + filename, file = files[0] + export_filename = filename + export_file = file + + else: + #zip the files if there is more then one file + export_filename = self.get_export_file_name() + export_stream = BytesIO() + export_obj = ZipFile(export_stream, 'w') + + for filename, file in files: + export_obj.writestr(filename, file) + + export_obj.close() + export_file = export_stream.getvalue() + + + cache.set('export_file_'+str(el.pk), {'filename': export_filename, 'file': export_file}, EXPORT_FILE_CACHE_DURATION) + el.running = False + el.save() response = HttpResponse(export_file, content_type='application/force-download') response['Content-Disposition'] = 'attachment; filename="' + export_filename + '"' return response + def import_file_name_filter(self, zip_info_object): """ Since zipfile.namelist() returns all files in all subdirectories this function allows filtering of files @@ -126,7 +139,7 @@ class Integration: for d in data_list: recipe = self.get_recipe_from_file(d) recipe.keywords.add(self.keyword) - il.msg += f'{recipe.pk} - {recipe.name} \n' + il.msg += self.get_recipe_processed_msg(recipe) self.handle_duplicates(recipe, import_duplicates) il.imported_recipes += 1 il.save() @@ -151,7 +164,7 @@ class Integration: else: recipe = self.get_recipe_from_file(BytesIO(import_zip.read(z.filename))) recipe.keywords.add(self.keyword) - il.msg += f'{recipe.pk} - {recipe.name} \n' + il.msg += self.get_recipe_processed_msg(recipe) self.handle_duplicates(recipe, import_duplicates) il.imported_recipes += 1 il.save() @@ -166,7 +179,7 @@ class Integration: try: recipe = self.get_recipe_from_file(d) recipe.keywords.add(self.keyword) - il.msg += f'{recipe.pk} - {recipe.name} \n' + il.msg += self.get_recipe_processed_msg(recipe) self.handle_duplicates(recipe, import_duplicates) il.imported_recipes += 1 il.save() @@ -183,7 +196,7 @@ class Integration: try: recipe = self.get_recipe_from_file(d) recipe.keywords.add(self.keyword) - il.msg += f'{recipe.pk} - {recipe.name} \n' + il.msg += self.get_recipe_processed_msg(recipe) self.handle_duplicates(recipe, import_duplicates) il.imported_recipes += 1 il.save() @@ -193,7 +206,7 @@ class Integration: else: recipe = self.get_recipe_from_file(f['file']) recipe.keywords.add(self.keyword) - il.msg += f'{recipe.pk} - {recipe.name} \n' + il.msg += self.get_recipe_processed_msg(recipe) self.handle_duplicates(recipe, import_duplicates) except BadZipFile: il.msg += 'ERROR ' + _( @@ -260,7 +273,7 @@ class Integration: """ raise NotImplementedError('Method not implemented in integration') - def get_files_from_recipes(self, recipes, cookie): + def get_files_from_recipes(self, recipes, el, cookie): """ Takes a list of recipe object and converts it to a array containing each file. Each file is represented as an array [filename, data] where data is a string of the content of the file. @@ -279,3 +292,10 @@ class Integration: log.msg += exception.msg if DEBUG: traceback.print_exc() + + + def get_export_file_name(self, format='zip'): + return "export_{}.{}".format(datetime.datetime.now().strftime("%Y-%m-%d"), format) + + def get_recipe_processed_msg(self, recipe): + return f'{recipe.pk} - {recipe.name} \n' diff --git a/cookbook/integration/pdfexport.py b/cookbook/integration/pdfexport.py index b982f24d1..fca782473 100644 --- a/cookbook/integration/pdfexport.py +++ b/cookbook/integration/pdfexport.py @@ -11,22 +11,25 @@ from cookbook.helper.image_processing import get_filetype from cookbook.integration.integration import Integration from cookbook.serializer import RecipeExportSerializer -import django.core.management.commands.runserver as runserver +from cookbook.models import ExportLog +from asgiref.sync import sync_to_async +import django.core.management.commands.runserver as runserver +import logging class PDFexport(Integration): def get_recipe_from_file(self, file): raise NotImplementedError('Method not implemented in storage integration') - async def get_files_from_recipes_async(self, recipes, cookie): + async def get_files_from_recipes_async(self, recipes, el, cookie): cmd = runserver.Command() browser = await launch( handleSIGINT=False, handleSIGTERM=False, handleSIGHUP=False, - ignoreHTTPSErrors=True + ignoreHTTPSErrors=True, ) cookies = {'domain': cmd.default_addr, 'name': 'sessionid', 'value': cookie['sessionid'], } @@ -39,17 +42,28 @@ class PDFexport(Integration): } } - page = await browser.newPage() - await page.emulateMedia('print') - await page.setCookie(cookies) files = [] for recipe in recipes: - await page.goto('http://' + cmd.default_addr + ':' + cmd.default_port + '/view/recipe/' + str(recipe.id), {'waitUntil': 'networkidle0', }) + + page = await browser.newPage() + await page.emulateMedia('print') + await page.setCookie(cookies) + + await page.goto('http://'+cmd.default_addr+':'+cmd.default_port+'/view/recipe/'+str(recipe.id), {'waitUntil': 'domcontentloaded'}) + await page.waitForSelector('#printReady'); + files.append([recipe.name + '.pdf', await page.pdf(options)]) + await page.close(); + + el.exported_recipes += 1 + el.msg += self.get_recipe_processed_msg(recipe) + await sync_to_async(el.save, thread_sensitive=True)() + await browser.close() return files - def get_files_from_recipes(self, recipes, cookie): - return asyncio.run(self.get_files_from_recipes_async(recipes, cookie)) + + def get_files_from_recipes(self, recipes, el, cookie): + return asyncio.run(self.get_files_from_recipes_async(recipes, el, cookie)) diff --git a/cookbook/integration/recipesage.py b/cookbook/integration/recipesage.py index 0ca32194d..0bc6704be 100644 --- a/cookbook/integration/recipesage.py +++ b/cookbook/integration/recipesage.py @@ -88,12 +88,16 @@ class RecipeSage(Integration): return data - def get_files_from_recipes(self, recipes, cookie): + def get_files_from_recipes(self, recipes, el, cookie): json_list = [] for r in recipes: json_list.append(self.get_file_from_recipe(r)) - return [['export.json', json.dumps(json_list)]] + el.exported_recipes += 1 + el.msg += self.get_recipe_processed_msg(r) + el.save() + + return [[self.get_export_file_name('json'), json.dumps(json_list)]] def split_recipe_file(self, file): return json.loads(file.read().decode("utf-8")) diff --git a/cookbook/integration/saffron.py b/cookbook/integration/saffron.py index 16a93a0ce..058f2a8f7 100644 --- a/cookbook/integration/saffron.py +++ b/cookbook/integration/saffron.py @@ -87,10 +87,14 @@ class Saffron(Integration): return recipe.name+'.txt', data - def get_files_from_recipes(self, recipes, cookie): + def get_files_from_recipes(self, recipes, el, cookie): files = [] for r in recipes: filename, data = self.get_file_from_recipe(r) files.append([ filename, data ]) + el.exported_recipes += 1 + el.msg += self.get_recipe_processed_msg(r) + el.save() + return files \ No newline at end of file diff --git a/cookbook/locale/de/LC_MESSAGES/django.mo b/cookbook/locale/de/LC_MESSAGES/django.mo index 77c8a4f36..215472569 100644 Binary files a/cookbook/locale/de/LC_MESSAGES/django.mo and b/cookbook/locale/de/LC_MESSAGES/django.mo differ diff --git a/cookbook/locale/de/LC_MESSAGES/django.po b/cookbook/locale/de/LC_MESSAGES/django.po index 8df1fccde..92205ee14 100644 --- a/cookbook/locale/de/LC_MESSAGES/django.po +++ b/cookbook/locale/de/LC_MESSAGES/django.po @@ -15,8 +15,8 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-01-18 14:52+0100\n" -"PO-Revision-Date: 2022-02-02 15:31+0000\n" -"Last-Translator: Sven \n" +"PO-Revision-Date: 2022-02-06 21:31+0000\n" +"Last-Translator: David Laukamp \n" "Language-Team: German \n" "Language: de\n" @@ -415,6 +415,7 @@ msgstr "" #: .\cookbook\forms.py:501 msgid "Days of recent shopping list entries to display." msgstr "" +"Tage der letzten Einträge in der Einkaufsliste, die angezeigt werden sollen." #: .\cookbook\forms.py:502 msgid "Mark food 'On Hand' when checked off shopping list." @@ -478,11 +479,12 @@ msgstr "Automatisch als vorrätig markieren" #: .\cookbook\forms.py:528 msgid "Reset Food Inheritance" -msgstr "" +msgstr "Lebensmittelvererbung zurücksetzen" #: .\cookbook\forms.py:529 msgid "Reset all food to inherit the fields configured." msgstr "" +"Alle Lebensmittel zurücksetzen, um die konfigurierten Felder zu übernehmen." #: .\cookbook\forms.py:541 msgid "Fields on food that should be inherited by default." diff --git a/cookbook/locale/fr/LC_MESSAGES/django.mo b/cookbook/locale/fr/LC_MESSAGES/django.mo index d2accc62a..81ba37263 100644 Binary files a/cookbook/locale/fr/LC_MESSAGES/django.mo and b/cookbook/locale/fr/LC_MESSAGES/django.mo differ diff --git a/cookbook/locale/fr/LC_MESSAGES/django.po b/cookbook/locale/fr/LC_MESSAGES/django.po index 42bc4c54d..5ca60a34e 100644 --- a/cookbook/locale/fr/LC_MESSAGES/django.po +++ b/cookbook/locale/fr/LC_MESSAGES/django.po @@ -14,16 +14,16 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-01-18 14:52+0100\n" -"PO-Revision-Date: 2022-01-16 07:06+0000\n" -"Last-Translator: Josselin du PLESSIS \n" -"Language-Team: French \n" +"PO-Revision-Date: 2022-02-06 21:31+0000\n" +"Last-Translator: Marion Kämpfer \n" +"Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.8\n" +"X-Generator: Weblate 4.10.1\n" #: .\cookbook\filters.py:23 .\cookbook\templates\forms\ingredients.html:34 #: .\cookbook\templates\space.html:50 .\cookbook\templates\stats.html:28 @@ -123,10 +123,8 @@ msgstr "" "nouvellement créés seront partagés par défaut." #: .\cookbook\forms.py:80 -#, fuzzy -#| msgid "Try the new shopping list" msgid "Users with whom to share shopping lists." -msgstr "Essayer la nouvelle liste de courses" +msgstr "Utilisateurs avec lesquels partager des listes de courses." #: .\cookbook\forms.py:82 msgid "Show recently viewed recipes on search page." @@ -419,6 +417,8 @@ msgstr "" #: .\cookbook\forms.py:500 msgid "Filter shopping list to only include supermarket categories." msgstr "" +"Filtrer la liste de courses pour n’inclure que des catégories de " +"supermarchés." #: .\cookbook\forms.py:501 msgid "Days of recent shopping list entries to display." @@ -430,17 +430,15 @@ msgstr "" #: .\cookbook\forms.py:503 msgid "Delimiter to use for CSV exports." -msgstr "" +msgstr "Caractère de séparation à utiliser pour les exportations CSV." #: .\cookbook\forms.py:504 msgid "Prefix to add when copying list to the clipboard." -msgstr "" +msgstr "Préfixe à utiliser pour copier la liste dans le presse-papiers." #: .\cookbook\forms.py:508 -#, fuzzy -#| msgid "New Shopping List" msgid "Share Shopping List" -msgstr "Nouvelle liste de courses" +msgstr "Partager la liste de courses" #: .\cookbook\forms.py:509 msgid "Autosync" @@ -448,7 +446,7 @@ msgstr "" #: .\cookbook\forms.py:510 msgid "Auto Add Meal Plan" -msgstr "" +msgstr "Ajouter le menu de la semaine automatiquement" #: .\cookbook\forms.py:511 msgid "Exclude On Hand" @@ -474,7 +472,7 @@ msgstr "" #: .\cookbook\forms.py:516 msgid "CSV Delimiter" -msgstr "" +msgstr "Caractère de séparation CSV" #: .\cookbook\forms.py:517 .\cookbook\templates\shopping_list.html:322 msgid "List Prefix" @@ -742,7 +740,7 @@ msgstr "Alias de mot-clé" #: .\cookbook\serializer.py:175 msgid "A user is required" -msgstr "" +msgstr "Un utilisateur est requis" #: .\cookbook\serializer.py:195 msgid "File uploads are not enabled for this Space." @@ -754,7 +752,7 @@ msgstr "Vous avez atteint votre limite de téléversement de fichiers." #: .\cookbook\serializer.py:962 msgid "Existing shopping list to update" -msgstr "" +msgstr "Liste de courses existante à mettre à jour" #: .\cookbook\serializer.py:964 msgid "" diff --git a/cookbook/locale/sl/LC_MESSAGES/django.mo b/cookbook/locale/sl/LC_MESSAGES/django.mo index b88198305..cc60fc1ad 100644 Binary files a/cookbook/locale/sl/LC_MESSAGES/django.mo and b/cookbook/locale/sl/LC_MESSAGES/django.mo differ diff --git a/cookbook/migrations/0169_exportlog.py b/cookbook/migrations/0169_exportlog.py new file mode 100644 index 000000000..0fa6c20eb --- /dev/null +++ b/cookbook/migrations/0169_exportlog.py @@ -0,0 +1,34 @@ +# Generated by Django 3.2.11 on 2022-02-03 15:03 + +import cookbook.models +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('cookbook', '0168_add_unit_searchfields'), + ] + + operations = [ + migrations.CreateModel( + name='ExportLog', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('type', models.CharField(max_length=32)), + ('running', models.BooleanField(default=True)), + ('msg', models.TextField(default='')), + ('total_recipes', models.IntegerField(default=0)), + ('exported_recipes', models.IntegerField(default=0)), + ('cache_duration', models.IntegerField(default=0)), + ('possibly_not_expired', models.BooleanField(default=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.space')), + ], + bases=(models.Model, cookbook.models.PermissionModelMixin), + ), + ] diff --git a/cookbook/migrations/0170_alter_ingredient_unit.py b/cookbook/migrations/0170_alter_ingredient_unit.py deleted file mode 100644 index b426ad120..000000000 --- a/cookbook/migrations/0170_alter_ingredient_unit.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.2.11 on 2022-02-02 19:36 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('cookbook', '0169_auto_20220121_1427'), - ] - - operations = [ - migrations.AlterField( - model_name='ingredient', - name='unit', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='cookbook.unit'), - ), - ] diff --git a/cookbook/migrations/0169_auto_20220121_1427.py b/cookbook/migrations/0170_auto_20220207_1848.py similarity index 61% rename from cookbook/migrations/0169_auto_20220121_1427.py rename to cookbook/migrations/0170_auto_20220207_1848.py index 728db6890..f6985dc38 100644 --- a/cookbook/migrations/0169_auto_20220121_1427.py +++ b/cookbook/migrations/0170_auto_20220207_1848.py @@ -1,20 +1,44 @@ -# Generated by Django 3.2.11 on 2022-01-21 20:27 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models +# Generated by Django 3.2.11 on 2022-02-07 17:48 import cookbook.models +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('cookbook', '0168_add_unit_searchfields'), + ('cookbook', '0169_exportlog'), ] operations = [ + migrations.AddField( + model_name='food', + name='child_inherit_fields', + field=models.ManyToManyField(blank=True, related_name='child_inherit', to='cookbook.FoodInheritField'), + ), + migrations.AddField( + model_name='food', + name='substitute', + field=models.ManyToManyField(blank=True, related_name='_cookbook_food_substitute_+', to='cookbook.Food'), + ), + migrations.AddField( + model_name='food', + name='substitute_children', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='food', + name='substitute_siblings', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='ingredient', + name='unit', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cookbook.unit'), + ), migrations.CreateModel( name='CustomFilter', fields=[ @@ -29,13 +53,13 @@ class Migration(migrations.Migration): ], bases=(models.Model, cookbook.models.PermissionModelMixin), ), - migrations.AddConstraint( - model_name='customfilter', - constraint=models.UniqueConstraint(fields=('space', 'name'), name='cf_unique_name_per_space'), - ), migrations.AddField( model_name='recipebook', name='filter', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cookbook.customfilter'), ), + migrations.AddConstraint( + model_name='customfilter', + constraint=models.UniqueConstraint(fields=('space', 'name'), name='cf_unique_name_per_space'), + ), ] diff --git a/cookbook/migrations/0171_auto_20220202_1340.py b/cookbook/migrations/0171_auto_20220202_1340.py deleted file mode 100644 index ceb4ec80c..000000000 --- a/cookbook/migrations/0171_auto_20220202_1340.py +++ /dev/null @@ -1,34 +0,0 @@ -# Generated by Django 3.2.11 on 2022-02-02 19:40 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('cookbook', '0170_alter_ingredient_unit'), - ] - - operations = [ - migrations.AddField( - model_name='food', - name='substitute', - field=models.ManyToManyField(blank=True, related_name='_cookbook_food_substitute_+', to='cookbook.Food'), - ), - migrations.AddField( - model_name='food', - name='substitute_children', - field=models.BooleanField(default=False), - ), - migrations.AddField( - model_name='food', - name='substitute_siblings', - field=models.BooleanField(default=False), - ), - migrations.AlterField( - model_name='ingredient', - name='unit', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cookbook.unit'), - ), - ] diff --git a/cookbook/migrations/0172_food_child_inherit_fields.py b/cookbook/migrations/0172_food_child_inherit_fields.py deleted file mode 100644 index 70098b2b3..000000000 --- a/cookbook/migrations/0172_food_child_inherit_fields.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.11 on 2022-02-04 17:11 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('cookbook', '0171_auto_20220202_1340'), - ] - - operations = [ - migrations.AddField( - model_name='food', - name='child_inherit_fields', - field=models.ManyToManyField(blank=True, related_name='child_inherit', to='cookbook.FoodInheritField'), - ), - ] diff --git a/cookbook/models.py b/cookbook/models.py index 35d4f6d62..91d51cd38 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -1028,6 +1028,25 @@ class ImportLog(models.Model, PermissionModelMixin): def __str__(self): return f"{self.created_at}:{self.type}" +class ExportLog(models.Model, PermissionModelMixin): + type = models.CharField(max_length=32) + running = models.BooleanField(default=True) + msg = models.TextField(default="") + + total_recipes = models.IntegerField(default=0) + exported_recipes = models.IntegerField(default=0) + cache_duration = models.IntegerField(default=0) + possibly_not_expired = models.BooleanField(default=True) + + created_at = models.DateTimeField(auto_now_add=True) + created_by = models.ForeignKey(User, on_delete=models.CASCADE) + + objects = ScopedManager(space='space') + space = models.ForeignKey(Space, on_delete=models.CASCADE) + + def __str__(self): + return f"{self.created_at}:{self.type}" + class BookmarkletImport(ExportModelOperationsMixin('bookmarklet_import'), models.Model, PermissionModelMixin): html = models.TextField() diff --git a/cookbook/serializer.py b/cookbook/serializer.py index cd553741c..a0484e394 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -1,17 +1,14 @@ -import random from datetime import timedelta -from decimal import Decimal + from gettext import gettext as _ from django.contrib.auth.models import User -from django.db.models import Avg, Q, QuerySet, Sum, Value -from django.db.models.functions import Substr +from django.db.models import Avg, Q, QuerySet, Sum from django.urls import reverse from django.utils import timezone from drf_writable_nested import UniqueFieldsMixin, WritableNestedModelSerializer from rest_framework import serializers from rest_framework.exceptions import NotFound, ValidationError -from rest_framework.fields import empty from cookbook.helper.HelperFunctions import str2bool from cookbook.helper.shopping_helper import RecipeShoppingEditor @@ -21,7 +18,7 @@ from cookbook.models import (Automation, BookmarkletImport, Comment, CookLog, Cu RecipeImport, ShareLink, ShoppingList, ShoppingListEntry, ShoppingListRecipe, Step, Storage, Supermarket, SupermarketCategory, SupermarketCategoryRelation, Sync, SyncLog, Unit, UserFile, - UserPreference, ViewLog) + UserPreference, ViewLog, ExportLog) from cookbook.templatetags.custom_tags import markdown from recipes.settings import MEDIA_URL @@ -92,7 +89,10 @@ class CustomOnHandField(serializers.Field): if request := self.context.get('request', None): shared_users = getattr(request, '_shared_users', None) if shared_users is None: - shared_users = [x.id for x in list(self.context['request'].user.get_shopping_share())] + [self.context['request'].user.id] + try: + shared_users = [x.id for x in list(self.context['request'].user.get_shopping_share())] + [self.context['request'].user.id] + except AttributeError: # Anonymous users (using share links) don't have shared users + shared_users = [] return obj.onhand_users.filter(id__in=shared_users).exists() def to_internal_value(self, data): @@ -405,7 +405,7 @@ class FoodSerializer(UniqueFieldsMixin, WritableNestedModelSerializer, ExtendedR shared_users = [x.id for x in list(self.context['request'].user.get_shopping_share())] + [self.context['request'].user.id] filter = Q(id__in=obj.substitute.all()) if obj.substitute_siblings: - filter |= Q(path__startswith=obj.path[:Food.steplen*(obj.depth-1)], depth=obj.depth) + filter |= Q(path__startswith=obj.path[:Food.steplen * (obj.depth - 1)], depth=obj.depth) if obj.substitute_children: filter |= Q(path__startswith=obj.path, depth__gt=obj.depth) return Food.objects.filter(filter).filter(onhand_users__id__in=shared_users).exists() @@ -644,7 +644,7 @@ class CustomFilterSerializer(SpacedModelSerializer, WritableNestedModelSerialize class Meta: model = CustomFilter - fields = ('id', 'name', 'search', 'shared', 'created_by') + fields = ('id', 'name', 'search', 'shared', 'created_by') read_only_fields = ('created_by',) @@ -659,7 +659,7 @@ class RecipeBookSerializer(SpacedModelSerializer, WritableNestedModelSerializer) class Meta: model = RecipeBook fields = ('id', 'name', 'description', 'icon', 'shared', 'created_by', 'filter') - read_only_fields = ('created_by', ) + read_only_fields = ('created_by',) class RecipeBookEntrySerializer(serializers.ModelSerializer): @@ -731,11 +731,11 @@ class ShoppingListRecipeSerializer(serializers.ModelSerializer): 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})' + 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): # TODO remove once old shopping list @@ -895,6 +895,19 @@ class ImportLogSerializer(serializers.ModelSerializer): read_only_fields = ('created_by',) +class ExportLogSerializer(serializers.ModelSerializer): + + def create(self, validated_data): + validated_data['created_by'] = self.context['request'].user + validated_data['space'] = self.context['request'].space + return super().create(validated_data) + + class Meta: + model = ExportLog + fields = ('id', 'type', 'msg', 'running', 'total_recipes', 'exported_recipes', 'cache_duration', 'possibly_not_expired', 'created_by', 'created_at') + read_only_fields = ('created_by',) + + class AutomationSerializer(serializers.ModelSerializer): def create(self, validated_data): diff --git a/cookbook/static/css/app.min.css b/cookbook/static/css/app.min.css index 7c680a783..a100e2c28 100644 --- a/cookbook/static/css/app.min.css +++ b/cookbook/static/css/app.min.css @@ -1140,3 +1140,10 @@ min-width: 28rem; } } + +@media print{ + #switcher{ + display: none; + } + +} \ No newline at end of file diff --git a/cookbook/templates/export.html b/cookbook/templates/export.html index 4133da939..787fc81c0 100644 --- a/cookbook/templates/export.html +++ b/cookbook/templates/export.html @@ -1,25 +1,33 @@ {% extends "base.html" %} -{% load crispy_forms_filters %} -{% load i18n %} +{% load render_bundle from webpack_loader %} {% load static %} +{% load i18n %} +{% load l10n %} + {% block title %}{% trans 'Export Recipes' %}{% endblock %} -{% block extra_head %} - {{ form.media }} + +{% block content %} +
+ +
+{% endblock %} + + +{% block script %} + {% if debug %} + + {% else %} + + {% endif %} + + + + {% render_bundle 'export_view' %} {% endblock %} -{% block content %} -

{% trans 'Export' %}

-
-
-
- {% csrf_token %} - {{ form|crispy }} - -
-
-
-{% endblock %} \ No newline at end of file diff --git a/cookbook/templates/export_response.html b/cookbook/templates/export_response.html new file mode 100644 index 000000000..1f438632a --- /dev/null +++ b/cookbook/templates/export_response.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} +{% load render_bundle from webpack_loader %} +{% load static %} +{% load i18n %} +{% load l10n %} + +{% block title %}{% trans 'Export' %}{% endblock %} + +{% block content %} + +
+ +
+ + +{% endblock %} + + +{% block script %} + {% if debug %} + + {% else %} + + {% endif %} + + + + {% render_bundle 'export_response_view' %} +{% endblock %} \ No newline at end of file diff --git a/cookbook/templates/recipe_view.html b/cookbook/templates/recipe_view.html index 70ec627e8..1a55fde18 100644 --- a/cookbook/templates/recipe_view.html +++ b/cookbook/templates/recipe_view.html @@ -26,7 +26,7 @@ {{ c.updated_at }} {% trans 'by' %} {{ c.created_by.username }}
- {{ c.text }} + {{ c.text | urlize |linebreaks }}
diff --git a/cookbook/templates/settings.html b/cookbook/templates/settings.html index 2d9d15834..ef2d78433 100644 --- a/cookbook/templates/settings.html +++ b/cookbook/templates/settings.html @@ -217,13 +217,13 @@ {% endblock %} diff --git a/cookbook/tests/api/test_api_recipe.py b/cookbook/tests/api/test_api_recipe.py index 21c621c32..2ff97669e 100644 --- a/cookbook/tests/api/test_api_recipe.py +++ b/cookbook/tests/api/test_api_recipe.py @@ -4,7 +4,7 @@ import pytest from django.urls import reverse from django_scopes import scopes_disabled -from cookbook.models import Recipe +from cookbook.models import Recipe, ShareLink from cookbook.tests.conftest import get_random_json_recipe, validate_recipe LIST_URL = 'api:recipe-list' @@ -38,6 +38,21 @@ def test_list_space(recipe_1_s1, u1_s1, u1_s2, space_2): assert len(json.loads(u1_s2.get(reverse(LIST_URL)).content)['results']) == 1 +def test_share_permission(recipe_1_s1, u1_s1, u1_s2, a_u): + assert u1_s1.get(reverse(DETAIL_URL, args=[recipe_1_s1.pk])).status_code == 200 + assert u1_s2.get(reverse(DETAIL_URL, args=[recipe_1_s1.pk])).status_code == 404 + + with scopes_disabled(): + r = u1_s1.get(reverse('new_share_link', kwargs={'pk': recipe_1_s1.pk})) + assert r.status_code == 302 + r = u1_s2.get(reverse('new_share_link', kwargs={'pk': recipe_1_s1.pk})) + assert r.status_code == 404 + share = ShareLink.objects.filter(recipe=recipe_1_s1).first() + assert a_u.get(reverse(DETAIL_URL, args=[recipe_1_s1.pk]) + f'?share={share.uuid}').status_code == 200 + assert u1_s1.get(reverse(DETAIL_URL, args=[recipe_1_s1.pk]) + f'?share={share.uuid}').status_code == 200 + assert u1_s2.get(reverse(DETAIL_URL, args=[recipe_1_s1.pk]) + f'?share={share.uuid}').status_code == 404 # TODO fix in https://github.com/TandoorRecipes/recipes/issues/1238 + + @pytest.mark.parametrize("arg", [ ['a_u', 403], ['g1_s1', 200], diff --git a/cookbook/tests/other/test_export.py b/cookbook/tests/other/test_export.py new file mode 100644 index 000000000..995c0cce6 --- /dev/null +++ b/cookbook/tests/other/test_export.py @@ -0,0 +1,25 @@ +import pytest +from django.contrib import auth +from django.urls import reverse + +from cookbook.forms import ImportExportBase +from cookbook.helper.ingredient_parser import IngredientParser +from cookbook.models import ExportLog + + +@pytest.fixture +def obj_1(space_1, u1_s1): + return ExportLog.objects.create(type=ImportExportBase.DEFAULT, running=False, created_by=auth.get_user(u1_s1), space=space_1, exported_recipes=10, total_recipes=10) + + +@pytest.mark.parametrize("arg", [ + ['a_u', 302], + ['g1_s1', 302], + ['u1_s1', 200], + ['a1_s1', 200], + ['u1_s2', 404], + ['a1_s2', 404], +]) +def test_export_file_cache(arg, request, obj_1): + c = request.getfixturevalue(arg[0]) + assert c.get(reverse('view_export_file', args=[obj_1.pk])).status_code == arg[1] diff --git a/cookbook/tests/views/test_views_general.py b/cookbook/tests/views/test_views_general.py index fd282edb8..ab1be6742 100644 --- a/cookbook/tests/views/test_views_general.py +++ b/cookbook/tests/views/test_views_general.py @@ -81,7 +81,7 @@ def test_history(arg, request, ext_recipe_1_s1): ['a_u', 302], ['g1_s1', 302], ['u1_s1', 302], - ['a1_s1', 200], + ['a1_s1', 302], ]) def test_system(arg, request, ext_recipe_1_s1): c = request.getfixturevalue(arg[0]) diff --git a/cookbook/urls.py b/cookbook/urls.py index e69c2e5b5..7e47ee5ee 100644 --- a/cookbook/urls.py +++ b/cookbook/urls.py @@ -23,6 +23,7 @@ router.register(r'custom-filter', api.CustomFilterViewSet) router.register(r'food', api.FoodViewSet) router.register(r'food-inherit-field', api.FoodInheritFieldViewSet) router.register(r'import-log', api.ImportLogViewSet) +router.register(r'export-log', api.ExportLogViewSet) router.register(r'ingredient', api.IngredientViewSet) router.register(r'keyword', api.KeywordViewSet) router.register(r'meal-plan', api.MealPlanViewSet) @@ -76,6 +77,8 @@ urlpatterns = [ path('import/', import_export.import_recipe, name='view_import'), path('import-response//', import_export.import_response, name='view_import_response'), path('export/', import_export.export_recipe, name='view_export'), + path('export-response//', import_export.export_response, name='view_export_response'), + path('export-file//', import_export.export_file, name='view_export_file'), path('view/recipe/', views.recipe_view, name='view_recipe'), path('view/recipe//', views.recipe_view, name='view_recipe'), diff --git a/cookbook/views/api.py b/cookbook/views/api.py index 6c5bea19b..81fc0d14e 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -48,11 +48,13 @@ from cookbook.models import (Automation, BookmarkletImport, CookLog, CustomFilte ShoppingListEntry, ShoppingListRecipe, Step, Storage, Supermarket, SupermarketCategory, SupermarketCategoryRelation, Sync, SyncLog, Unit, UserFile, UserPreference, ViewLog) +from cookbook.models import (ExportLog) from cookbook.provider.dropbox import Dropbox from cookbook.provider.local import Local from cookbook.provider.nextcloud import Nextcloud from cookbook.schemas import FilterSchema, QueryParam, QueryParamAutoSchema, TreeSchema from cookbook.serializer import (AutomationSerializer, BookmarkletImportSerializer, + ExportLogSerializer, CookLogSerializer, CustomFilterSerializer, FoodInheritFieldSerializer, FoodSerializer, FoodShoppingUpdateSerializer, ImportLogSerializer, @@ -660,11 +662,13 @@ class RecipeViewSet(viewsets.ModelViewSet): schema = QueryParamAutoSchema() def get_queryset(self): + share = self.request.query_params.get('share', None) + if self.detail: - self.queryset = self.queryset.filter(space=self.request.space) + if not share: + self.queryset = self.queryset.filter(space=self.request.space) return super().get_queryset() - share = self.request.query_params.get('share', None) if not (share and self.detail): self.queryset = self.queryset.filter(space=self.request.space) @@ -872,6 +876,17 @@ class ImportLogViewSet(viewsets.ModelViewSet): return self.queryset.filter(space=self.request.space) +class ExportLogViewSet(viewsets.ModelViewSet): + queryset = ExportLog.objects + serializer_class = ExportLogSerializer + permission_classes = [CustomIsUser] + pagination_class = DefaultPagination + + def get_queryset(self): + return self.queryset.filter(space=self.request.space) + + + class BookmarkletImportViewSet(viewsets.ModelViewSet): queryset = BookmarkletImport.objects serializer_class = BookmarkletImportSerializer diff --git a/cookbook/views/import_export.py b/cookbook/views/import_export.py index 9fd810c17..1974c18da 100644 --- a/cookbook/views/import_export.py +++ b/cookbook/views/import_export.py @@ -1,10 +1,11 @@ import re import threading from io import BytesIO +from django.core.cache import cache from django.contrib import messages -from django.http import HttpResponseRedirect, JsonResponse -from django.shortcuts import render +from django.http import HttpResponse, HttpResponseRedirect, JsonResponse +from django.shortcuts import render, get_object_or_404 from django.urls import reverse from django.utils.translation import gettext as _ @@ -29,7 +30,7 @@ from cookbook.integration.recipesage import RecipeSage from cookbook.integration.rezkonv import RezKonv from cookbook.integration.saffron import Saffron from cookbook.integration.pdfexport import PDFexport -from cookbook.models import Recipe, ImportLog, UserPreference +from cookbook.models import Recipe, ImportLog, ExportLog, UserPreference from recipes import settings @@ -123,25 +124,57 @@ def export_recipe(request): if form.cleaned_data['all']: recipes = Recipe.objects.filter(space=request.space, internal=True).all() - if form.cleaned_data['type'] == ImportExportBase.PDF and not settings.ENABLE_PDF_EXPORT: - messages.add_message(request, messages.ERROR, _('The PDF Exporter is not enabled on this instance as it is still in an experimental state.')) - return render(request, 'export.html', {'form': form}) integration = get_integration(request, form.cleaned_data['type']) - return integration.do_export(recipes) - except NotImplementedError: - messages.add_message(request, messages.ERROR, _('Exporting is not implemented for this provider')) + if form.cleaned_data['type'] == ImportExportBase.PDF and not settings.ENABLE_PDF_EXPORT: + return JsonResponse({'error': _('The PDF Exporter is not enabled on this instance as it is still in an experimental state.')}) + + el = ExportLog.objects.create(type=form.cleaned_data['type'], created_by=request.user, space=request.space) + + t = threading.Thread(target=integration.do_export, args=[recipes, el]) + t.setDaemon(True) + t.start() + + return JsonResponse({'export_id': el.pk}) + except NotImplementedError: + return JsonResponse( + { + 'error': True, + 'msg': _('Importing is not implemented for this provider') + }, + status=400 + ) else: - form = ExportForm(space=request.space) + pk = '' recipe = request.GET.get('r') if recipe: if re.match(r'^([0-9])+$', recipe): - if recipe := Recipe.objects.filter(pk=int(recipe), space=request.space).first(): - form = ExportForm(initial={'recipes': recipe}, space=request.space) + pk = Recipe.objects.filter(pk=int(recipe), space=request.space).first().pk - return render(request, 'export.html', {'form': form}) + return render(request, 'export.html', {'pk': pk}) @group_required('user') def import_response(request, pk): return render(request, 'import_response.html', {'pk': pk}) + + +@group_required('user') +def export_response(request, pk): + return render(request, 'export_response.html', {'pk': pk}) + + +@group_required('user') +def export_file(request, pk): + el = get_object_or_404(ExportLog, pk=pk, space=request.space) + + cacheData = cache.get(f'export_file_{el.pk}') + + if cacheData is None: + el.possibly_not_expired = False + el.save() + return render(request, 'export_response.html', {'pk': pk}) + + response = HttpResponse(cacheData['file'], content_type='application/force-download') + response['Content-Disposition'] = 'attachment; filename="' + cacheData['filename'] + '"' + return response diff --git a/cookbook/views/views.py b/cookbook/views/views.py index ad69bbdf8..9aa54560a 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -446,6 +446,9 @@ def history(request): @group_required('admin') def system(request): + if not request.user.is_superuser: + return HttpResponseRedirect(reverse('index')) + postgres = False if ( settings.DATABASES['default']['ENGINE'] == 'django.db.backends.postgresql_psycopg2' # noqa: E501 or settings.DATABASES['default']['ENGINE'] == 'django.db.backends.postgresql' # noqa: E501 diff --git a/docs/faq.md b/docs/faq.md index b09ff43c2..731ed1c90 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -10,6 +10,9 @@ Tandoor can be installed as a progressive web app (PWA) on mobile and desktop de #### Safari (iPhone/iPad) Open Tandoor, click Safari's share button, select `Add to Home Screen` +### Chrome/Chromium +Open Tandoor, click the `add Tandoor to the home screen` message that pops up at the bottom of the screen + ### Desktop browsers #### Google Chrome @@ -82,4 +85,4 @@ To create a superuser you need to 1. execute into the container using `docker-compose exec web_recipes sh` 2. activate the virtual environment `source venv/bin/activate` -3. run `python manage.py createsuperuser` and follow the steps shown. \ No newline at end of file +3. run `python manage.py createsuperuser` and follow the steps shown. diff --git a/docs/features/import_export.md b/docs/features/import_export.md index d551ccedd..98424158d 100644 --- a/docs/features/import_export.md +++ b/docs/features/import_export.md @@ -21,26 +21,26 @@ if your favorite one is missing. Overview of the capabilities of the different integrations. | Integration | Import | Export | Images | -|--------------------| ------ | ------ | ------ | -| Default | ✔️ | ✔️ | ✔️ | -| Nextcloud | ✔️ | ⌚ | ✔️ | -| Mealie | ✔️ | ⌚ | ✔️ | -| Chowdown | ✔️ | ⌚ | ✔️ | -| Safron | ✔️ | ✔ | ❌ | -| Paprika | ✔️ | ⌚ | ✔️ | -| ChefTap | ✔️ | ❌ | ❌ | -| Pepperplate | ✔️ | ⌚ | ❌ | -| RecipeSage | ✔️ | ✔️ | ✔️ | -| Domestica | ✔️ | ⌚ | ✔️ | -| MealMaster | ✔️ | ❌ | ❌ | -| RezKonv | ✔️ | ❌ | ❌ | -| OpenEats | ✔️ | ❌ | ⌚ | -| Plantoeat | ✔️ | ❌ | ✔ | -| CookBookApp | ✔️ | ⌚ | ✔️ | -| CopyMeThat | ✔️ | ❌ | ✔️ | -| PDF (experimental) | ⌚️ | ✔ | ✔️ | +|--------------------| ------ | -- | ------ | +| Default | ✔️ | ✔️ | ✔️ | +| Nextcloud | ✔️ | ⌚ | ✔️ | +| Mealie | ✔️ | ⌚ | ✔️ | +| Chowdown | ✔️ | ⌚ | ✔️ | +| Safron | ✔️ | ✔️ | ❌ | +| Paprika | ✔️ | ⌚ | ✔️ | +| ChefTap | ✔️ | ❌ | ❌ | +| Pepperplate | ✔️ | ⌚ | ❌ | +| RecipeSage | ✔️ | ✔️ | ✔️ | +| Domestica | ✔️ | ⌚ | ✔️ | +| MealMaster | ✔️ | ❌ | ❌ | +| RezKonv | ✔️ | ❌ | ❌ | +| OpenEats | ✔️ | ❌ | ⌚ | +| Plantoeat | ✔️ | ❌ | ✔ | +| CookBookApp | ✔️ | ⌚ | ✔️ | +| CopyMeThat | ✔️ | ❌ | ✔️ | +| PDF (experimental) | ⌚️ | ✔️ | ✔️ | -✔ = implemented, ❌ = not implemented and not possible/planned, ⌚ = not yet implemented +✔️ = implemented, ❌ = not implemented and not possible/planned, ⌚ = not yet implemented ## Default The default integration is the built in (and preferred) way to import and export recipes. diff --git a/docs/install/docker/ipv6_plain/docker-compose.yml b/docs/install/docker/ipv6_plain/docker-compose.yml new file mode 100644 index 000000000..a65c54f72 --- /dev/null +++ b/docs/install/docker/ipv6_plain/docker-compose.yml @@ -0,0 +1,62 @@ +version: "2.4" +services: + db_recipes: + restart: always + image: postgres:11-alpine + volumes: + - ${POSTGRES_DATA_DIR:-./postgresql}:/var/lib/postgresql/data + env_file: + - ./.env + healthcheck: + test: ["CMD-SHELL", "psql -U $$POSTGRES_USER -d $$POSTGRES_DB --list || exit 1"] + interval: 4s + timeout: 1s + retries: 12 + networks: + tandoor: + ipv6_address: ${IPV6_PREFIX:?NO_IPV6_PREFIX}::2 + web_recipes: + image: vabene1111/recipes + restart: always + env_file: + - ./.env + volumes: + - staticfiles:/opt/recipes/staticfiles + - nginx_config:/opt/recipes/nginx/conf.d + - ${MEDIA_FILES_DIR:-./mediafiles}:/opt/recipes/mediafiles + depends_on: + db_recipes: + condition: service_healthy + networks: + tandoor: + ipv6_address: ${IPV6_PREFIX:?NO_IPV6_PREFIX}::3 + + nginx_recipes: + image: nginx:mainline-alpine + restart: always + ports: + - 80:80 + env_file: + - ./.env + depends_on: + - web_recipes + volumes: + - nginx_config:/etc/nginx/conf.d:ro + - staticfiles:/static + - ${MEDIA_FILES_DIR:-./mediafiles}:/media + networks: + tandoor: + ipv6_address: ${IPV6_PREFIX:?NO_IPV6_PREFIX}::4 +volumes: + nginx_config: + staticfiles: + +networks: + tandoor: + enable_ipv6: true + name: ${NETWORK_NAME:-tandoor} + driver: bridge + ipam: + driver: default + config: + - subnet: ${IPV6_PREFIX:?NO_IPV6_PREFIX}::/${IPV6_PREFIX_LENGTH:?NO_IPV6_PREFIX_LENGTH} \ No newline at end of file diff --git a/recipes/settings.py b/recipes/settings.py index c9ffd32c3..3ea147a16 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -138,6 +138,7 @@ ENABLE_SIGNUP = bool(int(os.getenv('ENABLE_SIGNUP', False))) ENABLE_METRICS = bool(int(os.getenv('ENABLE_METRICS', False))) ENABLE_PDF_EXPORT = bool(int(os.getenv('ENABLE_PDF_EXPORT', False))) +EXPORT_FILE_CACHE_DURATION = int(os.getenv('EXPORT_FILE_CACHE_DURATION', 600)) MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', @@ -427,3 +428,4 @@ EMAIL_USE_TLS = bool(int(os.getenv('EMAIL_USE_TLS', False))) EMAIL_USE_SSL = bool(int(os.getenv('EMAIL_USE_SSL', False))) DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'webmaster@localhost') ACCOUNT_EMAIL_SUBJECT_PREFIX = os.getenv('ACCOUNT_EMAIL_SUBJECT_PREFIX', '[Tandoor Recipes] ') # allauth sender prefix + diff --git a/vue/src/apps/ExportResponseView/ExportResponseView.vue b/vue/src/apps/ExportResponseView/ExportResponseView.vue new file mode 100644 index 000000000..913f4366d --- /dev/null +++ b/vue/src/apps/ExportResponseView/ExportResponseView.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/vue/src/apps/ExportResponseView/main.js b/vue/src/apps/ExportResponseView/main.js new file mode 100644 index 000000000..220ac3be4 --- /dev/null +++ b/vue/src/apps/ExportResponseView/main.js @@ -0,0 +1,18 @@ +import Vue from 'vue' +import App from './ExportResponseView.vue' +import i18n from '@/i18n' + +Vue.config.productionTip = false + +// TODO move this and other default stuff to centralized JS file (verify nothing breaks) +let publicPath = localStorage.STATIC_URL + 'vue/' +if (process.env.NODE_ENV === 'development') { + publicPath = 'http://localhost:8080/' +} +export default __webpack_public_path__ = publicPath // eslint-disable-line + + +new Vue({ + i18n, + render: h => h(App), +}).$mount('#app') diff --git a/vue/src/apps/ExportView/ExportView.vue b/vue/src/apps/ExportView/ExportView.vue new file mode 100644 index 000000000..ca55b7206 --- /dev/null +++ b/vue/src/apps/ExportView/ExportView.vue @@ -0,0 +1,174 @@ + + + + + + + diff --git a/vue/src/apps/ExportView/main.js b/vue/src/apps/ExportView/main.js new file mode 100644 index 000000000..8c8af8e52 --- /dev/null +++ b/vue/src/apps/ExportView/main.js @@ -0,0 +1,18 @@ +import Vue from 'vue' +import App from './ExportView.vue' +import i18n from '@/i18n' + +Vue.config.productionTip = false + +// TODO move this and other default stuff to centralized JS file (verify nothing breaks) +let publicPath = localStorage.STATIC_URL + 'vue/' +if (process.env.NODE_ENV === 'development') { + publicPath = 'http://localhost:8080/' +} +export default __webpack_public_path__ = publicPath // eslint-disable-line + + +new Vue({ + i18n, + render: h => h(App), +}).$mount('#app') diff --git a/vue/src/apps/RecipeEditView/RecipeEditView.vue b/vue/src/apps/RecipeEditView/RecipeEditView.vue index 72378251d..4521f1b67 100644 --- a/vue/src/apps/RecipeEditView/RecipeEditView.vue +++ b/vue/src/apps/RecipeEditView/RecipeEditView.vue @@ -736,8 +736,8 @@ export default { } this.recipe.servings = Math.floor(this.recipe.servings) // temporary fix until a proper framework for frontend input validation is established - if (this.recipe.servings === "" || isNaN(this.recipe.servings)) { - this.recipe.servings = 0 + if (this.recipe.servings === "" || isNaN(this.recipe.servings) || this.recipe.servings===0 ) { + this.recipe.servings = 1 } apiFactory @@ -791,7 +791,7 @@ export default { let empty_step = { instruction: "", ingredients: [], - show_as_header: true, + show_as_header: false, time_visible: false, ingredients_visible: true, instruction_visible: true, diff --git a/vue/src/apps/RecipeView/RecipeView.vue b/vue/src/apps/RecipeView/RecipeView.vue index 49f152406..e36294fae 100644 --- a/vue/src/apps/RecipeView/RecipeView.vue +++ b/vue/src/apps/RecipeView/RecipeView.vue @@ -100,7 +100,7 @@
- +
@@ -208,6 +208,7 @@ export default { servings_cache: {}, start_time: "", share_uid: window.SHARE_UID, + wake_lock: null, } }, watch: { @@ -218,8 +219,37 @@ export default { mounted() { this.loadRecipe(window.RECIPE_ID) this.$i18n.locale = window.CUSTOM_LOCALE + this.requestWakeLock() + }, + beforeUnmount() { + this.destroyWakeLock() }, methods: { + requestWakeLock: async function() { + if ('wakeLock' in navigator) { + try { + this.wake_lock = await navigator.wakeLock.request('screen') + document.addEventListener('visibilitychange', this.visibilityChange) + } catch (err) { + console.log(err) + } + } + }, + destroyWakeLock: function() { + if (this.wake_lock != null) { + this.wake_lock.release() + .then(() => { + this.wake_lock = null + }); + } + + document.removeEventListener('visibilitychange', this.visibilityChange) + }, + visibilityChange: async function() { + if (this.wake_lock != null && document.visibilityState === 'visible') { + await this.requestWakeLock() + } + }, loadRecipe: function (recipe_id) { apiLoadRecipe(recipe_id).then((recipe) => { if (window.USER_SERVINGS !== 0) { @@ -241,6 +271,9 @@ export default { this.start_time = moment().format("yyyy-MM-DDTHH:mm") } + + if(recipe.image === null) this.printReady() + this.recipe = this.rootrecipe = recipe this.servings = this.servings_cache[this.rootrecipe.id] = recipe.servings this.loading = false @@ -267,6 +300,14 @@ export default { this.servings = this.servings_cache?.[e.id] ?? e.servings } }, + printReady: function(){ + const template = document.createElement("template"); + template.id = "printReady"; + document.body.appendChild(template); + }, + onImgLoad: function(){ + this.printReady() + }, }, } diff --git a/vue/src/components/IngredientsCard.vue b/vue/src/components/IngredientsCard.vue index 1decf3ee6..229e554ff 100644 --- a/vue/src/components/IngredientsCard.vue +++ b/vue/src/components/IngredientsCard.vue @@ -131,6 +131,7 @@ export default { let ingredient_list = this.steps .map((x) => x.ingredients) .flat() + .filter((x) => (x.food !== null && x.food !== undefined)) .map((x) => x.food.id) let params = { @@ -230,7 +231,7 @@ export default { ...i, shop: checked, shopping_status: shopping_status, // possible values: true, false, null - category: i.food.supermarket_category?.name, + category: i.food?.supermarket_category?.name, shopping_list: shopping.map((x) => { return { mealplan: x?.recipe_mealplan?.name, diff --git a/vue/src/locales/de.json b/vue/src/locales/de.json index 058848769..80787e9e0 100644 --- a/vue/src/locales/de.json +++ b/vue/src/locales/de.json @@ -1,19 +1,19 @@ { "Import": "Importieren", "import_running": "Import läuft, bitte warten!", - "Import_finished": "Import fertig", + "Import_finished": "Import abgeschlossen", "View_Recipes": "Rezepte Ansehen", "Information": "Information", "all_fields_optional": "Alle Felder sind optional und können leer gelassen werden.", - "convert_internal": "Zu internem Rezept wandeln", + "convert_internal": "Zu internem Rezept umwandeln", "Log_Recipe_Cooking": "Kochen protokollieren", - "External_Recipe_Image": "Externes Rezept Bild", + "External_Recipe_Image": "Externes Rezeptbild", "Add_to_Book": "Zu Buch hinzufügen", "Add_to_Shopping": "Zu Einkaufsliste hinzufügen", - "Add_to_Plan": "Zu Plan hinzufügen", + "Add_to_Plan": "Zur Planung hinzufügen", "Step_start_time": "Schritt Startzeit", - "Select_Book": "Buch wählen", - "Recipe_Image": "Rezept Bild", + "Select_Book": "Buch auswählen", + "Recipe_Image": "Rezeptbild", "Log_Cooking": "Kochen protokollieren", "Proteins": "Proteine", "Fats": "Fette", @@ -61,63 +61,63 @@ "success_fetching_resource": "Ressource erfolgreich abgerufen!", "Download": "Herunterladen", "Success": "Erfolgreich", - "err_fetching_resource": "Ein Fehler trat während dem Abrufen einer Ressource auf!", - "err_creating_resource": "Ein Fehler trat während dem Erstellen einer Ressource auf!", - "err_updating_resource": "Ein Fehler trat während dem Aktualisieren einer Ressource auf!", + "err_fetching_resource": "Beim Abrufen einer Ressource ist ein Fehler aufgetreten!", + "err_creating_resource": "Beim Erstellen einer Ressource ist ein Fehler aufgetreten!", + "err_updating_resource": "Beim Aktualisieren einer Ressource ist ein Fehler aufgetreten!", "success_creating_resource": "Ressource erfolgreich erstellt!", "success_updating_resource": "Ressource erfolgreich aktualisiert!", "File": "Datei", "Delete": "Löschen", - "err_deleting_resource": "Ein Fehler trat während dem Löschen einer Ressource auf!", + "err_deleting_resource": "Beim Löschen einer Ressource ist ein Fehler aufgetreten!", "Cancel": "Abbrechen", "success_deleting_resource": "Ressource erfolgreich gelöscht!", - "Load_More": "Mehr laden", + "Load_More": "Weitere laden", "Ok": "Öffnen", "Link": "Link", "Key_Ctrl": "Strg", - "move_title": "Verschieben {type}", - "Food": "Essen", + "move_title": "{type} verschieben", + "Food": "Lebensmittel", "Recipe_Book": "Kochbuch", - "delete_title": "Löschen {type}", - "create_title": "Neu {type}", - "edit_title": "Bearbeiten {type}", + "delete_title": "Lösche {type}", + "create_title": "{type} erstellen", + "edit_title": "{type} bearbeiten", "Name": "Name", "Empty": "Leer", "Key_Shift": "Umschalttaste", "Text": "Text", "Icon": "Icon", "Automation": "Automatisierung", - "Ignore_Shopping": "Einkauf Ignorieren", + "Ignore_Shopping": "Einkauf ignorieren", "Parameter": "Parameter", - "Sort_by_new": "Sortieren nach neueste", - "Shopping_Category": "Einkauf Kategorie", - "Edit_Food": "Essen bearbeiten", - "Move_Food": "Essen verschieben", - "New_Food": "Neues Essen", - "Hide_Food": "Essen verbergen", - "Food_Alias": "Essen Alias", + "Sort_by_new": "Nach Neueste sortieren", + "Shopping_Category": "Einkaufskategorie", + "Edit_Food": "Lebensmittel bearbeiten", + "Move_Food": "Lebensmittel verschieben", + "New_Food": "Neues Lebensmittel", + "Hide_Food": "Lebensmittel verbergen", + "Food_Alias": "Lebensmittel Alias", "Unit_Alias": "Einheit Alias", "Keyword_Alias": "Schlagwort Alias", - "Delete_Food": "Essen löschen", - "No_ID": "Nr. nicht gefunden, Objekt kann nicht gelöscht werden", + "Delete_Food": "Lebensmittel löschen", + "No_ID": "ID nicht gefunden und kann nicht gelöscht werden.", "create_rule": "und erstelle Automatisierung", "Table_of_Contents": "Inhaltsverzeichnis", - "merge_title": "Zusammenführen {type}", - "del_confirmation_tree": "Sicher das {source} und alle untergeordneten Objekte gelöscht werden soll?", - "warning_feature_beta": "Diese Funktion ist aktuell in einer BETA (Test) Phase. Fehler sind zu erwarten und Änderungen in der Zukunft können die Funktionsweise möglicherweise Verändern oder Daten die mit dieser Funktion zusammen hängen entfernen.", + "merge_title": "{type} zusammenführen", + "del_confirmation_tree": "Sicher, dass {source} und alle untergeordneten Objekte gelöscht werden sollen?", + "warning_feature_beta": "Diese Funktion ist aktuell in einer BETA (Test) Phase. Es ist sowohl mit Fehlern, als auch mit zukünftigen Änderungen der Funktionsweise zu rechnen, wodurch es bei Verwendung entsprechender Funktionen zu Datenverlust kommen kann.", "Edit_Keyword": "Schlagwort bearbeiten", "Move_Keyword": "Schlagwort verschieben", "Merge_Keyword": "Schlagworte zusammenführen", - "Hide_Keywords": "Schlagworte verstecken", - "Meal_Plan_Days": "Zukünftige Pläne", + "Hide_Keywords": "Schlagwort verstecken", + "Meal_Plan_Days": "Zukünftige Essenspläne", "Description": "Beschreibung", - "Create_New_Shopping Category": "Erstelle neue Einkaufs Kategorie", + "Create_New_Shopping Category": "Neue Einkaufskategorie erstellen", "Automate": "Automatisieren", "Type": "Typ", "and_up": "& Hoch", "Unrated": "Unbewertet", "Shopping_list": "Einkaufsliste", - "step_time_minutes": "Schritt Zeit in Minuten", + "step_time_minutes": "Schritt Dauer in Minuten", "Save_and_View": "Speichern & Ansehen", "Edit_Recipe": "Rezept bearbeiten", "Hide_Recipes": "Rezepte verstecken", @@ -128,7 +128,7 @@ "Copy_template_reference": "Template Referenz kopieren", "Step_Type": "Schritt Typ", "Make_Header": "In Überschrift wandeln", - "Make_Ingredient": "In Zutat wandeln", + "Make_Ingredient": "In Zutat umwandeln", "Enable_Amount": "Menge aktivieren", "Disable_Amount": "Menge deaktivieren", "Add_Step": "Schritt hinzufügen", @@ -152,9 +152,9 @@ "Unit": "Einheit", "No_Results": "Keine Ergebnisse", "New_Unit": "Neue Einheit", - "Create_New_Food": "Neues Essen", - "Create_New_Keyword": "Neues Schlagwort", - "Create_New_Unit": "Neue Einheit", + "Create_New_Food": "Neues Lebensmittel hinzufügen", + "Create_New_Keyword": "Neues Schlagwort hinzufügen", + "Create_New_Unit": "Neue Einheit hinzufügen", "Instructions": "Anleitung", "Time": "Zeit", "New_Keyword": "Neues Schlagwort", @@ -169,7 +169,7 @@ "Week": "Woche", "Month": "Monat", "Year": "Jahr", - "Drag_Here_To_Delete": "Ziehen zum Löschen", + "Drag_Here_To_Delete": "Hierher ziehen zum Löschen", "Select_File": "Datei auswählen", "Image": "Bild", "Planner": "Planer", @@ -180,7 +180,7 @@ "Meal_Type_Required": "Mahlzeitentyp ist erforderlich", "Remove_nutrition_recipe": "Nährwerte aus Rezept löschen", "Add_nutrition_recipe": "Nährwerte zu Rezept hinzufügen", - "Title_or_Recipe_Required": "Titel oder Rezept benötigt", + "Title_or_Recipe_Required": "Auswahl von Titel oder Rezept erforderlich", "Next_Day": "Tag vor", "Previous_Day": "Tag zurück", "Edit_Meal_Plan_Entry": "Eintrag bearbeiten", @@ -189,19 +189,19 @@ "Color": "Farbe", "New_Meal_Type": "Neue Mahlzeit", "Periods": "Zeiträume", - "Plan_Show_How_Many_Periods": "Wie viele Zeiträume angezeigt werden", + "Plan_Show_How_Many_Periods": "Anzahl der anzuzeigenden Zeiträume", "Starting_Day": "Wochenbeginn am", "Meal_Type": "Mahlzeit", "Meal_Types": "Mahlzeiten", "Export_As_ICal": "Aktuellen Zeitraum im iCal Format exportieren", "Week_Numbers": "Kalenderwochen", - "Show_Week_Numbers": "Kalenderwochen anzeigen ?", + "Show_Week_Numbers": "Kalenderwochen anzeigen?", "Added_To_Shopping_List": "Zur Einkaufsliste hinzugefügt", "Export_To_ICal": "Export als .ics", "Cannot_Add_Notes_To_Shopping": "Notizen können nicht auf die Einkaufsliste gesetzt werden", - "Shopping_List_Empty": "Deine Einkaufsliste ist aktuell leer, Einträge können via dem Kontextmenü hinzugefügt werden (Rechtsklick auf einen Eintrag oder Klick auf das Menü-Icon)", - "Next_Period": "Zeitraum vor", - "Previous_Period": "Zeitraum zurück", + "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)", + "Next_Period": "nächster Zeitraum", + "Previous_Period": "voriger Zeitraum", "Current_Period": "Aktueller Zeitraum", "New_Cookbook": "Neues Kochbuch", "Coming_Soon": "Bald verfügbar", @@ -212,7 +212,7 @@ "IgnoreThis": "{food} nicht automatisch zur Einkaufsliste hinzufügen", "shopping_auto_sync": "Automatische Synchronisierung", "shopping_share_desc": "Benutzer sehen all Einträge, die du zur Einkaufsliste hinzufügst. Sie müssen dich hinzufügen, damit du Ihre Einträge sehen kannst.", - "IgnoredFood": "{food} beim nächsten Einkauf ignorieren.", + "IgnoredFood": "{food} nicht für Einkauf geplant.", "Add_Servings_to_Shopping": "{servings} Portionen zum Einkauf hinzufügen", "Inherit": "Vererben", "InheritFields": "Feldwerte vererben", @@ -228,23 +228,23 @@ "mealplan_autoexclude_onhand": "Ignoriere vorhandene Zutaten", "mealplan_autoinclude_related": "Füge verwandte Rezepte hinzu", "default_delay": "Standard Zeit des Verzögerns", - "Added_by": "Hinzugefügt von", + "Added_by": "Hinzugefügt durch", "AddToShopping": "Zur Einkaufsliste hinzufügen", "FoodOnHand": "Sie haben {food} vorrätig.", - "DeleteShoppingConfirm": "Möchten Sie wirklich alle {food} von der Einkaufsliste zu entfernen?", - "err_moving_resource": "Während des Verschiebens einer Resource ist ein Fehler aufgetreten!", - "err_merging_resource": "Beim Zusammenführen einer Ressource ist ein Fehler aufgetreten!", + "DeleteShoppingConfirm": "Möchten Sie wirklich alle {food} von der Einkaufsliste entfernen?", + "err_moving_resource": "Beim Verschieben einer Resource ist ein Fehler aufgetreten!", + "err_merging_resource": "Beim Zusammenführen einer Ressource trat ein Fehler auf!", "success_moving_resource": "Ressource wurde erfolgreich verschoben!", - "success_merging_resource": "Ressource wurde erfolgreich zusammengeführt!", + "success_merging_resource": "Zusammenführung einer Ressource war erfolgreich!", "Shopping_Categories": "Einkaufskategorien", "Added_on": "Hinzugefügt am", - "IngredientInShopping": "Diese Zutat befindet sich in Ihrer Einkaufsliste.", - "NotInShopping": "{food} ist nicht in Ihrer Einkaufsliste.", + "IngredientInShopping": "Diese Zutat befindet sich auf Ihrer Einkaufsliste.", + "NotInShopping": "{food} befindet sich nicht auf Ihrer Einkaufsliste.", "OnHand": "Aktuell vorrätig", - "FoodNotOnHand": "Sie haben kein {food} vorrätig.", - "Undefined": "nicht definiert", - "AddFoodToShopping": "{food} zur Einkaufsliste hinzufügen", - "RemoveFoodFromShopping": "{food} von der Einkaufsliste entfernen", + "FoodNotOnHand": "Sie habe {food} nicht vorrätig.", + "Undefined": "undefiniert", + "AddFoodToShopping": "Fügen Sie {food} zur Einkaufsliste hinzu", + "RemoveFoodFromShopping": "{food} von der Einkaufsliste löschen", "Search Settings": "Sucheinstellungen", "shopping_auto_sync_desc": "Bei 0 wird Auto-Sync deaktiviert. Beim Betrachten einer Einkaufsliste wird die Liste alle gesetzten Sekunden aktualisiert, um mögliche Änderungen anderer zu zeigen. Nützlich, wenn mehrere Personen einkaufen und mobile Daten nutzen.", "MoveCategory": "Verschieben nach: ", @@ -252,7 +252,7 @@ "Pin": "Pin", "mark_complete": "Vollständig markieren", "shopping_add_onhand_desc": "Markiere Lebensmittel als \"Vorrätig\", wenn von der Einkaufsliste abgehakt wurden.", - "left_handed": "Linkshändermodus", + "left_handed": "Linkshänder-Modus", "left_handed_help": "Optimiert die Benutzeroberfläche für die Bedienung mit der linken Hand.", "FoodInherit": "Lebensmittel vererbbare Felder", "SupermarketCategoriesOnly": "Nur Supermarkt Kategorien", @@ -291,5 +291,12 @@ "remember_search": "Suchbegriff merken", "remember_hours": "Stunden zu erinnern", "tree_select": "Baum-Auswahl verwenden", - "CountMore": "...+{count} weitere" + "CountMore": "...+{count} weitere", + "ignore_shopping_help": "Füge Zutat nie zur Einkaufsliste hinzu (z.B. Wasser)", + "OnHand_help": "Lebensmittel ist \"Vorrätig\" und wird nicht automatisch zur Einkaufsliste hinzugefügt.", + "shopping_category_help": "Supermärkte können nach Einkaufskategorien geordnet und gefiltert werden, je nachdem, wie die Gänge angeordnet sind.", + "Foods": "Lebensmittel", + "food_recipe_help": "Wird ein Rezept hier verknüpft, wird diese Verknüpfung in allen anderen Rezepten übernommen, die dieses Lebensmittel beinhaltet", + "review_shopping": "Überprüfe die Einkaufsliste vor dem Speichern", + "view_recipe": "Rezept anschauen" } diff --git a/vue/src/locales/pl.json b/vue/src/locales/pl.json index 9d2b49df3..eb1243d4c 100644 --- a/vue/src/locales/pl.json +++ b/vue/src/locales/pl.json @@ -284,5 +284,18 @@ "related_recipes": "Powiązane przepisy", "today_recipes": "Dzisiejsze przepisy", "Search Settings": "Ustawienia wyszukiwania", - "Pin": "Pin" + "Pin": "Pin", + "left_handed_help": "Zoptymalizuje interfejs użytkownika do użytku lewą ręką.", + "food_recipe_help": "Powiązanie tutaj przepisu będzie skutkowało połączenie przepisu z każdym innym przepisem, który używa tego jedzenia", + "Foods": "Żywność", + "view_recipe": "Zobacz przepis", + "left_handed": "Tryb dla leworęcznych", + "OnHand_help": "Żywność jest w spiżarni i nie zostanie automatycznie dodana do listy zakupów.", + "ignore_shopping_help": "Nigdy nie dodawaj żywności do listy zakupów (np. wody)", + "shopping_category_help": "Z supermarketów można zamawiać i filtrować według kategorii zakupów zgodnie z układem alejek.", + "review_shopping": "Przejrzyj wpisy zakupów przed zapisaniem", + "sql_debug": "Debugowanie SQL", + "remember_search": "Zapamiętaj wyszukiwanie", + "remember_hours": "Godziny do zapamiętania", + "tree_select": "Użyj drzewa wyboru" } diff --git a/vue/src/utils/openapi/api.ts b/vue/src/utils/openapi/api.ts index e041a9108..d0939b099 100644 --- a/vue/src/utils/openapi/api.ts +++ b/vue/src/utils/openapi/api.ts @@ -229,6 +229,73 @@ export interface CustomFilterShared { */ username?: string; } +/** + * + * @export + * @interface ExportLog + */ +export interface ExportLog { + /** + * + * @type {number} + * @memberof ExportLog + */ + id?: number; + /** + * + * @type {string} + * @memberof ExportLog + */ + type: string; + /** + * + * @type {string} + * @memberof ExportLog + */ + msg?: string; + /** + * + * @type {boolean} + * @memberof ExportLog + */ + running?: boolean; + /** + * + * @type {number} + * @memberof ExportLog + */ + total_recipes?: number; + /** + * + * @type {number} + * @memberof ExportLog + */ + exported_recipes?: number; + /** + * + * @type {number} + * @memberof ExportLog + */ + cache_duration?: number; + /** + * + * @type {boolean} + * @memberof ExportLog + */ + possibly_not_expired?: boolean; + /** + * + * @type {string} + * @memberof ExportLog + */ + created_by?: string; + /** + * + * @type {string} + * @memberof ExportLog + */ + created_at?: string; +} /** * * @export @@ -331,6 +398,12 @@ export interface Food { * @memberof Food */ substitute_onhand?: string; + /** + * + * @type {Array} + * @memberof Food + */ + child_inherit_fields?: Array | null; } /** * @@ -776,6 +849,12 @@ export interface IngredientFood { * @memberof IngredientFood */ substitute_onhand?: string; + /** + * + * @type {Array} + * @memberof IngredientFood + */ + child_inherit_fields?: Array | null; } /** * @@ -839,6 +918,37 @@ export interface InlineResponse2001 { */ results?: Array; } +/** + * + * @export + * @interface InlineResponse20010 + */ +export interface InlineResponse20010 { + /** + * + * @type {number} + * @memberof InlineResponse20010 + */ + count?: number; + /** + * + * @type {string} + * @memberof InlineResponse20010 + */ + next?: string | null; + /** + * + * @type {string} + * @memberof InlineResponse20010 + */ + previous?: string | null; + /** + * + * @type {Array} + * @memberof InlineResponse20010 + */ + results?: Array; +} /** * * @export @@ -896,10 +1006,10 @@ export interface InlineResponse2003 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2003 */ - results?: Array; + results?: Array; } /** * @@ -927,10 +1037,10 @@ export interface InlineResponse2004 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2004 */ - results?: Array; + results?: Array; } /** * @@ -958,10 +1068,10 @@ export interface InlineResponse2005 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2005 */ - results?: Array; + results?: Array; } /** * @@ -989,10 +1099,10 @@ export interface InlineResponse2006 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2006 */ - results?: Array; + results?: Array; } /** * @@ -1020,10 +1130,10 @@ export interface InlineResponse2007 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2007 */ - results?: Array; + results?: Array; } /** * @@ -1051,10 +1161,10 @@ export interface InlineResponse2008 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2008 */ - results?: Array; + results?: Array; } /** * @@ -1082,10 +1192,10 @@ export interface InlineResponse2009 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2009 */ - results?: Array; + results?: Array; } /** * @@ -3429,6 +3539,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createExportLog: async (exportLog?: ExportLog, options: any = {}): Promise => { + const localVarPath = `/api/export-log/`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(exportLog, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {Food} [food] @@ -4300,6 +4443,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyExportLog: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('destroyExportLog', 'id', id) + const localVarPath = `/api/export-log/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -5194,6 +5370,45 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listExportLogs: async (page?: number, pageSize?: number, options: any = {}): Promise => { + const localVarPath = `/api/export-log/`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (page !== undefined) { + localVarQueryParameter['page'] = page; + } + + if (pageSize !== undefined) { + localVarQueryParameter['page_size'] = pageSize; + } + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -6551,6 +6766,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateExportLog: async (id: string, exportLog?: ExportLog, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('partialUpdateExportLog', 'id', id) + const localVarPath = `/api/export-log/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(exportLog, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {string} id A unique integer value identifying this food. @@ -7543,6 +7795,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveExportLog: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveExportLog', 'id', id) + const localVarPath = `/api/export-log/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -8599,6 +8884,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateExportLog: async (id: string, exportLog?: ExportLog, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateExportLog', 'id', id) + const localVarPath = `/api/export-log/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(exportLog, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {string} id A unique integer value identifying this food. @@ -9485,6 +9807,16 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.createCustomFilter(customFilter, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createExportLog(exportLog?: ExportLog, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createExportLog(exportLog, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {Food} [food] @@ -9748,6 +10080,16 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.destroyCustomFilter(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async destroyExportLog(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.destroyExportLog(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this food. @@ -10017,6 +10359,17 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.listCustomFilters(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listExportLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listExportLogs(page, pageSize, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {*} [options] Override http request option. @@ -10070,7 +10423,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listKeywords(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listKeywords(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listKeywords(query, root, tree, page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -10141,7 +10494,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listRecipes(query?: string, keywords?: number, keywordsOr?: number, keywordsAnd?: number, keywordsOrNot?: number, keywordsAndNot?: number, foods?: number, foodsOr?: number, foodsAnd?: number, foodsOrNot?: number, foodsAndNot?: number, units?: number, rating?: number, books?: string, booksOr?: number, booksAnd?: number, booksOrNot?: number, booksAndNot?: number, internal?: string, random?: string, _new?: string, timescooked?: number, lastcooked?: string, makenow?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listRecipes(query?: string, keywords?: number, keywordsOr?: number, keywordsAnd?: number, keywordsOrNot?: number, keywordsAndNot?: number, foods?: number, foodsOr?: number, foodsAnd?: number, foodsOrNot?: number, foodsAndNot?: number, units?: number, rating?: number, books?: string, booksOr?: number, booksAnd?: number, booksOrNot?: number, booksAndNot?: number, internal?: string, random?: string, _new?: string, timescooked?: number, lastcooked?: string, makenow?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listRecipes(query, keywords, keywordsOr, keywordsAnd, keywordsOrNot, keywordsAndNot, foods, foodsOr, foodsAnd, foodsOrNot, foodsAndNot, units, rating, books, booksOr, booksAnd, booksOrNot, booksAndNot, internal, random, _new, timescooked, lastcooked, makenow, page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -10184,7 +10537,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listSteps(recipe?: number, query?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listSteps(recipe?: number, query?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listSteps(recipe, query, page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -10204,7 +10557,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listSupermarketCategoryRelations(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listSupermarketCategoryRelations(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listSupermarketCategoryRelations(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -10233,7 +10586,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listSyncLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listSyncLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listSyncLogs(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -10254,7 +10607,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listUnits(query?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listUnits(query?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listUnits(query, page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -10292,7 +10645,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listViewLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listViewLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listViewLogs(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -10400,6 +10753,17 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateCustomFilter(id, customFilter, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async partialUpdateExportLog(id: string, exportLog?: ExportLog, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateExportLog(id, exportLog, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this food. @@ -10695,6 +11059,16 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveCustomFilter(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveExportLog(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveExportLog(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this food. @@ -11011,6 +11385,17 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.updateCustomFilter(id, customFilter, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateExportLog(id: string, exportLog?: ExportLog, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateExportLog(id, exportLog, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this food. @@ -11302,6 +11687,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: createCustomFilter(customFilter?: CustomFilter, options?: any): AxiosPromise { return localVarFp.createCustomFilter(customFilter, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createExportLog(exportLog?: ExportLog, options?: any): AxiosPromise { + return localVarFp.createExportLog(exportLog, options).then((request) => request(axios, basePath)); + }, /** * * @param {Food} [food] @@ -11539,6 +11933,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: destroyCustomFilter(id: string, options?: any): AxiosPromise { return localVarFp.destroyCustomFilter(id, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyExportLog(id: string, options?: any): AxiosPromise { + return localVarFp.destroyExportLog(id, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this food. @@ -11781,6 +12184,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: listCustomFilters(options?: any): AxiosPromise> { return localVarFp.listCustomFilters(options).then((request) => request(axios, basePath)); }, + /** + * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listExportLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { + return localVarFp.listExportLogs(page, pageSize, options).then((request) => request(axios, basePath)); + }, /** * * @param {*} [options] Override http request option. @@ -11830,7 +12243,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listKeywords(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): AxiosPromise { + listKeywords(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listKeywords(query, root, tree, page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -11896,7 +12309,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listRecipes(query?: string, keywords?: number, keywordsOr?: number, keywordsAnd?: number, keywordsOrNot?: number, keywordsAndNot?: number, foods?: number, foodsOr?: number, foodsAnd?: number, foodsOrNot?: number, foodsAndNot?: number, units?: number, rating?: number, books?: string, booksOr?: number, booksAnd?: number, booksOrNot?: number, booksAndNot?: number, internal?: string, random?: string, _new?: string, timescooked?: number, lastcooked?: string, makenow?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { + listRecipes(query?: string, keywords?: number, keywordsOr?: number, keywordsAnd?: number, keywordsOrNot?: number, keywordsAndNot?: number, foods?: number, foodsOr?: number, foodsAnd?: number, foodsOrNot?: number, foodsAndNot?: number, units?: number, rating?: number, books?: string, booksOr?: number, booksAnd?: number, booksOrNot?: number, booksAndNot?: number, internal?: string, random?: string, _new?: string, timescooked?: number, lastcooked?: string, makenow?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listRecipes(query, keywords, keywordsOr, keywordsAnd, keywordsOrNot, keywordsAndNot, foods, foodsOr, foodsAnd, foodsOrNot, foodsAndNot, units, rating, books, booksOr, booksAnd, booksOrNot, booksAndNot, internal, random, _new, timescooked, lastcooked, makenow, page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -11935,7 +12348,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listSteps(recipe?: number, query?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { + listSteps(recipe?: number, query?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listSteps(recipe, query, page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -11953,7 +12366,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listSupermarketCategoryRelations(page?: number, pageSize?: number, options?: any): AxiosPromise { + listSupermarketCategoryRelations(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listSupermarketCategoryRelations(page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -11979,7 +12392,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listSyncLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { + listSyncLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listSyncLogs(page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -11998,7 +12411,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listUnits(query?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { + listUnits(query?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listUnits(query, page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -12032,7 +12445,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listViewLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { + listViewLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listViewLogs(page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -12130,6 +12543,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: partialUpdateCustomFilter(id: string, customFilter?: CustomFilter, options?: any): AxiosPromise { return localVarFp.partialUpdateCustomFilter(id, customFilter, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateExportLog(id: string, exportLog?: ExportLog, options?: any): AxiosPromise { + return localVarFp.partialUpdateExportLog(id, exportLog, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this food. @@ -12398,6 +12821,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: retrieveCustomFilter(id: string, options?: any): AxiosPromise { return localVarFp.retrieveCustomFilter(id, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveExportLog(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveExportLog(id, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this food. @@ -12683,6 +13115,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: updateCustomFilter(id: string, customFilter?: CustomFilter, options?: any): AxiosPromise { return localVarFp.updateCustomFilter(id, customFilter, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateExportLog(id: string, exportLog?: ExportLog, options?: any): AxiosPromise { + return localVarFp.updateExportLog(id, exportLog, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this food. @@ -12960,6 +13402,17 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).createCustomFilter(customFilter, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public createExportLog(exportLog?: ExportLog, options?: any) { + return ApiApiFp(this.configuration).createExportLog(exportLog, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {Food} [food] @@ -13249,6 +13702,17 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).destroyCustomFilter(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public destroyExportLog(id: string, options?: any) { + return ApiApiFp(this.configuration).destroyExportLog(id, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this food. @@ -13545,6 +14009,18 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).listCustomFilters(options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listExportLogs(page?: number, pageSize?: number, options?: any) { + return ApiApiFp(this.configuration).listExportLogs(page, pageSize, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {*} [options] Override http request option. @@ -13962,6 +14438,18 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).partialUpdateCustomFilter(id, customFilter, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public partialUpdateExportLog(id: string, exportLog?: ExportLog, options?: any) { + return ApiApiFp(this.configuration).partialUpdateExportLog(id, exportLog, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this food. @@ -14284,6 +14772,17 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).retrieveCustomFilter(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveExportLog(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveExportLog(id, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this food. @@ -14631,6 +15130,18 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).updateCustomFilter(id, customFilter, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this export log. + * @param {ExportLog} [exportLog] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public updateExportLog(id: string, exportLog?: ExportLog, options?: any) { + return ApiApiFp(this.configuration).updateExportLog(id, exportLog, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this food. diff --git a/vue/vue.config.js b/vue/vue.config.js index 01460e044..a94390ce8 100644 --- a/vue/vue.config.js +++ b/vue/vue.config.js @@ -17,6 +17,14 @@ const pages = { entry: "./src/apps/ImportResponseView/main.js", chunks: ["chunk-vendors"], }, + export_response_view: { + entry: "./src/apps/ExportResponseView/main.js", + chunks: ["chunk-vendors"], + }, + export_view: { + entry: "./src/apps/ExportView/main.js", + chunks: ["chunk-vendors"], + }, supermarket_view: { entry: "./src/apps/SupermarketView/main.js", chunks: ["chunk-vendors"],