From 3c08e3a3f14b0e5d2f44bdb88a02caf3f0a07305 Mon Sep 17 00:00:00 2001 From: Jan-Niklas Weghorn Date: Fri, 10 Nov 2023 13:28:20 +0100 Subject: [PATCH 01/40] Improve import error messages --- .dockerignore | 1 + cookbook/views/api.py | 2 +- vue/src/apps/ImportView/ImportView.vue | 6 ++---- vue/src/locales/en.json | 1 + vue/src/utils/utils.js | 19 ++++++++++++++++--- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index a69161b0..a9319f54 100644 --- a/.dockerignore +++ b/.dockerignore @@ -29,3 +29,4 @@ vue/babel.config* vue/package.json vue/tsconfig.json vue/src/utils/openapi +venv/ diff --git a/cookbook/views/api.py b/cookbook/views/api.py index 159b6f8f..efe0ebcc 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -1454,7 +1454,7 @@ def import_files(request): """ limit, msg = above_space_limit(request.space) if limit: - return Response({'error': msg}, status=status.HTTP_400_BAD_REQUEST) + return Response({'error': True, 'msg': _('File is above space limit')}, status=status.HTTP_400_BAD_REQUEST) form = ImportForm(request.POST, request.FILES) if form.is_valid() and request.FILES != {}: diff --git a/vue/src/apps/ImportView/ImportView.vue b/vue/src/apps/ImportView/ImportView.vue index 12a206f3..b1743944 100644 --- a/vue/src/apps/ImportView/ImportView.vue +++ b/vue/src/apps/ImportView/ImportView.vue @@ -669,8 +669,7 @@ export default { if (url !== '') { this.failed_imports.push(url) } - StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err) - throw "Load Recipe Error" + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_IMPORT, err) }) }, /** @@ -713,8 +712,7 @@ export default { axios.post(resolveDjangoUrl('view_import'), formData, {headers: {'Content-Type': 'multipart/form-data'}}).then((response) => { window.location.href = resolveDjangoUrl('view_import_response', response.data['import_id']) }).catch((err) => { - console.log(err) - StandardToasts.makeStandardToast(this, StandardToasts.FAIL_CREATE) + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_IMPORT, err) }) }, /** diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index 82d48df7..6aad4c3b 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -7,6 +7,7 @@ "err_deleting_protected_resource": "The object you are trying to delete is still used and can't be deleted.", "err_moving_resource": "There was an error moving a resource!", "err_merging_resource": "There was an error merging a resource!", + "err_importing_recipe": "There was an error importing the recipe!", "success_fetching_resource": "Successfully fetched a resource!", "success_creating_resource": "Successfully created a resource!", "success_updating_resource": "Successfully updated a resource!", diff --git a/vue/src/utils/utils.js b/vue/src/utils/utils.js index 8338a6a6..00cc3735 100644 --- a/vue/src/utils/utils.js +++ b/vue/src/utils/utils.js @@ -50,6 +50,7 @@ export class StandardToasts { static FAIL_DELETE_PROTECTED = "FAIL_DELETE_PROTECTED" static FAIL_MOVE = "FAIL_MOVE" static FAIL_MERGE = "FAIL_MERGE" + static FAIL_IMPORT = "FAIL_IMPORT" static makeStandardToast(context, toast, err = undefined, always_show_errors = false) { let title = '' @@ -122,6 +123,11 @@ export class StandardToasts { title = i18n.tc("Failure") msg = i18n.tc("err_merging_resource") break + case StandardToasts.FAIL_IMPORT: + variant = 'danger' + title = i18n.tc("Failure") + msg = i18n.tc("err_importing_recipe") + break } @@ -131,12 +137,19 @@ export class StandardToasts { console.trace(); } - if (err !== undefined && 'response' in err && 'headers' in err.response) { - if (DEBUG && err.response.headers['content-type'] === 'application/json' && err.response.status < 500) { + if (err !== undefined + && 'response' in err + && 'headers' in err.response + && err.response.headers['content-type'] === 'application/json' + && err.response.status < 500 + && err.response.data) { + // If the backend provides us with a nice error message, we print it, regardless of DEBUG mode + if (DEBUG || err.response.data.msg) { + const errMsg = err.response.data.msg ? err.response.data.msg : JSON.stringify(err.response.data) msg = context.$createElement('div', {}, [ context.$createElement('span', {}, [msg]), context.$createElement('br', {}, []), - context.$createElement('code', {'class': 'mt-2'}, [JSON.stringify(err.response.data)]) + context.$createElement('code', {'class': 'mt-2'}, [errMsg]) ]) } } From 6af28e6fe57abdceeb5adb0cdf8e0549507a1bfe Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 11:47:23 -0600 Subject: [PATCH 02/40] alpine uses TZ to set OS timezone, to stay consistent changed TIMEZONE env variable to TZ added deprecated warning to TIMEZONE --- .env.template | 2 +- recipes/settings.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.env.template b/.env.template index c1ba71f7..3556d34c 100644 --- a/.env.template +++ b/.env.template @@ -28,7 +28,7 @@ SECRET_KEY_FILE= # --------------------------------------------------------------- # your default timezone See https://timezonedb.com/time-zones for a list of timezones -TIMEZONE=Europe/Berlin +TZ=Europe/Berlin # add only a database password if you want to run with the default postgres, otherwise change settings accordingly DB_ENGINE=django.db.backends.postgresql diff --git a/recipes/settings.py b/recipes/settings.py index df2c2b1d..42164766 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -450,7 +450,11 @@ for p in PLUGINS: LANGUAGE_CODE = 'en' -TIME_ZONE = os.getenv('TIMEZONE') if os.getenv('TIMEZONE') else 'Europe/Berlin' +if os.getenv('TIMEZONE') is not None: + print('DEPRECATION WARNING: Environment var "TIMEZONE" is deprecated. Please use "TZ" instead.') + TIME_ZONE = bool(int(os.getenv('REVERSE_PROXY_AUTH', False))) +else: + TIME_ZONE = os.getenv('TZ') if os.getenv('TZ') else 'Europe/Berlin' USE_I18N = True From 7f1eecddc4400efa9914b2524fbd6cadc0d1e98e Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 15:45:27 -0600 Subject: [PATCH 03/40] updated documentation for postgres upgrade installing pgbackup container installing with DockSTARTer --- docs/faq.md | 54 ++++++++++++++++++++++------------- docs/install/docker.md | 12 ++++++-- docs/system/backup.md | 24 ++++++++++++++-- docs/system/updating.md | 62 ++++++++++++++++++++++++++++++++++++++--- 4 files changed, 123 insertions(+), 29 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 8a14c6f5..a2480cfe 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -1,5 +1,5 @@ There are several questions and issues that come up from time to time, here are some answers: -please note that the existence of some questions is due the application not being perfect in some parts. +please note that the existence of some questions is due the application not being perfect in some parts. Many of those shortcomings are planned to be fixed in future release but simply could not be addressed yet due to time limits. ## Is there a Tandoor app? @@ -15,7 +15,7 @@ Open Tandoor, click the `add Tandoor to the home screen` message that pops up at ### Desktop browsers -#### Google Chrome +#### Google Chrome Open Tandoor, open the menu behind the three vertical dots at the top right, select `Install Tandoor Recipes...` #### Microsoft Edge @@ -32,6 +32,17 @@ If you just set up your Tandoor instance and you're having issues like; then make sure you have set [all required headers](install/docker.md#required-headers) in your reverse proxy correctly. If that doesn't fix it, you can also refer to the appropriate sub section in the [reverse proxy documentation](install/docker.md#reverse-proxy) and verify your general webserver configuration. +### Required Headers +Navigate to `/system` and review the headers listed in the DEBUG section. At a minimum, if you are using a reverse proxy the headers must match the below conditions. + +| Header | Requirement | +| :--- | ----: | +| HTTP_HOST:mydomain.tld | The host domain must match the url that you are using to open Tandoor. | +| HTTP_X_FORWARDED_HOST:mydomain.tld | The host domain must match the url that you are using to open Tandoor. | +| HTTP_X_FORWARDED_PROTO:http(s) | The protocol must match the url you are using to open Tandoor. There must be exactly one protocol listed. | +| HTTP_X_SCRIPT_NAME:/subfolder | If you are hosting Tandoor at a subfolder instead of a subdomain this header must exist. | + + ## Why am I getting CSRF Errors? If you are getting CSRF Errors this is most likely due to a reverse proxy not passing the correct headers. @@ -41,19 +52,22 @@ If you are using a plain ngix you might need `proxy_set_header Host $http_host;` Further discussions can be found in this [Issue #518](https://github.com/vabene1111/recipes/issues/518) ## Why are images not loading? -If images are not loading this might be related to the same issue as the CSRF errors (see above). +If images are not loading this might be related to the same issue as the CSRF errors (see above). A discussion about that can be found at [Issue #452](https://github.com/vabene1111/recipes/issues/452) -The other common issue is that the recommended nginx container is removed from the deployment stack. -If removed, the nginx webserver needs to be replaced by something else that servers the /mediafiles/ directory or +The other common issue is that the recommended nginx container is removed from the deployment stack. +If removed, the nginx webserver needs to be replaced by something else that servers the /mediafiles/ directory or `GUNICORN_MEDIA` needs to be enabled to allow media serving by the application container itself. +## Why am I getting an error stating database files are incompatible with server? +Your version of Postgres has been upgraded. See [Updating PostgreSQL](https://docs.tandoor.dev/system/updating/#postgresql) + ## Why does the Text/Markdown preview look different than the final recipe? Tandoor has always rendered the recipe instructions markdown on the server. This also allows tandoor to implement things like ingredient templating and scaling in text. -To make editing easier a markdown editor was added to the frontend with integrated preview as a temporary solution. Since the markdown editor uses a different -specification than the server the preview is different to the final result. It is planned to improve this in the future. +To make editing easier a markdown editor was added to the frontend with integrated preview as a temporary solution. Since the markdown editor uses a different +specification than the server the preview is different to the final result. It is planned to improve this in the future. The markdown renderer follows this markdown specification https://daringfireball.net/projects/markdown/ @@ -66,18 +80,18 @@ To create a new user click on your name (top right corner) and select 'space set It is not possible to create users through the admin because users must be assigned a default group and space. -To change a user's space you need to go to the admin and select User Infos. +To change a user's space you need to go to the admin and select User Infos. -If you use an external auth provider or proxy authentication make sure to specify a default group and space in the +If you use an external auth provider or proxy authentication make sure to specify a default group and space in the environment configuration. ## What are spaces? -Spaces are is a type of feature used to separate one installation of Tandoor into several parts. +Spaces are is a type of feature used to separate one installation of Tandoor into several parts. In technical terms it is a multi-tenant system. -You can compare a space to something like google drive or dropbox. +You can compare a space to something like google drive or dropbox. There is only one installation of the Dropbox system, but it handles multiple users without them noticing each other. -For Tandoor that means all people that work together on one recipe collection can be in one space. +For Tandoor that means all people that work together on one recipe collection can be in one space. If you want to host the collection of your friends, family, or neighbor you can create a separate space for them (through the admin interface). Sharing between spaces is currently not possible but is planned for future releases. @@ -90,7 +104,7 @@ To reset a lost password if access to the container is lost you need to: 3. run `python manage.py changepassword ` and follow the steps shown. ## How can I add an admin user? -To create a superuser you need to +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` @@ -98,11 +112,11 @@ To create a superuser you need to ## Why cant I get support for my manual setup? -Even tough I would love to help everyone get tandoor up and running I have only so much time -that I can spend on this project besides work, family and other life things. -Due to the countless problems that can occur when manually installing I simply do not have -the time to help solving each one. +Even tough I would love to help everyone get tandoor up and running I have only so much time +that I can spend on this project besides work, family and other life things. +Due to the countless problems that can occur when manually installing I simply do not have +the time to help solving each one. -You can install Tandoor manually but please do not expect me or anyone to help you with that. -As a general advice: If you do it manually do NOT change anything at first and slowly work yourself -to your dream setup. \ No newline at end of file +You can install Tandoor manually but please do not expect me or anyone to help you with that. +As a general advice: If you do it manually do NOT change anything at first and slowly work yourself +to your dream setup. diff --git a/docs/install/docker.md b/docs/install/docker.md index 244334fb..0a7eaba8 100644 --- a/docs/install/docker.md +++ b/docs/install/docker.md @@ -6,6 +6,12 @@ It is possible to install this application using many different Docker configura Please read the instructions on each example carefully and decide if this is the way for you. +## **DockSTARTer** + +The main goal of [DockSTARTer](https://dockstarter.com/) is to make it quick and easy to get up and running with Docker. +You may choose to rely on DockSTARTer for various changes to your Docker system or use DockSTARTer as a stepping stone and learn to do more advanced configurations. +Follow the guide for installing DockSTARTer and then run `ds` then select 'Configuration' and 'Select Apps' to get Tandoor up and running quickly and easily. + ## **Docker** The docker image (`vabene1111/recipes`) simply exposes the application on the container's port `8080`. @@ -110,7 +116,7 @@ in combination with [jrcs's letsencrypt companion](https://hub.docker.com/r/jrcs Please refer to the appropriate documentation on how to setup the reverse proxy and networks. !!! warning "Adjust client_max_body_size" - By using jwilder's Nginx-proxy, uploads will be restricted to 1 MB file size. This can be resolved by adjusting the ```client_max_body_size``` variable in the jwilder nginx configuration. + By using jwilder's Nginx-proxy, uploads will be restricted to 1 MB file size. This can be resolved by adjusting the ```client_max_body_size``` variable in the jwilder nginx configuration. Remember to add the appropriate environment variables to the `.env` file: @@ -360,11 +366,11 @@ follow these instructions: ### Sub Path nginx config If hosting under a sub-path you might want to change the default nginx config (which gets mounted through the named volume from the application container into the nginx container) -with the following config. +with the following config. ```nginx location /my_app { # change to subfolder name - include /config/nginx/proxy.conf; + include /config/nginx/proxy.conf; proxy_pass https://mywebapp.com/; # change to your host name:port proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/docs/system/backup.md b/docs/system/backup.md index cf5a2854..308e3561 100644 --- a/docs/system/backup.md +++ b/docs/system/backup.md @@ -8,7 +8,7 @@ downloaded and restored through the web interface. When developing a new backup strategy, make sure to also test the restore process! ## Database -Please use any standard way of backing up your database. For most systems this can be achieved by using a dump +Please use any standard way of backing up your database. For most systems this can be achieved by using a dump command that will create an SQL file with all the required data. Please refer to your Database System documentation. @@ -18,7 +18,7 @@ It is **neither** well tested nor documented so use at your own risk. I would recommend using it only as a starting place for your own backup strategy. ## Mediafiles -The only Data this application stores apart from the database are the media files (e.g. images) used in your +The only Data this application stores apart from the database are the media files (e.g. images) used in your recipes. They can be found in the mediafiles mounted directory (depending on your installation). @@ -56,3 +56,23 @@ You can now export recipes from Tandoor using the export function. This method r Import: Go to Import > from app > tandoor and select the zip file you want to import from. +## Backing up using the pgbackup container +You can add [pgbackup](https://hub.docker.com/r/prodrigestivill/postgres-backup-local) to manage the scheduling and automatic backup of your postgres database. +Modify the below to match your environment and add it to your `docker-compose.yml` + +``` yaml + pgbackup: + container_name: pgbackup + environment: + BACKUP_KEEP_DAYS: "8" + BACKUP_KEEP_MONTHS: "6" + BACKUP_KEEP_WEEKS: "4" + POSTGRES_EXTRA_OPTS: -Z6 --schema=public --blobs + SCHEDULE: '@daily' + # Note: the tag must match the version of postgres you are using + image: prodrigestivill/postgres-backup-local:15 + restart: unless-stopped + volumes: + - backups/postgres:/backups +``` +You can manually initiate a backup by running `docker exec -it pgbackup ./backup.sh` diff --git a/docs/system/updating.md b/docs/system/updating.md index 82084864..c3100099 100644 --- a/docs/system/updating.md +++ b/docs/system/updating.md @@ -1,6 +1,6 @@ The Updating process depends on your chosen method of [installation](/install/docker) -While intermediate updates can be skipped when updating please make sure to +While intermediate updates can be skipped when updating please make sure to **read the release notes** in case some special action is required to update. ## Docker @@ -16,7 +16,61 @@ For all setups using Docker the updating process look something like this For all setups using a manual installation updates usually involve downloading the latest source code from GitHub. After that make sure to run: -1. `manage.py collectstatic` -2. `manage.py migrate` +1. `pip install -r requirements.txt` +2. `manage.py collectstatic` +3. `manage.py migrate` +4. `cd ./vue` +5. `yarn install` +6. `yarn build` -To apply all new migrations and collect new static files. +To install latest libraries, apply all new migrations and collect new static files. + +## PostgreSQL + +Postgres does not automatically upgrade database files when you change versions and requires manual intervention. +One option is to manually [backup/restore](https://docs.tandoor.dev/system/updating/#postgresql) the database. + +A full list of options to upgrade a database provide in the [official PostgreSQL documentation](https://www.postgresql.org/docs/current/upgrading.html). + +1. Collect information about your environment. + ``` bash + grep -E 'POSTGRES|DATABASE' ~/.docker/compose/.env + docker ps -a --format 'table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}' | awk 'NR == 1 || /postgres/ || /recipes/' + ``` + [ ] Database Container + [ ] Tandoor Container + [ ] Database User +2. Export the tandoor database + ``` bash + docker exec -t {{database_container}} pg_dumpall -U {{djangouser}} > ~/tandoor.sql + ``` +3. Stop the postgres container + ``` bash + docker stop {{database_container}} {{tandoor_container}} + ``` +4. Rename the tandoor volume + ``` bash + sudo mv -R ~/.docker/compose/postgres ~/.docker/compose/postgres.old + ``` +5. Update image tag on postgres container. + ``` yaml + db_recipes: + restart: always + image: postgres:16-alpine + volumes: + - ./postgresql:/var/lib/postgresql/data + env_file: + - ./.env + ``` +6. Pull and rebuild container. + ``` bash + docker-compose pull && docker-compose up -d + ``` +7. Import the database export + ``` bash + cat ~/tandoor.sql | sudo docker exec -i {{database_container}} psql postgres -U {{djangouser}} + ``` + +If anything fails, go back to the old postgres version and data directory and try again. + +There are many articles and tools online that might provide a good starting point to help you upgrade [1](https://thomasbandt.com/postgres-docker-major-version-upgrade), [2](https://github.com/tianon/docker-postgres-upgrade), [3](https://github.com/vabene1111/DockerPostgresBackups). From 92b8799d263f98cb287be2e8a3bf71a4e620f362 Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 15:47:14 -0600 Subject: [PATCH 04/40] Update faq.md --- docs/faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.md b/docs/faq.md index a2480cfe..bd38eaa2 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -36,7 +36,7 @@ If that doesn't fix it, you can also refer to the appropriate sub section in the Navigate to `/system` and review the headers listed in the DEBUG section. At a minimum, if you are using a reverse proxy the headers must match the below conditions. | Header | Requirement | -| :--- | ----: | +| :--- | :---- | | HTTP_HOST:mydomain.tld | The host domain must match the url that you are using to open Tandoor. | | HTTP_X_FORWARDED_HOST:mydomain.tld | The host domain must match the url that you are using to open Tandoor. | | HTTP_X_FORWARDED_PROTO:http(s) | The protocol must match the url you are using to open Tandoor. There must be exactly one protocol listed. | From 7f44a6f1877ed0beef0a795abc8cb286d986a402 Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 15:48:33 -0600 Subject: [PATCH 05/40] Update updating.md --- docs/system/updating.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/system/updating.md b/docs/system/updating.md index c3100099..125d77d6 100644 --- a/docs/system/updating.md +++ b/docs/system/updating.md @@ -40,6 +40,7 @@ A full list of options to upgrade a database provide in the [official PostgreSQL [ ] Database Container [ ] Tandoor Container [ ] Database User + 2. Export the tandoor database ``` bash docker exec -t {{database_container}} pg_dumpall -U {{djangouser}} > ~/tandoor.sql From 72d3ace0f931d663958fdbf75757904d6a4ab58c Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 15:49:20 -0600 Subject: [PATCH 06/40] Update updating.md --- docs/system/updating.md | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/docs/system/updating.md b/docs/system/updating.md index 125d77d6..09b41000 100644 --- a/docs/system/updating.md +++ b/docs/system/updating.md @@ -33,26 +33,29 @@ One option is to manually [backup/restore](https://docs.tandoor.dev/system/updat A full list of options to upgrade a database provide in the [official PostgreSQL documentation](https://www.postgresql.org/docs/current/upgrading.html). 1. Collect information about your environment. - ``` bash - grep -E 'POSTGRES|DATABASE' ~/.docker/compose/.env - docker ps -a --format 'table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}' | awk 'NR == 1 || /postgres/ || /recipes/' - ``` - [ ] Database Container - [ ] Tandoor Container - [ ] Database User +``` bash +grep -E 'POSTGRES|DATABASE' ~/.docker/compose/.env +docker ps -a --format 'table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}' | awk 'NR == 1 || /postgres/ || /recipes/' +``` +[ ] Database Container +[ ] Tandoor Container +[ ] Database User 2. Export the tandoor database - ``` bash - docker exec -t {{database_container}} pg_dumpall -U {{djangouser}} > ~/tandoor.sql - ``` + ``` bash + docker exec -t {{database_container}} pg_dumpall -U {{djangouser}} > ~/tandoor.sql + ``` + 3. Stop the postgres container - ``` bash - docker stop {{database_container}} {{tandoor_container}} - ``` + ``` bash + docker stop {{database_container}} {{tandoor_container}} + ``` + 4. Rename the tandoor volume - ``` bash - sudo mv -R ~/.docker/compose/postgres ~/.docker/compose/postgres.old - ``` + + ``` bash + sudo mv -R ~/.docker/compose/postgres ~/.docker/compose/postgres.old + ``` 5. Update image tag on postgres container. ``` yaml db_recipes: From 49781bfa7ffb02c8fa03052486dfa1308ba16960 Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 15:50:35 -0600 Subject: [PATCH 07/40] Update updating.md --- docs/system/updating.md | 55 +++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/docs/system/updating.md b/docs/system/updating.md index 09b41000..df0dd44d 100644 --- a/docs/system/updating.md +++ b/docs/system/updating.md @@ -37,43 +37,50 @@ A full list of options to upgrade a database provide in the [official PostgreSQL grep -E 'POSTGRES|DATABASE' ~/.docker/compose/.env docker ps -a --format 'table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}' | awk 'NR == 1 || /postgres/ || /recipes/' ``` + [ ] Database Container [ ] Tandoor Container [ ] Database User 2. Export the tandoor database - ``` bash - docker exec -t {{database_container}} pg_dumpall -U {{djangouser}} > ~/tandoor.sql - ``` +``` bash +docker exec -t {{database_container}} pg_dumpall -U {{djangouser}} > ~/tandoor.sql +``` 3. Stop the postgres container - ``` bash - docker stop {{database_container}} {{tandoor_container}} - ``` +``` bash +docker stop {{database_container}} {{tandoor_container}} +``` 4. Rename the tandoor volume - ``` bash - sudo mv -R ~/.docker/compose/postgres ~/.docker/compose/postgres.old - ``` +``` bash +sudo mv -R ~/.docker/compose/postgres ~/.docker/compose/postgres.old +``` + 5. Update image tag on postgres container. - ``` yaml - db_recipes: - restart: always - image: postgres:16-alpine - volumes: - - ./postgresql:/var/lib/postgresql/data - env_file: - - ./.env - ``` + + ``` yaml + db_recipes: + restart: always + image: postgres:16-alpine + volumes: + - ./postgresql:/var/lib/postgresql/data + env_file: + - ./.env + ``` + 6. Pull and rebuild container. - ``` bash - docker-compose pull && docker-compose up -d - ``` + + ``` bash + docker-compose pull && docker-compose up -d + ``` + 7. Import the database export - ``` bash - cat ~/tandoor.sql | sudo docker exec -i {{database_container}} psql postgres -U {{djangouser}} - ``` + + ``` bash + cat ~/tandoor.sql | sudo docker exec -i {{database_container}} psql postgres -U {{djangouser}} + ``` If anything fails, go back to the old postgres version and data directory and try again. From bae777bc69beb35a5d105c00bf0278a761e43f83 Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 15:51:06 -0600 Subject: [PATCH 08/40] Update updating.md --- docs/system/updating.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/system/updating.md b/docs/system/updating.md index df0dd44d..21d07f6f 100644 --- a/docs/system/updating.md +++ b/docs/system/updating.md @@ -41,7 +41,7 @@ docker ps -a --format 'table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}' | awk [ ] Database Container [ ] Tandoor Container [ ] Database User - + 2. Export the tandoor database ``` bash docker exec -t {{database_container}} pg_dumpall -U {{djangouser}} > ~/tandoor.sql From a076d20cbac8be5a4eaddcec204b8f87a34ab73b Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 15:51:51 -0600 Subject: [PATCH 09/40] Update updating.md --- docs/system/updating.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/system/updating.md b/docs/system/updating.md index 21d07f6f..96ff61c7 100644 --- a/docs/system/updating.md +++ b/docs/system/updating.md @@ -33,16 +33,18 @@ One option is to manually [backup/restore](https://docs.tandoor.dev/system/updat A full list of options to upgrade a database provide in the [official PostgreSQL documentation](https://www.postgresql.org/docs/current/upgrading.html). 1. Collect information about your environment. + ``` bash grep -E 'POSTGRES|DATABASE' ~/.docker/compose/.env docker ps -a --format 'table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}' | awk 'NR == 1 || /postgres/ || /recipes/' ``` -[ ] Database Container -[ ] Tandoor Container -[ ] Database User +- Database Container +- Tandoor Container +- Database User 2. Export the tandoor database + ``` bash docker exec -t {{database_container}} pg_dumpall -U {{djangouser}} > ~/tandoor.sql ``` From fcb2c07acd01d027d5fb9fef4b142f0a27fed07b Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 15:52:21 -0600 Subject: [PATCH 10/40] Update updating.md --- docs/system/updating.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/system/updating.md b/docs/system/updating.md index 96ff61c7..2086a74b 100644 --- a/docs/system/updating.md +++ b/docs/system/updating.md @@ -39,10 +39,6 @@ grep -E 'POSTGRES|DATABASE' ~/.docker/compose/.env docker ps -a --format 'table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}' | awk 'NR == 1 || /postgres/ || /recipes/' ``` -- Database Container -- Tandoor Container -- Database User - 2. Export the tandoor database ``` bash From f69813f7294ae84fc8cf7f86d4756f52fa618013 Mon Sep 17 00:00:00 2001 From: smilerz Date: Tue, 28 Nov 2023 16:22:17 -0600 Subject: [PATCH 11/40] added installing extensions if necessary --- docs/system/updating.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/system/updating.md b/docs/system/updating.md index 2086a74b..b6d88588 100644 --- a/docs/system/updating.md +++ b/docs/system/updating.md @@ -79,6 +79,15 @@ sudo mv -R ~/.docker/compose/postgres ~/.docker/compose/postgres.old ``` bash cat ~/tandoor.sql | sudo docker exec -i {{database_container}} psql postgres -U {{djangouser}} ``` + 8. Install postgres extensions + ``` bash + docker exec -it {{database_container}} psql + ``` + then + ``` psql + CREATE EXTENSION IF NOT EXISTS unaccent; + CREATE EXTENSION IF NOT EXISTS pg_trgm; + ``` If anything fails, go back to the old postgres version and data directory and try again. From 9ae0b50558ba9efca3f8272aa4fb248dbf2a5bd6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Nov 2023 00:16:22 +0000 Subject: [PATCH 12/40] Bump cryptography from 41.0.4 to 41.0.6 Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.4 to 41.0.6. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/41.0.4...41.0.6) --- updated-dependencies: - dependency-name: cryptography dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cec0394d..b04364d0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ Django==4.2.7 -cryptography===41.0.4 +cryptography===41.0.6 django-annoying==0.10.6 django-autocomplete-light==3.9.4 django-cleanup==8.0.0 From 1000badd2ffebed3c4607cf339a2858a1197d39f Mon Sep 17 00:00:00 2001 From: Jan-Niklas Weghorn Date: Wed, 29 Nov 2023 11:41:19 +0100 Subject: [PATCH 13/40] remove venv from .dockerignore --- .dockerignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index a9319f54..a69161b0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -29,4 +29,3 @@ vue/babel.config* vue/package.json vue/tsconfig.json vue/src/utils/openapi -venv/ From e90781983f12533e738018eecfb1687cc4f4e2fe Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 29 Nov 2023 17:48:25 +0100 Subject: [PATCH 14/40] fixed meal plan multi period arrow breaking view #2678 --- vue/src/apps/MealPlanView/MealPlanView.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vue/src/apps/MealPlanView/MealPlanView.vue b/vue/src/apps/MealPlanView/MealPlanView.vue index 8a5f4264..2f60ae01 100644 --- a/vue/src/apps/MealPlanView/MealPlanView.vue +++ b/vue/src/apps/MealPlanView/MealPlanView.vue @@ -744,8 +744,12 @@ having to override as much. .theme-default .cv-item.continued::before, .theme-default .cv-item.toBeContinued::after { + /* + removed because it breaks a line and would increase item size https://github.com/TandoorRecipes/recipes/issues/2678 + content: " \21e2 "; color: #999; + */ } .theme-default .cv-item.toBeContinued { From db1709cef7c6717ffa6867c75a877a3de22a2683 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 29 Nov 2023 17:50:01 +0100 Subject: [PATCH 15/40] recipe context add to meal plan default to_date --- vue/src/components/RecipeContextMenu.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/vue/src/components/RecipeContextMenu.vue b/vue/src/components/RecipeContextMenu.vue index df31666a..72db67f4 100644 --- a/vue/src/components/RecipeContextMenu.vue +++ b/vue/src/components/RecipeContextMenu.vue @@ -209,6 +209,7 @@ export default { this.entryEditing = this.options.entryEditing this.entryEditing.recipe = this.recipe this.entryEditing.from_date = moment(new Date()).format("YYYY-MM-DD") + this.entryEditing.to_date = moment(new Date()).format("YYYY-MM-DD") this.$nextTick(function () { this.$bvModal.show(`modal-meal-plan_${this.modal_id}`) }) From 8b9a09b268e1e27b51b775f6d918ff23292d31e6 Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 29 Nov 2023 10:56:33 -0600 Subject: [PATCH 16/40] Update settings.py --- recipes/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/settings.py b/recipes/settings.py index 42164766..4326d27f 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -452,7 +452,7 @@ LANGUAGE_CODE = 'en' if os.getenv('TIMEZONE') is not None: print('DEPRECATION WARNING: Environment var "TIMEZONE" is deprecated. Please use "TZ" instead.') - TIME_ZONE = bool(int(os.getenv('REVERSE_PROXY_AUTH', False))) + TIME_ZONE = bool(int(os.getenv('TIMEZONE'))) else: TIME_ZONE = os.getenv('TZ') if os.getenv('TZ') else 'Europe/Berlin' From 9b18cab1459a2b1e451cd0a08359898a0a0a958d Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 29 Nov 2023 19:28:19 +0100 Subject: [PATCH 17/40] Update settings.py --- recipes/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/settings.py b/recipes/settings.py index 4326d27f..8d902441 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -452,7 +452,7 @@ LANGUAGE_CODE = 'en' if os.getenv('TIMEZONE') is not None: print('DEPRECATION WARNING: Environment var "TIMEZONE" is deprecated. Please use "TZ" instead.') - TIME_ZONE = bool(int(os.getenv('TIMEZONE'))) + TIME_ZONE = os.getenv('TIMEZONE') if os.getenv('TIMEZONE') else 'Europe/Berlin' else: TIME_ZONE = os.getenv('TZ') if os.getenv('TZ') else 'Europe/Berlin' From 0a0e3a48c37b899d65bafaa89474b8999db6ba15 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 29 Nov 2023 21:20:10 +0100 Subject: [PATCH 18/40] first working property editor prototype --- .env.template | 2 + cookbook/admin.py | 4 +- ...r_food_fdc_id_alter_propertytype_fdc_id.py | 23 + cookbook/models.py | 6 +- cookbook/views/api.py | 48 +- recipes/settings.py | 2 +- vue/src/apps/TestView/TestView.vue | 49 +- vue/src/utils/openapi/api.ts | 3859 +++++++++++++++++ 8 files changed, 3969 insertions(+), 24 deletions(-) create mode 100644 cookbook/migrations/0205_alter_food_fdc_id_alter_propertytype_fdc_id.py diff --git a/.env.template b/.env.template index 3556d34c..1e57b4a1 100644 --- a/.env.template +++ b/.env.template @@ -183,3 +183,5 @@ REMOTE_USER_AUTH=0 # Recipe exports are cached for a certain time by default, adjust time if needed # EXPORT_FILE_CACHE_DURATION=600 +# if you want to do many requests to the FDC API you need to get a (free) API key. Demo key is limited to 30 requests / hour or 50 requests / day +#FDC_API_KEY=DEMO_KEY \ No newline at end of file diff --git a/cookbook/admin.py b/cookbook/admin.py index 9f7df90a..d2b5c31a 100644 --- a/cookbook/admin.py +++ b/cookbook/admin.py @@ -349,7 +349,9 @@ admin.site.register(ShareLink, ShareLinkAdmin) class PropertyTypeAdmin(admin.ModelAdmin): - list_display = ('id', 'name') + search_fields = ('space',) + + list_display = ('id', 'space', 'name', 'fdc_id') admin.site.register(PropertyType, PropertyTypeAdmin) diff --git a/cookbook/migrations/0205_alter_food_fdc_id_alter_propertytype_fdc_id.py b/cookbook/migrations/0205_alter_food_fdc_id_alter_propertytype_fdc_id.py new file mode 100644 index 00000000..9f57e443 --- /dev/null +++ b/cookbook/migrations/0205_alter_food_fdc_id_alter_propertytype_fdc_id.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.7 on 2023-11-29 19:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cookbook', '0204_propertytype_fdc_id'), + ] + + operations = [ + migrations.AlterField( + model_name='food', + name='fdc_id', + field=models.IntegerField(blank=True, default=None, null=True), + ), + migrations.AlterField( + model_name='propertytype', + name='fdc_id', + field=models.IntegerField(blank=True, default=None, null=True), + ), + ] diff --git a/cookbook/models.py b/cookbook/models.py index 6ea39d2e..c40bb41f 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -591,7 +591,7 @@ class Food(ExportModelOperationsMixin('food'), TreeModel, PermissionModelMixin): preferred_unit = models.ForeignKey(Unit, on_delete=models.SET_NULL, null=True, blank=True, default=None, related_name='preferred_unit') preferred_shopping_unit = models.ForeignKey(Unit, on_delete=models.SET_NULL, null=True, blank=True, default=None, related_name='preferred_shopping_unit') - fdc_id = models.CharField(max_length=128, null=True, blank=True, default=None) + fdc_id = models.IntegerField(null=True, default=None, blank=True) open_data_slug = models.CharField(max_length=128, null=True, blank=True, default=None) space = models.ForeignKey(Space, on_delete=models.CASCADE) @@ -767,7 +767,7 @@ class PropertyType(models.Model, PermissionModelMixin): (PRICE, _('Price')), (GOAL, _('Goal')), (OTHER, _('Other'))), null=True, blank=True) open_data_slug = models.CharField(max_length=128, null=True, blank=True, default=None) - fdc_id = models.CharField(max_length=128, null=True, blank=True, default=None) + fdc_id = models.IntegerField(null=True, default=None, blank=True) # TODO show if empty property? # TODO formatting property? @@ -809,7 +809,7 @@ class FoodProperty(models.Model): class Meta: constraints = [ - models.UniqueConstraint(fields=['food', 'property'], name='property_unique_food') + models.UniqueConstraint(fields=['food', 'property'], name='property_unique_food'), ] diff --git a/cookbook/views/api.py b/cookbook/views/api.py index efe0ebcc..a35ac1ce 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -26,7 +26,7 @@ from django.db.models import Case, Count, Exists, OuterRef, ProtectedError, Q, S from django.db.models.fields.related import ForeignObjectRel from django.db.models.functions import Coalesce, Lower from django.db.models.signals import post_save -from django.http import FileResponse, HttpResponse, JsonResponse +from django.http import FileResponse, HttpResponse, JsonResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, redirect from django.urls import reverse from django.utils import timezone @@ -75,7 +75,7 @@ from cookbook.models import (Automation, BookmarkletImport, CookLog, CustomFilte ShareLink, ShoppingList, ShoppingListEntry, ShoppingListRecipe, Space, Step, Storage, Supermarket, SupermarketCategory, SupermarketCategoryRelation, Sync, SyncLog, Unit, UnitConversion, - UserFile, UserPreference, UserSpace, ViewLog) + UserFile, UserPreference, UserSpace, ViewLog, FoodProperty) from cookbook.provider.dropbox import Dropbox from cookbook.provider.local import Local from cookbook.provider.nextcloud import Nextcloud @@ -104,6 +104,7 @@ from cookbook.serializer import (AccessTokenSerializer, AutomationSerializer, UserSerializer, UserSpaceSerializer, ViewLogSerializer) from cookbook.views.import_export import get_integration from recipes import settings +from recipes.settings import FDC_API_KEY class StandardFilterMixin(ViewSetMixin): @@ -595,6 +596,49 @@ class FoodViewSet(viewsets.ModelViewSet, TreeMixin): created_by=request.user) return Response(content, status=status.HTTP_204_NO_CONTENT) + @decorators.action(detail=True, methods=['POST'], ) + def fdc(self, request, pk): + """ + updates the food with all possible data from the FDC Api (only adds new, does not change existing properties) + """ + food = self.get_object() + + response = requests.get(f'https://api.nal.usda.gov/fdc/v1/food/{food.fdc_id}?api_key={FDC_API_KEY}') + if response.status_code == 429: + return JsonResponse({'msg', 'API Key Rate Limit reached/exceeded, see https://api.data.gov/docs/rate-limits/ for more information. Configure your key in Tandoor using environment FDC_API_KEY variable.'}, status=429, + json_dumps_params={'indent': 4}) + + try: + data = json.loads(response.content) + + food_property_list = [] + food_property_types = food.foodproperty_set.values_list('property__property_type_id', flat=True) + + for pt in PropertyType.objects.filter(space=request.space).all(): + if pt.fdc_id and pt.id not in food_property_types: + for fn in data['foodNutrients']: + if fn['nutrient']['id'] == pt.fdc_id: + food_property_list.append(Property( + property_type_id=pt.id, + property_amount=round(fn['amount'], 2), + import_food_id=food.id, + space=self.request.space, + )) + + Property.objects.bulk_create(food_property_list, ignore_conflicts=True, unique_fields=('space', 'import_food_id', 'property_type',)) + + property_food_relation_list = [] + for p in Property.objects.filter(space=self.request.space, import_food_id=food.id).values_list('import_food_id', 'id', ): + property_food_relation_list.append(Food.properties.through(food_id=p[0], property_id=p[1])) + + FoodProperty.objects.bulk_create(property_food_relation_list, ignore_conflicts=True, unique_fields=('food_id', 'property_id',)) + Property.objects.filter(space=self.request.space, import_food_id=food.id).update(import_food_id=None) + + return self.retrieve(request, pk) + except Exception as e: + traceback.print_exc() + return JsonResponse({'error': f'{e} - check server log'}, status=500, json_dumps_params={'indent': 4}) + def destroy(self, *args, **kwargs): try: return (super().destroy(self, *args, **kwargs)) diff --git a/recipes/settings.py b/recipes/settings.py index 8d902441..f966e419 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -89,7 +89,7 @@ DJANGO_TABLES2_PAGE_RANGE = 8 HCAPTCHA_SITEKEY = os.getenv('HCAPTCHA_SITEKEY', '') HCAPTCHA_SECRET = os.getenv('HCAPTCHA_SECRET', '') -FDA_API_KEY = os.getenv('FDA_API_KEY', 'DEMO_KEY') +FDC_API_KEY = os.getenv('FDC_API_KEY', 'DEMO_KEY') SHARING_ABUSE = bool(int(os.getenv('SHARING_ABUSE', False))) SHARING_LIMIT = int(os.getenv('SHARING_LIMIT', 0)) diff --git a/vue/src/apps/TestView/TestView.vue b/vue/src/apps/TestView/TestView.vue index 52e7311a..789a1677 100644 --- a/vue/src/apps/TestView/TestView.vue +++ b/vue/src/apps/TestView/TestView.vue @@ -2,31 +2,33 @@
-

{{ recipe.name}}

+

{{ recipe.name }}

+ + + -
{{ $t('Name') }} {{ pt.name }} - -
- {{ f.food.name }} - {{ $t('Property') }} / + {{ f.food.name }} #{{ f.food.id }} + {{ $t('Property') }} / - - + + + + {{ p.property_type.unit }} ({{ p.property_type.name }}) {{ p.property_type.unit }}
@@ -84,17 +86,20 @@ export default { mounted() { this.$i18n.locale = window.CUSTOM_LOCALE - let apiClient = new ApiApiFactory() - - apiClient.retrieveRecipe("112").then(result => { - this.recipe = result.data - }) - - apiClient.listPropertyTypes().then(result => { - this.property_types = result.data - }) + this.loadData(); }, methods: { + loadData: function () { + let apiClient = new ApiApiFactory() + + apiClient.retrieveRecipe("112").then(result => { + this.recipe = result.data + }) + + apiClient.listPropertyTypes().then(result => { + this.property_types = result.data + }) + }, updateFood: function (food) { let apiClient = new ApiApiFactory() apiClient.partialUpdateFood(food.id, food).then(result => { @@ -112,6 +117,16 @@ export default { }).catch((err) => { StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) }) + }, + updateFoodFromFDC: function (food) { + let apiClient = new ApiApiFactory() + + apiClient.fdcFood(food.id).then(result => { + this.loadData() + StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE) + }).catch((err) => { + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) + }) } }, } diff --git a/vue/src/utils/openapi/api.ts b/vue/src/utils/openapi/api.ts index 9c2aff23..064297c4 100644 --- a/vue/src/utils/openapi/api.ts +++ b/vue/src/utils/openapi/api.ts @@ -492,6 +492,12 @@ export interface Food { * @memberof Food */ properties_food_unit?: FoodPropertiesFoodUnit | null; + /** + * + * @type {number} + * @memberof Food + */ + fdc_id?: number | null; /** * * @type {string} @@ -731,6 +737,12 @@ export interface FoodPropertyType { * @memberof FoodPropertyType */ open_data_slug?: string | null; + /** + * + * @type {number} + * @memberof FoodPropertyType + */ + fdc_id?: number | null; } /** * @@ -1139,6 +1151,12 @@ export interface IngredientFood { * @memberof IngredientFood */ properties_food_unit?: FoodPropertiesFoodUnit | null; + /** + * + * @type {number} + * @memberof IngredientFood + */ + fdc_id?: number | null; /** * * @type {string} @@ -2073,6 +2091,957 @@ export interface MealType { */ created_by?: string; } +/** + * + * @export + * @interface OpenDataCategory + */ +export interface OpenDataCategory { + /** + * + * @type {number} + * @memberof OpenDataCategory + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataCategory + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataCategory + */ + slug: string; + /** + * + * @type {string} + * @memberof OpenDataCategory + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataCategory + */ + description?: string; + /** + * + * @type {string} + * @memberof OpenDataCategory + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataCategory + */ + created_by?: string; +} +/** + * + * @export + * @interface OpenDataConversion + */ +export interface OpenDataConversion { + /** + * + * @type {number} + * @memberof OpenDataConversion + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataConversion + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataConversion + */ + slug: string; + /** + * + * @type {OpenDataConversionFood} + * @memberof OpenDataConversion + */ + food: OpenDataConversionFood; + /** + * + * @type {string} + * @memberof OpenDataConversion + */ + base_amount: string; + /** + * + * @type {OpenDataConversionFoodPropertiesFoodUnit} + * @memberof OpenDataConversion + */ + base_unit: OpenDataConversionFoodPropertiesFoodUnit; + /** + * + * @type {string} + * @memberof OpenDataConversion + */ + converted_amount: string; + /** + * + * @type {OpenDataConversionFoodPropertiesFoodUnit} + * @memberof OpenDataConversion + */ + converted_unit: OpenDataConversionFoodPropertiesFoodUnit; + /** + * + * @type {string} + * @memberof OpenDataConversion + */ + source: string; + /** + * + * @type {string} + * @memberof OpenDataConversion + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataConversion + */ + created_by?: string; +} +/** + * + * @export + * @interface OpenDataConversionFood + */ +export interface OpenDataConversionFood { + /** + * + * @type {number} + * @memberof OpenDataConversionFood + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataConversionFood + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataConversionFood + */ + slug: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFood + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFood + */ + plural_name: string; + /** + * + * @type {OpenDataStoreCategory} + * @memberof OpenDataConversionFood + */ + store_category: OpenDataStoreCategory; + /** + * + * @type {OpenDataConversionFoodPreferredUnitMetric} + * @memberof OpenDataConversionFood + */ + preferred_unit_metric?: OpenDataConversionFoodPreferredUnitMetric | null; + /** + * + * @type {OpenDataConversionFoodPreferredUnitMetric} + * @memberof OpenDataConversionFood + */ + preferred_shopping_unit_metric?: OpenDataConversionFoodPreferredUnitMetric | null; + /** + * + * @type {OpenDataConversionFoodPreferredUnitMetric} + * @memberof OpenDataConversionFood + */ + preferred_unit_imperial?: OpenDataConversionFoodPreferredUnitMetric | null; + /** + * + * @type {OpenDataConversionFoodPreferredUnitMetric} + * @memberof OpenDataConversionFood + */ + preferred_shopping_unit_imperial?: OpenDataConversionFoodPreferredUnitMetric | null; + /** + * + * @type {Array} + * @memberof OpenDataConversionFood + */ + properties: Array | null; + /** + * + * @type {number} + * @memberof OpenDataConversionFood + */ + properties_food_amount?: number; + /** + * + * @type {OpenDataConversionFoodPropertiesFoodUnit} + * @memberof OpenDataConversionFood + */ + properties_food_unit: OpenDataConversionFoodPropertiesFoodUnit; + /** + * + * @type {string} + * @memberof OpenDataConversionFood + */ + properties_source?: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFood + */ + fdc_id: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFood + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFood + */ + created_by?: string; +} +/** + * + * @export + * @interface OpenDataConversionFoodPreferredUnitMetric + */ +export interface OpenDataConversionFoodPreferredUnitMetric { + /** + * + * @type {number} + * @memberof OpenDataConversionFoodPreferredUnitMetric + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataConversionFoodPreferredUnitMetric + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPreferredUnitMetric + */ + slug: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPreferredUnitMetric + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPreferredUnitMetric + */ + plural_name?: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPreferredUnitMetric + */ + base_unit?: OpenDataConversionFoodPreferredUnitMetricBaseUnitEnum; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPreferredUnitMetric + */ + type: OpenDataConversionFoodPreferredUnitMetricTypeEnum; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPreferredUnitMetric + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPreferredUnitMetric + */ + created_by?: string; +} + +/** + * @export + * @enum {string} + */ +export enum OpenDataConversionFoodPreferredUnitMetricBaseUnitEnum { + G = 'G', + Kg = 'KG', + Ml = 'ML', + L = 'L', + Ounce = 'OUNCE', + Pound = 'POUND', + FluidOunce = 'FLUID_OUNCE', + Tsp = 'TSP', + Tbsp = 'TBSP', + Cup = 'CUP', + Pint = 'PINT', + Quart = 'QUART', + Gallon = 'GALLON', + ImperialFluidOunce = 'IMPERIAL_FLUID_OUNCE', + ImperialPint = 'IMPERIAL_PINT', + ImperialQuart = 'IMPERIAL_QUART', + ImperialGallon = 'IMPERIAL_GALLON' +} +/** + * @export + * @enum {string} + */ +export enum OpenDataConversionFoodPreferredUnitMetricTypeEnum { + Weight = 'WEIGHT', + Volume = 'VOLUME', + Other = 'OTHER' +} + +/** + * + * @export + * @interface OpenDataConversionFoodProperties + */ +export interface OpenDataConversionFoodProperties { + /** + * + * @type {number} + * @memberof OpenDataConversionFoodProperties + */ + id?: number; + /** + * + * @type {OpenDataConversionFoodProperty} + * @memberof OpenDataConversionFoodProperties + */ + property: OpenDataConversionFoodProperty; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodProperties + */ + property_amount: string; +} +/** + * + * @export + * @interface OpenDataConversionFoodPropertiesFoodUnit + */ +export interface OpenDataConversionFoodPropertiesFoodUnit { + /** + * + * @type {number} + * @memberof OpenDataConversionFoodPropertiesFoodUnit + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataConversionFoodPropertiesFoodUnit + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPropertiesFoodUnit + */ + slug: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPropertiesFoodUnit + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPropertiesFoodUnit + */ + plural_name?: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPropertiesFoodUnit + */ + base_unit?: OpenDataConversionFoodPropertiesFoodUnitBaseUnitEnum; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPropertiesFoodUnit + */ + type: OpenDataConversionFoodPropertiesFoodUnitTypeEnum; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPropertiesFoodUnit + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodPropertiesFoodUnit + */ + created_by?: string; +} + +/** + * @export + * @enum {string} + */ +export enum OpenDataConversionFoodPropertiesFoodUnitBaseUnitEnum { + G = 'G', + Kg = 'KG', + Ml = 'ML', + L = 'L', + Ounce = 'OUNCE', + Pound = 'POUND', + FluidOunce = 'FLUID_OUNCE', + Tsp = 'TSP', + Tbsp = 'TBSP', + Cup = 'CUP', + Pint = 'PINT', + Quart = 'QUART', + Gallon = 'GALLON', + ImperialFluidOunce = 'IMPERIAL_FLUID_OUNCE', + ImperialPint = 'IMPERIAL_PINT', + ImperialQuart = 'IMPERIAL_QUART', + ImperialGallon = 'IMPERIAL_GALLON' +} +/** + * @export + * @enum {string} + */ +export enum OpenDataConversionFoodPropertiesFoodUnitTypeEnum { + Weight = 'WEIGHT', + Volume = 'VOLUME', + Other = 'OTHER' +} + +/** + * + * @export + * @interface OpenDataConversionFoodProperty + */ +export interface OpenDataConversionFoodProperty { + /** + * + * @type {number} + * @memberof OpenDataConversionFoodProperty + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataConversionFoodProperty + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodProperty + */ + slug: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodProperty + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodProperty + */ + unit?: string; + /** + * + * @type {number} + * @memberof OpenDataConversionFoodProperty + */ + fdc_id?: number | null; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodProperty + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataConversionFoodProperty + */ + created_by?: string; +} +/** + * + * @export + * @interface OpenDataFood + */ +export interface OpenDataFood { + /** + * + * @type {number} + * @memberof OpenDataFood + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataFood + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataFood + */ + slug: string; + /** + * + * @type {string} + * @memberof OpenDataFood + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataFood + */ + plural_name: string; + /** + * + * @type {OpenDataStoreCategory} + * @memberof OpenDataFood + */ + store_category: OpenDataStoreCategory; + /** + * + * @type {OpenDataConversionFoodPreferredUnitMetric} + * @memberof OpenDataFood + */ + preferred_unit_metric?: OpenDataConversionFoodPreferredUnitMetric | null; + /** + * + * @type {OpenDataConversionFoodPreferredUnitMetric} + * @memberof OpenDataFood + */ + preferred_shopping_unit_metric?: OpenDataConversionFoodPreferredUnitMetric | null; + /** + * + * @type {OpenDataConversionFoodPreferredUnitMetric} + * @memberof OpenDataFood + */ + preferred_unit_imperial?: OpenDataConversionFoodPreferredUnitMetric | null; + /** + * + * @type {OpenDataConversionFoodPreferredUnitMetric} + * @memberof OpenDataFood + */ + preferred_shopping_unit_imperial?: OpenDataConversionFoodPreferredUnitMetric | null; + /** + * + * @type {Array} + * @memberof OpenDataFood + */ + properties: Array | null; + /** + * + * @type {number} + * @memberof OpenDataFood + */ + properties_food_amount?: number; + /** + * + * @type {OpenDataConversionFoodPropertiesFoodUnit} + * @memberof OpenDataFood + */ + properties_food_unit: OpenDataConversionFoodPropertiesFoodUnit; + /** + * + * @type {string} + * @memberof OpenDataFood + */ + properties_source?: string; + /** + * + * @type {string} + * @memberof OpenDataFood + */ + fdc_id: string; + /** + * + * @type {string} + * @memberof OpenDataFood + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataFood + */ + created_by?: string; +} +/** + * + * @export + * @interface OpenDataProperty + */ +export interface OpenDataProperty { + /** + * + * @type {number} + * @memberof OpenDataProperty + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataProperty + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataProperty + */ + slug: string; + /** + * + * @type {string} + * @memberof OpenDataProperty + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataProperty + */ + unit?: string; + /** + * + * @type {number} + * @memberof OpenDataProperty + */ + fdc_id?: number | null; + /** + * + * @type {string} + * @memberof OpenDataProperty + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataProperty + */ + created_by?: string; +} +/** + * + * @export + * @interface OpenDataStore + */ +export interface OpenDataStore { + /** + * + * @type {number} + * @memberof OpenDataStore + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataStore + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataStore + */ + slug: string; + /** + * + * @type {string} + * @memberof OpenDataStore + */ + name: string; + /** + * + * @type {Array} + * @memberof OpenDataStore + */ + category_to_store: Array | null; + /** + * + * @type {string} + * @memberof OpenDataStore + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataStore + */ + created_by?: string; +} +/** + * + * @export + * @interface OpenDataStoreCategory + */ +export interface OpenDataStoreCategory { + /** + * + * @type {number} + * @memberof OpenDataStoreCategory + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataStoreCategory + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataStoreCategory + */ + slug: string; + /** + * + * @type {string} + * @memberof OpenDataStoreCategory + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataStoreCategory + */ + description?: string; + /** + * + * @type {string} + * @memberof OpenDataStoreCategory + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataStoreCategory + */ + created_by?: string; +} +/** + * + * @export + * @interface OpenDataStoreCategoryToStore + */ +export interface OpenDataStoreCategoryToStore { + /** + * + * @type {number} + * @memberof OpenDataStoreCategoryToStore + */ + id?: number; + /** + * + * @type {OpenDataStoreCategory} + * @memberof OpenDataStoreCategoryToStore + */ + category: OpenDataStoreCategory; + /** + * + * @type {number} + * @memberof OpenDataStoreCategoryToStore + */ + store: number; + /** + * + * @type {number} + * @memberof OpenDataStoreCategoryToStore + */ + order?: number; +} +/** + * + * @export + * @interface OpenDataUnit + */ +export interface OpenDataUnit { + /** + * + * @type {number} + * @memberof OpenDataUnit + */ + id?: number; + /** + * + * @type {OpenDataUnitVersion} + * @memberof OpenDataUnit + */ + version: OpenDataUnitVersion; + /** + * + * @type {string} + * @memberof OpenDataUnit + */ + slug: string; + /** + * + * @type {string} + * @memberof OpenDataUnit + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataUnit + */ + plural_name?: string; + /** + * + * @type {string} + * @memberof OpenDataUnit + */ + base_unit?: OpenDataUnitBaseUnitEnum; + /** + * + * @type {string} + * @memberof OpenDataUnit + */ + type: OpenDataUnitTypeEnum; + /** + * + * @type {string} + * @memberof OpenDataUnit + */ + comment?: string; + /** + * + * @type {string} + * @memberof OpenDataUnit + */ + created_by?: string; +} + +/** + * @export + * @enum {string} + */ +export enum OpenDataUnitBaseUnitEnum { + G = 'G', + Kg = 'KG', + Ml = 'ML', + L = 'L', + Ounce = 'OUNCE', + Pound = 'POUND', + FluidOunce = 'FLUID_OUNCE', + Tsp = 'TSP', + Tbsp = 'TBSP', + Cup = 'CUP', + Pint = 'PINT', + Quart = 'QUART', + Gallon = 'GALLON', + ImperialFluidOunce = 'IMPERIAL_FLUID_OUNCE', + ImperialPint = 'IMPERIAL_PINT', + ImperialQuart = 'IMPERIAL_QUART', + ImperialGallon = 'IMPERIAL_GALLON' +} +/** + * @export + * @enum {string} + */ +export enum OpenDataUnitTypeEnum { + Weight = 'WEIGHT', + Volume = 'VOLUME', + Other = 'OTHER' +} + +/** + * + * @export + * @interface OpenDataUnitVersion + */ +export interface OpenDataUnitVersion { + /** + * + * @type {number} + * @memberof OpenDataUnitVersion + */ + id?: number; + /** + * + * @type {string} + * @memberof OpenDataUnitVersion + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataUnitVersion + */ + code: string; + /** + * + * @type {string} + * @memberof OpenDataUnitVersion + */ + comment?: string; +} +/** + * + * @export + * @interface OpenDataVersion + */ +export interface OpenDataVersion { + /** + * + * @type {number} + * @memberof OpenDataVersion + */ + id?: number; + /** + * + * @type {string} + * @memberof OpenDataVersion + */ + name: string; + /** + * + * @type {string} + * @memberof OpenDataVersion + */ + code: string; + /** + * + * @type {string} + * @memberof OpenDataVersion + */ + comment?: string; +} /** * * @export @@ -2140,6 +3109,12 @@ export interface PropertyType { * @memberof PropertyType */ open_data_slug?: string | null; + /** + * + * @type {number} + * @memberof PropertyType + */ + fdc_id?: number | null; } /** * @@ -4851,6 +5826,237 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataCategory: async (openDataCategory?: OpenDataCategory, options: any = {}): Promise => { + const localVarPath = `/api/open-data-category/`; + // 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(openDataCategory, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataConversion: async (openDataConversion?: OpenDataConversion, options: any = {}): Promise => { + const localVarPath = `/api/open-data-conversion/`; + // 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(openDataConversion, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataFood: async (openDataFood?: OpenDataFood, options: any = {}): Promise => { + const localVarPath = `/api/open-data-food/`; + // 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(openDataFood, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataProperty: async (openDataProperty?: OpenDataProperty, options: any = {}): Promise => { + const localVarPath = `/api/open-data-property/`; + // 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(openDataProperty, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataStore: async (openDataStore?: OpenDataStore, options: any = {}): Promise => { + const localVarPath = `/api/open-data-store/`; + // 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(openDataStore, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataUnit: async (openDataUnit?: OpenDataUnit, options: any = {}): Promise => { + const localVarPath = `/api/open-data-unit/`; + // 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(openDataUnit, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataVersion: async (openDataVersion?: OpenDataVersion, options: any = {}): Promise => { + const localVarPath = `/api/open-data-version/`; + // 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(openDataVersion, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {Property} [property] @@ -5965,6 +7171,237 @@ 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 open data category. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataCategory: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('destroyOpenDataCategory', 'id', id) + const localVarPath = `/api/open-data-category/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataConversion: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('destroyOpenDataConversion', 'id', id) + const localVarPath = `/api/open-data-conversion/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataFood: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('destroyOpenDataFood', 'id', id) + const localVarPath = `/api/open-data-food/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataProperty: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('destroyOpenDataProperty', 'id', id) + const localVarPath = `/api/open-data-property/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataStore: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('destroyOpenDataStore', 'id', id) + const localVarPath = `/api/open-data-store/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataUnit: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('destroyOpenDataUnit', 'id', id) + const localVarPath = `/api/open-data-unit/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataVersion: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('destroyOpenDataVersion', 'id', id) + const localVarPath = `/api/open-data-version/{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}; @@ -6601,6 +8038,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * updates the food with all possible data from the FDC Api (only adds new, does not change existing properties) + * @param {string} id A unique integer value identifying this food. + * @param {Food} [food] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fdcFood: async (id: string, food?: Food, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('fdcFood', 'id', id) + const localVarPath = `/api/food/{id}/fdc/` + .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: '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(food, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -7164,6 +8638,238 @@ 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 {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataCategorys: async (options: any = {}): Promise => { + const localVarPath = `/api/open-data-category/`; + // 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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataConversions: async (options: any = {}): Promise => { + const localVarPath = `/api/open-data-conversion/`; + // 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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataFoods: async (options: any = {}): Promise => { + const localVarPath = `/api/open-data-food/`; + // 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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataPropertys: async (options: any = {}): Promise => { + const localVarPath = `/api/open-data-property/`; + // 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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataStatisticsViewSets: async (options: any = {}): Promise => { + const localVarPath = `/api/open-data-stats/`; + // 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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataStores: async (options: any = {}): Promise => { + const localVarPath = `/api/open-data-store/`; + // 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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataUnits: async (options: any = {}): Promise => { + const localVarPath = `/api/open-data-unit/`; + // 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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataVersions: async (options: any = {}): Promise => { + const localVarPath = `/api/open-data-version/`; + // 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}; @@ -8800,6 +10506,265 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataCategory: async (id: string, openDataCategory?: OpenDataCategory, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('partialUpdateOpenDataCategory', 'id', id) + const localVarPath = `/api/open-data-category/{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(openDataCategory, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataConversion: async (id: string, openDataConversion?: OpenDataConversion, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('partialUpdateOpenDataConversion', 'id', id) + const localVarPath = `/api/open-data-conversion/{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(openDataConversion, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataFood: async (id: string, openDataFood?: OpenDataFood, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('partialUpdateOpenDataFood', 'id', id) + const localVarPath = `/api/open-data-food/{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(openDataFood, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataProperty: async (id: string, openDataProperty?: OpenDataProperty, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('partialUpdateOpenDataProperty', 'id', id) + const localVarPath = `/api/open-data-property/{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(openDataProperty, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataStore: async (id: string, openDataStore?: OpenDataStore, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('partialUpdateOpenDataStore', 'id', id) + const localVarPath = `/api/open-data-store/{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(openDataStore, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataUnit: async (id: string, openDataUnit?: OpenDataUnit, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('partialUpdateOpenDataUnit', 'id', id) + const localVarPath = `/api/open-data-unit/{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(openDataUnit, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataVersion: async (id: string, openDataVersion?: OpenDataVersion, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('partialUpdateOpenDataVersion', 'id', id) + const localVarPath = `/api/open-data-version/{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(openDataVersion, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {string} id A unique integer value identifying this property. @@ -9870,6 +11835,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 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveFDCViewSet: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveFDCViewSet', 'id', id) + const localVarPath = `/api/open-data-FDC/{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}; @@ -10167,6 +12165,237 @@ 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 open data category. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataCategory: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveOpenDataCategory', 'id', id) + const localVarPath = `/api/open-data-category/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataConversion: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveOpenDataConversion', 'id', id) + const localVarPath = `/api/open-data-conversion/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataFood: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveOpenDataFood', 'id', id) + const localVarPath = `/api/open-data-food/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataProperty: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveOpenDataProperty', 'id', id) + const localVarPath = `/api/open-data-property/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataStore: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveOpenDataStore', 'id', id) + const localVarPath = `/api/open-data-store/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataUnit: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveOpenDataUnit', 'id', id) + const localVarPath = `/api/open-data-unit/{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}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataVersion: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveOpenDataVersion', 'id', id) + const localVarPath = `/api/open-data-version/{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}; @@ -11589,6 +13818,265 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataCategory: async (id: string, openDataCategory?: OpenDataCategory, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateOpenDataCategory', 'id', id) + const localVarPath = `/api/open-data-category/{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(openDataCategory, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataConversion: async (id: string, openDataConversion?: OpenDataConversion, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateOpenDataConversion', 'id', id) + const localVarPath = `/api/open-data-conversion/{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(openDataConversion, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataFood: async (id: string, openDataFood?: OpenDataFood, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateOpenDataFood', 'id', id) + const localVarPath = `/api/open-data-food/{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(openDataFood, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataProperty: async (id: string, openDataProperty?: OpenDataProperty, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateOpenDataProperty', 'id', id) + const localVarPath = `/api/open-data-property/{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(openDataProperty, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataStore: async (id: string, openDataStore?: OpenDataStore, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateOpenDataStore', 'id', id) + const localVarPath = `/api/open-data-store/{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(openDataStore, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataUnit: async (id: string, openDataUnit?: OpenDataUnit, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateOpenDataUnit', 'id', id) + const localVarPath = `/api/open-data-unit/{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(openDataUnit, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataVersion: async (id: string, openDataVersion?: OpenDataVersion, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateOpenDataVersion', 'id', id) + const localVarPath = `/api/open-data-version/{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(openDataVersion, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {string} id A unique integer value identifying this property. @@ -12439,6 +14927,76 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.createMealType(mealType, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createOpenDataCategory(openDataCategory?: OpenDataCategory, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createOpenDataCategory(openDataCategory, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createOpenDataConversion(openDataConversion?: OpenDataConversion, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createOpenDataConversion(openDataConversion, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createOpenDataFood(openDataFood?: OpenDataFood, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createOpenDataFood(openDataFood, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createOpenDataProperty(openDataProperty?: OpenDataProperty, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createOpenDataProperty(openDataProperty, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createOpenDataStore(openDataStore?: OpenDataStore, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createOpenDataStore(openDataStore, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createOpenDataUnit(openDataUnit?: OpenDataUnit, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createOpenDataUnit(openDataUnit, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createOpenDataVersion(openDataVersion?: OpenDataVersion, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createOpenDataVersion(openDataVersion, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {Property} [property] @@ -12774,6 +15332,76 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.destroyMealType(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async destroyOpenDataCategory(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.destroyOpenDataCategory(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async destroyOpenDataConversion(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.destroyOpenDataConversion(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async destroyOpenDataFood(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.destroyOpenDataFood(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async destroyOpenDataProperty(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.destroyOpenDataProperty(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async destroyOpenDataStore(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.destroyOpenDataStore(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async destroyOpenDataUnit(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.destroyOpenDataUnit(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async destroyOpenDataVersion(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.destroyOpenDataVersion(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this property. @@ -12964,6 +15592,17 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.destroyViewLog(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * updates the food with all possible data from the FDC Api (only adds new, does not change existing properties) + * @param {string} id A unique integer value identifying this food. + * @param {Food} [food] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async fdcFood(id: string, food?: Food, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.fdcFood(id, food, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -13129,6 +15768,78 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.listMealTypes(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listOpenDataCategorys(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listOpenDataCategorys(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listOpenDataConversions(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listOpenDataConversions(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listOpenDataFoods(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listOpenDataFoods(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listOpenDataPropertys(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listOpenDataPropertys(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listOpenDataStatisticsViewSets(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listOpenDataStatisticsViewSets(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listOpenDataStores(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listOpenDataStores(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listOpenDataUnits(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listOpenDataUnits(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listOpenDataVersions(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listOpenDataVersions(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {*} [options] Override http request option. @@ -13597,6 +16308,83 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateMealType(id, mealType, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async partialUpdateOpenDataCategory(id: string, openDataCategory?: OpenDataCategory, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateOpenDataCategory(id, openDataCategory, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async partialUpdateOpenDataConversion(id: string, openDataConversion?: OpenDataConversion, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateOpenDataConversion(id, openDataConversion, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async partialUpdateOpenDataFood(id: string, openDataFood?: OpenDataFood, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateOpenDataFood(id, openDataFood, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async partialUpdateOpenDataProperty(id: string, openDataProperty?: OpenDataProperty, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateOpenDataProperty(id, openDataProperty, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async partialUpdateOpenDataStore(id: string, openDataStore?: OpenDataStore, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateOpenDataStore(id, openDataStore, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async partialUpdateOpenDataUnit(id: string, openDataUnit?: OpenDataUnit, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateOpenDataUnit(id, openDataUnit, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async partialUpdateOpenDataVersion(id: string, openDataVersion?: OpenDataVersion, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateOpenDataVersion(id, openDataVersion, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this property. @@ -13914,6 +16702,16 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveExportLog(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveFDCViewSet(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveFDCViewSet(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this food. @@ -14004,6 +16802,76 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveMealType(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveOpenDataCategory(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveOpenDataCategory(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveOpenDataConversion(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveOpenDataConversion(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveOpenDataFood(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveOpenDataFood(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveOpenDataProperty(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveOpenDataProperty(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveOpenDataStore(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveOpenDataStore(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveOpenDataUnit(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveOpenDataUnit(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveOpenDataVersion(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveOpenDataVersion(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this property. @@ -14429,6 +17297,83 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.updateMealType(id, mealType, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateOpenDataCategory(id: string, openDataCategory?: OpenDataCategory, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateOpenDataCategory(id, openDataCategory, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateOpenDataConversion(id: string, openDataConversion?: OpenDataConversion, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateOpenDataConversion(id, openDataConversion, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateOpenDataFood(id: string, openDataFood?: OpenDataFood, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateOpenDataFood(id, openDataFood, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateOpenDataProperty(id: string, openDataProperty?: OpenDataProperty, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateOpenDataProperty(id, openDataProperty, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateOpenDataStore(id: string, openDataStore?: OpenDataStore, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateOpenDataStore(id, openDataStore, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateOpenDataUnit(id: string, openDataUnit?: OpenDataUnit, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateOpenDataUnit(id, openDataUnit, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateOpenDataVersion(id: string, openDataVersion?: OpenDataVersion, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateOpenDataVersion(id, openDataVersion, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this property. @@ -14768,6 +17713,69 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: createMealType(mealType?: MealType, options?: any): AxiosPromise { return localVarFp.createMealType(mealType, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataCategory(openDataCategory?: OpenDataCategory, options?: any): AxiosPromise { + return localVarFp.createOpenDataCategory(openDataCategory, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataConversion(openDataConversion?: OpenDataConversion, options?: any): AxiosPromise { + return localVarFp.createOpenDataConversion(openDataConversion, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataFood(openDataFood?: OpenDataFood, options?: any): AxiosPromise { + return localVarFp.createOpenDataFood(openDataFood, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataProperty(openDataProperty?: OpenDataProperty, options?: any): AxiosPromise { + return localVarFp.createOpenDataProperty(openDataProperty, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataStore(openDataStore?: OpenDataStore, options?: any): AxiosPromise { + return localVarFp.createOpenDataStore(openDataStore, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataUnit(openDataUnit?: OpenDataUnit, options?: any): AxiosPromise { + return localVarFp.createOpenDataUnit(openDataUnit, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createOpenDataVersion(openDataVersion?: OpenDataVersion, options?: any): AxiosPromise { + return localVarFp.createOpenDataVersion(openDataVersion, options).then((request) => request(axios, basePath)); + }, /** * * @param {Property} [property] @@ -15070,6 +18078,69 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: destroyMealType(id: string, options?: any): AxiosPromise { return localVarFp.destroyMealType(id, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataCategory(id: string, options?: any): AxiosPromise { + return localVarFp.destroyOpenDataCategory(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataConversion(id: string, options?: any): AxiosPromise { + return localVarFp.destroyOpenDataConversion(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataFood(id: string, options?: any): AxiosPromise { + return localVarFp.destroyOpenDataFood(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataProperty(id: string, options?: any): AxiosPromise { + return localVarFp.destroyOpenDataProperty(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataStore(id: string, options?: any): AxiosPromise { + return localVarFp.destroyOpenDataStore(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataUnit(id: string, options?: any): AxiosPromise { + return localVarFp.destroyOpenDataUnit(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyOpenDataVersion(id: string, options?: any): AxiosPromise { + return localVarFp.destroyOpenDataVersion(id, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this property. @@ -15241,6 +18312,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: destroyViewLog(id: string, options?: any): AxiosPromise { return localVarFp.destroyViewLog(id, options).then((request) => request(axios, basePath)); }, + /** + * updates the food with all possible data from the FDC Api (only adds new, does not change existing properties) + * @param {string} id A unique integer value identifying this food. + * @param {Food} [food] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fdcFood(id: string, food?: Food, options?: any): AxiosPromise { + return localVarFp.fdcFood(id, food, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -15390,6 +18471,70 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: listMealTypes(options?: any): AxiosPromise> { return localVarFp.listMealTypes(options).then((request) => request(axios, basePath)); }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataCategorys(options?: any): AxiosPromise> { + return localVarFp.listOpenDataCategorys(options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataConversions(options?: any): AxiosPromise> { + return localVarFp.listOpenDataConversions(options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataFoods(options?: any): AxiosPromise> { + return localVarFp.listOpenDataFoods(options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataPropertys(options?: any): AxiosPromise> { + return localVarFp.listOpenDataPropertys(options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataStatisticsViewSets(options?: any): AxiosPromise> { + return localVarFp.listOpenDataStatisticsViewSets(options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataStores(options?: any): AxiosPromise> { + return localVarFp.listOpenDataStores(options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataUnits(options?: any): AxiosPromise> { + return localVarFp.listOpenDataUnits(options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listOpenDataVersions(options?: any): AxiosPromise> { + return localVarFp.listOpenDataVersions(options).then((request) => request(axios, basePath)); + }, /** * * @param {*} [options] Override http request option. @@ -15816,6 +18961,76 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: partialUpdateMealType(id: string, mealType?: MealType, options?: any): AxiosPromise { return localVarFp.partialUpdateMealType(id, mealType, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataCategory(id: string, openDataCategory?: OpenDataCategory, options?: any): AxiosPromise { + return localVarFp.partialUpdateOpenDataCategory(id, openDataCategory, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataConversion(id: string, openDataConversion?: OpenDataConversion, options?: any): AxiosPromise { + return localVarFp.partialUpdateOpenDataConversion(id, openDataConversion, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataFood(id: string, openDataFood?: OpenDataFood, options?: any): AxiosPromise { + return localVarFp.partialUpdateOpenDataFood(id, openDataFood, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataProperty(id: string, openDataProperty?: OpenDataProperty, options?: any): AxiosPromise { + return localVarFp.partialUpdateOpenDataProperty(id, openDataProperty, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataStore(id: string, openDataStore?: OpenDataStore, options?: any): AxiosPromise { + return localVarFp.partialUpdateOpenDataStore(id, openDataStore, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataUnit(id: string, openDataUnit?: OpenDataUnit, options?: any): AxiosPromise { + return localVarFp.partialUpdateOpenDataUnit(id, openDataUnit, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateOpenDataVersion(id: string, openDataVersion?: OpenDataVersion, options?: any): AxiosPromise { + return localVarFp.partialUpdateOpenDataVersion(id, openDataVersion, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this property. @@ -16104,6 +19319,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: retrieveExportLog(id: string, options?: any): AxiosPromise { return localVarFp.retrieveExportLog(id, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveFDCViewSet(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveFDCViewSet(id, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this food. @@ -16185,6 +19409,69 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: retrieveMealType(id: string, options?: any): AxiosPromise { return localVarFp.retrieveMealType(id, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataCategory(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveOpenDataCategory(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataConversion(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveOpenDataConversion(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataFood(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveOpenDataFood(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataProperty(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveOpenDataProperty(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataStore(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveOpenDataStore(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataUnit(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveOpenDataUnit(id, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveOpenDataVersion(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveOpenDataVersion(id, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this property. @@ -16569,6 +19856,76 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: updateMealType(id: string, mealType?: MealType, options?: any): AxiosPromise { return localVarFp.updateMealType(id, mealType, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataCategory(id: string, openDataCategory?: OpenDataCategory, options?: any): AxiosPromise { + return localVarFp.updateOpenDataCategory(id, openDataCategory, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataConversion(id: string, openDataConversion?: OpenDataConversion, options?: any): AxiosPromise { + return localVarFp.updateOpenDataConversion(id, openDataConversion, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataFood(id: string, openDataFood?: OpenDataFood, options?: any): AxiosPromise { + return localVarFp.updateOpenDataFood(id, openDataFood, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataProperty(id: string, openDataProperty?: OpenDataProperty, options?: any): AxiosPromise { + return localVarFp.updateOpenDataProperty(id, openDataProperty, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataStore(id: string, openDataStore?: OpenDataStore, options?: any): AxiosPromise { + return localVarFp.updateOpenDataStore(id, openDataStore, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataUnit(id: string, openDataUnit?: OpenDataUnit, options?: any): AxiosPromise { + return localVarFp.updateOpenDataUnit(id, openDataUnit, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateOpenDataVersion(id: string, openDataVersion?: OpenDataVersion, options?: any): AxiosPromise { + return localVarFp.updateOpenDataVersion(id, openDataVersion, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this property. @@ -16918,6 +20275,83 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).createMealType(mealType, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public createOpenDataCategory(openDataCategory?: OpenDataCategory, options?: any) { + return ApiApiFp(this.configuration).createOpenDataCategory(openDataCategory, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public createOpenDataConversion(openDataConversion?: OpenDataConversion, options?: any) { + return ApiApiFp(this.configuration).createOpenDataConversion(openDataConversion, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public createOpenDataFood(openDataFood?: OpenDataFood, options?: any) { + return ApiApiFp(this.configuration).createOpenDataFood(openDataFood, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public createOpenDataProperty(openDataProperty?: OpenDataProperty, options?: any) { + return ApiApiFp(this.configuration).createOpenDataProperty(openDataProperty, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public createOpenDataStore(openDataStore?: OpenDataStore, options?: any) { + return ApiApiFp(this.configuration).createOpenDataStore(openDataStore, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public createOpenDataUnit(openDataUnit?: OpenDataUnit, options?: any) { + return ApiApiFp(this.configuration).createOpenDataUnit(openDataUnit, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public createOpenDataVersion(openDataVersion?: OpenDataVersion, options?: any) { + return ApiApiFp(this.configuration).createOpenDataVersion(openDataVersion, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {Property} [property] @@ -17286,6 +20720,83 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).destroyMealType(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public destroyOpenDataCategory(id: string, options?: any) { + return ApiApiFp(this.configuration).destroyOpenDataCategory(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public destroyOpenDataConversion(id: string, options?: any) { + return ApiApiFp(this.configuration).destroyOpenDataConversion(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public destroyOpenDataFood(id: string, options?: any) { + return ApiApiFp(this.configuration).destroyOpenDataFood(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public destroyOpenDataProperty(id: string, options?: any) { + return ApiApiFp(this.configuration).destroyOpenDataProperty(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public destroyOpenDataStore(id: string, options?: any) { + return ApiApiFp(this.configuration).destroyOpenDataStore(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public destroyOpenDataUnit(id: string, options?: any) { + return ApiApiFp(this.configuration).destroyOpenDataUnit(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public destroyOpenDataVersion(id: string, options?: any) { + return ApiApiFp(this.configuration).destroyOpenDataVersion(id, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this property. @@ -17495,6 +21006,18 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).destroyViewLog(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * updates the food with all possible data from the FDC Api (only adds new, does not change existing properties) + * @param {string} id A unique integer value identifying this food. + * @param {Food} [food] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public fdcFood(id: string, food?: Food, options?: any) { + return ApiApiFp(this.configuration).fdcFood(id, food, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this recipe. @@ -17676,6 +21199,86 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).listMealTypes(options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listOpenDataCategorys(options?: any) { + return ApiApiFp(this.configuration).listOpenDataCategorys(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listOpenDataConversions(options?: any) { + return ApiApiFp(this.configuration).listOpenDataConversions(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listOpenDataFoods(options?: any) { + return ApiApiFp(this.configuration).listOpenDataFoods(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listOpenDataPropertys(options?: any) { + return ApiApiFp(this.configuration).listOpenDataPropertys(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listOpenDataStatisticsViewSets(options?: any) { + return ApiApiFp(this.configuration).listOpenDataStatisticsViewSets(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listOpenDataStores(options?: any) { + return ApiApiFp(this.configuration).listOpenDataStores(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listOpenDataUnits(options?: any) { + return ApiApiFp(this.configuration).listOpenDataUnits(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listOpenDataVersions(options?: any) { + return ApiApiFp(this.configuration).listOpenDataVersions(options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {*} [options] Override http request option. @@ -18186,6 +21789,90 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).partialUpdateMealType(id, mealType, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public partialUpdateOpenDataCategory(id: string, openDataCategory?: OpenDataCategory, options?: any) { + return ApiApiFp(this.configuration).partialUpdateOpenDataCategory(id, openDataCategory, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public partialUpdateOpenDataConversion(id: string, openDataConversion?: OpenDataConversion, options?: any) { + return ApiApiFp(this.configuration).partialUpdateOpenDataConversion(id, openDataConversion, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public partialUpdateOpenDataFood(id: string, openDataFood?: OpenDataFood, options?: any) { + return ApiApiFp(this.configuration).partialUpdateOpenDataFood(id, openDataFood, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public partialUpdateOpenDataProperty(id: string, openDataProperty?: OpenDataProperty, options?: any) { + return ApiApiFp(this.configuration).partialUpdateOpenDataProperty(id, openDataProperty, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public partialUpdateOpenDataStore(id: string, openDataStore?: OpenDataStore, options?: any) { + return ApiApiFp(this.configuration).partialUpdateOpenDataStore(id, openDataStore, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public partialUpdateOpenDataUnit(id: string, openDataUnit?: OpenDataUnit, options?: any) { + return ApiApiFp(this.configuration).partialUpdateOpenDataUnit(id, openDataUnit, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public partialUpdateOpenDataVersion(id: string, openDataVersion?: OpenDataVersion, options?: any) { + return ApiApiFp(this.configuration).partialUpdateOpenDataVersion(id, openDataVersion, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this property. @@ -18532,6 +22219,17 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).retrieveExportLog(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveFDCViewSet(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveFDCViewSet(id, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this food. @@ -18631,6 +22329,83 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).retrieveMealType(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveOpenDataCategory(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveOpenDataCategory(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveOpenDataConversion(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveOpenDataConversion(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveOpenDataFood(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveOpenDataFood(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveOpenDataProperty(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveOpenDataProperty(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveOpenDataStore(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveOpenDataStore(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveOpenDataUnit(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveOpenDataUnit(id, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveOpenDataVersion(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveOpenDataVersion(id, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this property. @@ -19097,6 +22872,90 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).updateMealType(id, mealType, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this open data category. + * @param {OpenDataCategory} [openDataCategory] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public updateOpenDataCategory(id: string, openDataCategory?: OpenDataCategory, options?: any) { + return ApiApiFp(this.configuration).updateOpenDataCategory(id, openDataCategory, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data conversion. + * @param {OpenDataConversion} [openDataConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public updateOpenDataConversion(id: string, openDataConversion?: OpenDataConversion, options?: any) { + return ApiApiFp(this.configuration).updateOpenDataConversion(id, openDataConversion, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data food. + * @param {OpenDataFood} [openDataFood] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public updateOpenDataFood(id: string, openDataFood?: OpenDataFood, options?: any) { + return ApiApiFp(this.configuration).updateOpenDataFood(id, openDataFood, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data property. + * @param {OpenDataProperty} [openDataProperty] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public updateOpenDataProperty(id: string, openDataProperty?: OpenDataProperty, options?: any) { + return ApiApiFp(this.configuration).updateOpenDataProperty(id, openDataProperty, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data store. + * @param {OpenDataStore} [openDataStore] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public updateOpenDataStore(id: string, openDataStore?: OpenDataStore, options?: any) { + return ApiApiFp(this.configuration).updateOpenDataStore(id, openDataStore, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data unit. + * @param {OpenDataUnit} [openDataUnit] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public updateOpenDataUnit(id: string, openDataUnit?: OpenDataUnit, options?: any) { + return ApiApiFp(this.configuration).updateOpenDataUnit(id, openDataUnit, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} id A unique integer value identifying this open data version. + * @param {OpenDataVersion} [openDataVersion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public updateOpenDataVersion(id: string, openDataVersion?: OpenDataVersion, options?: any) { + return ApiApiFp(this.configuration).updateOpenDataVersion(id, openDataVersion, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this property. From f6ed49b5c4309e3efc79ff27230a667af90e7fc9 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 29 Nov 2023 22:04:23 +0100 Subject: [PATCH 19/40] property editor --- vue/src/apps/TestView/TestView.vue | 82 +++++++++++++++++++++--------- vue/src/components/FoodEditor.vue | 4 +- vue/src/locales/en.json | 2 + vue/src/utils/models.js | 8 ++- 4 files changed, 70 insertions(+), 26 deletions(-) diff --git a/vue/src/apps/TestView/TestView.vue b/vue/src/apps/TestView/TestView.vue index 789a1677..9c7235ad 100644 --- a/vue/src/apps/TestView/TestView.vue +++ b/vue/src/apps/TestView/TestView.vue @@ -8,30 +8,61 @@ {{ $t('Name') }} - {{ pt.name }} - - + FDC + {{ $t('Properties_Food_Amount') }} + {{ $t('Properties_Food_Unit') }} + + + + + {{ pt.unit }} + + + + - {{ f.food.name }} #{{ f.food.id }} - {{ $t('Property') }} / + {{ f.food.name }} + + + + + + + + + + + + + + - - - {{ p.property_type.unit }} ({{ p.property_type.name }}) + + + + + + +
@@ -47,6 +78,7 @@ import axios from "axios"; import BetaWarning from "@/components/BetaWarning.vue"; import {ApiApiFactory} from "@/utils/openapi/api"; import GenericMultiselect from "@/components/GenericMultiselect.vue"; +import GenericModalForm from "@/components/Modals/GenericModalForm.vue"; Vue.use(BootstrapVue) @@ -55,10 +87,10 @@ Vue.use(BootstrapVue) export default { name: "TestView", mixins: [ApiMixin], - components: {GenericMultiselect}, + components: {GenericModalForm, GenericMultiselect}, computed: { foods: function () { - let foods = [] + let foods = {} if (this.recipe !== null && this.property_types !== []) { this.recipe.steps.forEach(s => { s.ingredients.forEach(i => { @@ -70,49 +102,53 @@ export default { i.food.properties.forEach(fp => { food.properties[fp.property_type.id] = {changed: false, property_amount: fp.property_amount, property_type: fp.property_type} }) - foods.push(food) + foods[food.food.id] = food }) }) } return foods + }, + properties: function () { + let properties = {} + this.property_types.forEach(pt => { + properties[pt.id] = pt + }) + return properties } }, data() { return { recipe: null, - property_types: [] + property_types: [], + editing_property_type: null, } }, mounted() { this.$i18n.locale = window.CUSTOM_LOCALE - this.loadData(); + this.loadRecipe(); + this.loadPropertyTypes(); }, methods: { - loadData: function () { + loadRecipe: function () { let apiClient = new ApiApiFactory() apiClient.retrieveRecipe("112").then(result => { this.recipe = result.data }) - - apiClient.listPropertyTypes().then(result => { - this.property_types = result.data - }) }, updateFood: function (food) { let apiClient = new ApiApiFactory() apiClient.partialUpdateFood(food.id, food).then(result => { - //TODO handle properly StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE) }).catch((err) => { StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) }) }, - updatePropertyType: function (pt) { + loadPropertyTypes: function () { let apiClient = new ApiApiFactory() - apiClient.partialUpdatePropertyType(pt.id, pt).then(result => { - //TODO handle properly + apiClient.listPropertyTypes().then(result => { + this.property_types = result.data StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE) }).catch((err) => { StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) @@ -122,7 +158,7 @@ export default { let apiClient = new ApiApiFactory() apiClient.fdcFood(food.id).then(result => { - this.loadData() + this.loadRecipe() StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE) }).catch((err) => { StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) diff --git a/vue/src/components/FoodEditor.vue b/vue/src/components/FoodEditor.vue index 232ae4bc..9b707c40 100644 --- a/vue/src/components/FoodEditor.vue +++ b/vue/src/components/FoodEditor.vue @@ -33,11 +33,11 @@
{{ $t('Properties') }}
- + - + Date: Wed, 29 Nov 2023 10:19:05 +0000 Subject: [PATCH 20/40] Translated using Weblate (Danish) Currently translated at 99.8% (535 of 536 strings) Translation: Tandoor/Recipes Frontend Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/da/ --- vue/src/locales/da.json | 61 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/vue/src/locales/da.json b/vue/src/locales/da.json index 6e09d729..c163445e 100644 --- a/vue/src/locales/da.json +++ b/vue/src/locales/da.json @@ -1,5 +1,5 @@ { - "warning_feature_beta": "Denne funktion er i øjeblikket i BETA (test) stadie. Forvent fejl og fremtidige ændringer (hvor data kan mistes) ved brug af denne funktion.", + "warning_feature_beta": "Denne funktion er i øjeblikket i BETA (test)-stadie. Forvent fejl og fremtidige ændringer (hvor data kan mistes) ved brug af denne funktion.", "err_fetching_resource": "Der opstod en fejl under indlæsning af denne ressource!", "err_creating_resource": "Der opstod en fejl under oprettelsen af denne ressource!", "err_updating_resource": "Der opstod en fejl under opdateringen af denne ressource!", @@ -477,5 +477,62 @@ "Unpin": "Frigør", "PinnedConfirmation": "{recipe} er fastgjort.", "UnpinnedConfirmation": "{recipe} er frigjort.", - "Combine_All_Steps": "Kombiner alle trin til ét felt." + "Combine_All_Steps": "Kombiner alle trin til ét felt.", + "converted_unit": "Konverteret enhed", + "Property": "Egenskab", + "OrderInformation": "Objekter er rangeret fra små til store tal.", + "show_ingredients_table": "Vis ingredienser i en tabel ved siden af trinnets tekst", + "tsp": "teaspoon [tsp] (US, volumen)", + "imperial_fluid_ounce": "imperial fluid ounce [imp fl oz] (UK, volumen)", + "imperial_tsp": "imperial teaspoon [imp tsp] (UK, volumen)", + "open_data_help_text": "Tandoor Open Data projektet tilføjer netværksgenereret data til Tandoor. Dette felt bliver udfyldt automatisk under importering og muliggør fremtidige opdateringer.", + "converted_amount": "Konverteret mængde", + "StartDate": "Startdato", + "EndDate": "Slutdato", + "show_step_ingredients_setting": "Vis ingredienser ved siden af opskrifttrin", + "l": "liter [l] (metrisk, volumen)", + "g": "gram [g] (metrisk, vægt)", + "kg": "kilogram [kg] (metrisk, vægt)", + "ounce": "ounce [oz] (vægt)", + "pound": "pund (vægt)", + "ml": "milliliter [ml] (metrisk, volumen)", + "fluid_ounce": "flydende ounce [fl oz] (US, volumen)", + "pint": "pint [pt] (US, volumen)", + "Back": "Tilbage", + "quart": "quart [qt] (US, volumen)", + "recipe_property_info": "Du kan også tilføje næringsindhold til ingredienser for at udregne indholdet automatisk baseret på din opskrift!", + "per_serving": "per serveringer", + "Open_Data_Slug": "Open Data Slug", + "Open_Data_Import": "Open Data importering", + "Data_Import_Info": "Udbyg dit Space og gør din opskriftsamling bedre ved at importere en netværkskurateret liste af ingredienser, enheder og mere.", + "Update_Existing_Data": "Opdaterer eksisterende data", + "make_now_count": "Oftest manglende ingredienser", + "Welcome": "Velkommen", + "imperial_pint": "imperial pint [imp pt] (UK, volumen)", + "Alignment": "Justering", + "gallon": "gallon [gal] (US, volumen)", + "Never_Unit": "Aldrig enhed", + "FDC_ID": "FDC ID", + "FDC_ID_help": "FDC database ID", + "Use_Metric": "Benyt metriske enheder", + "Learn_More": "Lær mere", + "base_unit": "Basisenhed", + "base_amount": "Basismængde", + "Datatype": "Datatype", + "Number of Objects": "Antal objekter", + "Conversion": "Konversion", + "Properties": "Egenskaber", + "show_step_ingredients_setting_help": "Tilføj ingredienstabel ved siden af opskrifttrin. Tilføjes ved oprettelsen. Kan overskrives under rediger opskrift.", + "show_step_ingredients": "Vis trinnets ingredienser", + "hide_step_ingredients": "Skjul trinnets ingredienser", + "total": "total", + "tbsp": "tablespoon [tbsp] (US, volumen)", + "imperial_quart": "imperial quart [imp qt] (UK, volumen)", + "imperial_gallon": "imperial gal [imp gal] (UK, volumen)", + "imperial_tbsp": "imperial tablespoon [imp tbsp] (UK, volumen)", + "Choose_Category": "Vælg kategori", + "Transpose_Words": "Omstil ord", + "Name_Replace": "Erstat navn", + "Food_Replace": "Erstat ingrediens", + "Unit_Replace": "Erstat enhed" } From 745c045f06624fe725f905840e83375b8be0534d Mon Sep 17 00:00:00 2001 From: smilerz Date: Thu, 30 Nov 2023 16:24:24 -0600 Subject: [PATCH 21/40] truncated long description --- cookbook/helper/recipe_url_import.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index b863e8bd..d1ef1b98 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -163,10 +163,9 @@ def get_from_scraper(scrape, request): if len(recipe_json['steps']) == 0: recipe_json['steps'].append({'instruction': '', 'ingredients': [], }) + recipe_json['description'] = recipe_json['description'][:512] if len(recipe_json['description']) > 256: # split at 256 as long descriptions don't look good on recipe cards recipe_json['steps'][0]['instruction'] = f"*{recipe_json['description']}* \n\n" + recipe_json['steps'][0]['instruction'] - else: - recipe_json['description'] = recipe_json['description'][:512] try: for x in scrape.ingredients(): From 15e7f32001b049cffc43eaabe0a40ed57b7dfdfe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 00:59:26 +0000 Subject: [PATCH 22/40] Bump pytest from 7.3.1 to 7.4.3 Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.3.1 to 7.4.3. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/7.3.1...7.4.3) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b04364d0..0ebb3875 100644 --- a/requirements.txt +++ b/requirements.txt @@ -32,7 +32,7 @@ git+https://github.com/BITSOLVER/django-js-reverse@071e304fd600107bc64bbde6f2491 django-allauth==0.54.0 recipe-scrapers==14.52.0 django-scopes==2.0.0 -pytest==7.3.1 +pytest==7.4.3 pytest-django==4.6.0 django-treebeard==4.7 django-cors-headers==4.2.0 From fe208e984435efdc4922fd8a7591fdfc4c257852 Mon Sep 17 00:00:00 2001 From: Daniel Latzer Date: Sat, 2 Dec 2023 09:42:29 +0100 Subject: [PATCH 23/40] Fix parsing DATABASE_URL with port number --- recipes/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/settings.py b/recipes/settings.py index f966e419..86739628 100644 --- a/recipes/settings.py +++ b/recipes/settings.py @@ -350,7 +350,7 @@ WSGI_APPLICATION = 'recipes.wsgi.application' # Load settings from env files if os.getenv('DATABASE_URL'): match = re.match( - r'(?P\w+):\/\/(?:(?P[\w\d_-]+)(?::(?P[^@]+))?@)?(?P[^:/]+)(?:(?P\d+))?(?:/(?P[\w\d/._-]+))?', + r'(?P\w+):\/\/(?:(?P[\w\d_-]+)(?::(?P[^@]+))?@)?(?P[^:/]+)(?::(?P\d+))?(?:/(?P[\w\d/._-]+))?', os.getenv('DATABASE_URL') ) settings = match.groupdict() From 52e88ddfd3805e5591284c2615b75a5c3a41898f Mon Sep 17 00:00:00 2001 From: Marco Agostino Date: Fri, 1 Dec 2023 10:33:07 +0000 Subject: [PATCH 24/40] Translated using Weblate (Italian) Currently translated at 86.4% (466 of 539 strings) Translation: Tandoor/Recipes Frontend Translate-URL: http://translate.tandoor.dev/projects/tandoor/recipes-frontend/it/ --- vue/src/locales/it.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vue/src/locales/it.json b/vue/src/locales/it.json index 1c2f95b1..7489117b 100644 --- a/vue/src/locales/it.json +++ b/vue/src/locales/it.json @@ -162,7 +162,7 @@ "Unit_Alias": "Alias Unità", "Keyword_Alias": "Alias Parola Chiave", "Table_of_Contents": "Indice dei contenuti", - "warning_feature_beta": "Questa funzione è attualmente in BETA (non è completa). Potrebbero verificarsi delle anomalie e modifiche che in futuro potrebbero bloccare la funzionalità stessa o rimuove i dati correlati a essa.", + "warning_feature_beta": "Questa funzione è attualmente in BETA (non è completa). Potrebbero verificarsi delle anomalie e modifiche che in futuro potrebbero bloccare la funzionalità stessa o rimuove i dati correlati ad essa.", "Shopping_list": "Lista della spesa", "Title": "Titolo", "Create_New_Meal_Type": "Aggiungi nuovo tipo di pasto", @@ -393,7 +393,7 @@ "view_recipe": "Mostra ricetta", "copy_to_new": "Copia in una nuova ricetta", "Pinned": "Fissato", - "App": "App", + "App": "Applicazione", "filter": "Filtro", "explain": "Maggior informazioni", "Website": "Sito web", From be2f759048dc0af454880dafb38cbabef0b1cb15 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 15:22:27 +0100 Subject: [PATCH 25/40] add disabled capabilities to generic multiselect --- vue/src/components/GenericMultiselect.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vue/src/components/GenericMultiselect.vue b/vue/src/components/GenericMultiselect.vue index c19b7f02..f46f3c9b 100644 --- a/vue/src/components/GenericMultiselect.vue +++ b/vue/src/components/GenericMultiselect.vue @@ -20,6 +20,7 @@ @input="selectionChanged" @tag="addNew" @open="selectOpened()" + :disabled="disabled" > @@ -74,6 +75,7 @@ export default { allow_create: { type: Boolean, default: false }, create_placeholder: { type: String, default: "You Forgot to Add a Tag Placeholder" }, clear: { type: Number }, + disabled: {type: Boolean, default: false, }, }, watch: { initial_selection: function (newVal, oldVal) { From 92be2db9fdcc1fdbe0520dc2c1a3d00ffea47737 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 15:35:33 +0100 Subject: [PATCH 26/40] mostly working property editor --- vue/src/apps/TestView/TestView.vue | 48 ++++++++++++++++-------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/vue/src/apps/TestView/TestView.vue b/vue/src/apps/TestView/TestView.vue index 9c7235ad..25a4dd0f 100644 --- a/vue/src/apps/TestView/TestView.vue +++ b/vue/src/apps/TestView/TestView.vue @@ -12,13 +12,9 @@ {{ $t('Properties_Food_Amount') }} {{ $t('Properties_Food_Unit') }} - - - - {{ pt.unit }} - - - + + + {{ pt.name }} ({{ pt.unit }}) @@ -29,26 +25,27 @@ - + - + - + + :multiple="false" + :disabled="loading"/> - + @@ -94,7 +91,7 @@ export default { if (this.recipe !== null && this.property_types !== []) { this.recipe.steps.forEach(s => { s.ingredients.forEach(i => { - let food = {food: i.food, properties: {}} + let food = {food: i.food, properties: {}, loading: false} this.property_types.forEach(pt => { food.properties[pt.id] = {changed: false, property_amount: 0, property_type: pt} @@ -121,6 +118,7 @@ export default { recipe: null, property_types: [], editing_property_type: null, + loading: false, } }, mounted() { @@ -135,6 +133,17 @@ export default { apiClient.retrieveRecipe("112").then(result => { this.recipe = result.data + this.loading = false; + }).catch((err) => { + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err) + }) + }, + loadPropertyTypes: function () { + let apiClient = new ApiApiFactory() + apiClient.listPropertyTypes().then(result => { + this.property_types = result.data + }).catch((err) => { + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err) }) }, updateFood: function (food) { @@ -145,23 +154,16 @@ export default { StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) }) }, - loadPropertyTypes: function () { - let apiClient = new ApiApiFactory() - apiClient.listPropertyTypes().then(result => { - this.property_types = result.data - StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE) - }).catch((err) => { - StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) - }) - }, updateFoodFromFDC: function (food) { + this.loading = true; let apiClient = new ApiApiFactory() apiClient.fdcFood(food.id).then(result => { - this.loadRecipe() StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE) + this.loadRecipe() }).catch((err) => { StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) + this.loading = false; }) } }, From a3a2433d2a13f76567fb8c79d9ecb80bd2ce0b8e Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 16:29:37 +0100 Subject: [PATCH 27/40] made to_date field optional in meal plan api --- cookbook/serializer.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cookbook/serializer.py b/cookbook/serializer.py index e012d330..6e8296cb 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -985,14 +985,26 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer): shared = UserSerializer(many=True, required=False, allow_null=True) shopping = serializers.SerializerMethodField('in_shopping') + to_date = serializers.DateField(required=False) + def get_note_markdown(self, obj): return markdown(obj.note) def in_shopping(self, obj): return ShoppingListRecipe.objects.filter(mealplan=obj.id).exists() + def update(self, instance, validated_data): + if 'to_date' not in validated_data or validated_data['to_date'] is None: + validated_data['to_date'] = validated_data['from_date'] + + return super().update(instance, validated_data) + def create(self, validated_data): validated_data['created_by'] = self.context['request'].user + + if 'to_date' not in validated_data or validated_data['to_date'] is None: + validated_data['to_date'] = validated_data['from_date'] + mealplan = super().create(validated_data) if self.context['request'].data.get('addshopping', False) and self.context['request'].data.get('recipe', None): SLR = RecipeShoppingEditor(user=validated_data['created_by'], space=validated_data['space']) From fe11b88fd03ed0100106f52d3139f0f8fb58a4c6 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 17:41:02 +0100 Subject: [PATCH 28/40] pretty nice property editor --- cookbook/views/api.py | 10 ++- vue/src/apps/TestView/TestView.vue | 131 ++++++++++++++++------------- 2 files changed, 81 insertions(+), 60 deletions(-) diff --git a/cookbook/views/api.py b/cookbook/views/api.py index a35ac1ce..c2f78d72 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -612,10 +612,14 @@ class FoodViewSet(viewsets.ModelViewSet, TreeMixin): data = json.loads(response.content) food_property_list = [] - food_property_types = food.foodproperty_set.values_list('property__property_type_id', flat=True) - for pt in PropertyType.objects.filter(space=request.space).all(): - if pt.fdc_id and pt.id not in food_property_types: + # delete all properties where the property type has a fdc_id as these should be overridden + for fp in food.properties.all(): + if fp.property_type.fdc_id: + fp.delete() + + for pt in PropertyType.objects.filter(space=request.space, fdc_id__gte=0).all(): + if pt.fdc_id: for fn in data['foodNutrients']: if fn['nutrient']['id'] == pt.fdc_id: food_property_list.append(Property( diff --git a/vue/src/apps/TestView/TestView.vue b/vue/src/apps/TestView/TestView.vue index 25a4dd0f..31ec9087 100644 --- a/vue/src/apps/TestView/TestView.vue +++ b/vue/src/apps/TestView/TestView.vue @@ -4,48 +4,46 @@

{{ recipe.name }}

- +
- - + - - - @@ -57,7 +55,7 @@ :model="Models.PROPERTY_TYPE" :action="Actions.UPDATE" :item1="editing_property_type" - @finish-action="editing_property_type = null; loadPropertyTypes()"> + @finish-action="editing_property_type = null; loadData()"> @@ -86,32 +84,7 @@ export default { mixins: [ApiMixin], components: {GenericModalForm, GenericMultiselect}, computed: { - foods: function () { - let foods = {} - if (this.recipe !== null && this.property_types !== []) { - this.recipe.steps.forEach(s => { - s.ingredients.forEach(i => { - let food = {food: i.food, properties: {}, loading: false} - this.property_types.forEach(pt => { - food.properties[pt.id] = {changed: false, property_amount: 0, property_type: pt} - }) - i.food.properties.forEach(fp => { - food.properties[fp.property_type.id] = {changed: false, property_amount: fp.property_amount, property_type: fp.property_type} - }) - foods[food.food.id] = food - }) - }) - } - return foods - }, - properties: function () { - let properties = {} - this.property_types.forEach(pt => { - properties[pt.id] = pt - }) - return properties - } }, data() { return { @@ -119,51 +92,95 @@ export default { property_types: [], editing_property_type: null, loading: false, + foods: [], } }, mounted() { this.$i18n.locale = window.CUSTOM_LOCALE - this.loadRecipe(); - this.loadPropertyTypes(); + this.loadData(); }, methods: { - loadRecipe: function () { + loadData: function () { let apiClient = new ApiApiFactory() - apiClient.retrieveRecipe("112").then(result => { - this.recipe = result.data - this.loading = false; + apiClient.listPropertyTypes().then(result => { + this.property_types = result.data + + apiClient.retrieveRecipe("112").then(result => { //TODO get recipe id + this.recipe = result.data + + this.foods = [] + + this.recipe.steps.forEach(s => { + s.ingredients.forEach(i => { + if (this.foods.filter(x => (x.id === i.food.id)).length === 0) { + this.foods.push(this.buildFood(i.food)) + } + }) + }) + this.loading = false; + }).catch((err) => { + StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err) + }) }).catch((err) => { StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err) }) }, - loadPropertyTypes: function () { - let apiClient = new ApiApiFactory() - apiClient.listPropertyTypes().then(result => { - this.property_types = result.data - }).catch((err) => { - StandardToasts.makeStandardToast(this, StandardToasts.FAIL_FETCH, err) + buildFood: function (food) { + /** + * Prepare food for display in grid by making sure the food properties are in the same order as property_types and that no types are missing + * */ + + let existing_properties = {} + food.properties.forEach(fp => { + existing_properties[fp.property_type.id] = fp }) + + let food_properties = [] + this.property_types.forEach(pt => { + let new_food_property = { + property_type: pt, + property_amount: 0, + } + if (pt.id in existing_properties) { + new_food_property = existing_properties[pt.id] + } + food_properties.push(new_food_property) + }) + + this.$set(food, 'loading', false) + + food.properties = food_properties + + return food + }, + spliceInFood: function (food){ + /** + * replace food in foods list, for example after updates from the server + */ + this.foods = this.foods.map(f => (f.id === food.id) ? food : f) + }, updateFood: function (food) { let apiClient = new ApiApiFactory() apiClient.partialUpdateFood(food.id, food).then(result => { + this.spliceInFood(this.buildFood(result.data)) StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE) }).catch((err) => { StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) }) }, updateFoodFromFDC: function (food) { - this.loading = true; + food.loading = true; let apiClient = new ApiApiFactory() apiClient.fdcFood(food.id).then(result => { StandardToasts.makeStandardToast(this, StandardToasts.SUCCESS_UPDATE) - this.loadRecipe() + this.spliceInFood(this.buildFood(result.data)) }).catch((err) => { StandardToasts.makeStandardToast(this, StandardToasts.FAIL_UPDATE, err) - this.loading = false; + food.loading = false; }) } }, From d1174ea50d2fecb54ad3bed951823742a28b6553 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 17:42:04 +0100 Subject: [PATCH 29/40] fixed api comment --- cookbook/views/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cookbook/views/api.py b/cookbook/views/api.py index c2f78d72..bac4c42a 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -599,7 +599,8 @@ class FoodViewSet(viewsets.ModelViewSet, TreeMixin): @decorators.action(detail=True, methods=['POST'], ) def fdc(self, request, pk): """ - updates the food with all possible data from the FDC Api (only adds new, does not change existing properties) + updates the food with all possible data from the FDC Api + if properties with a fdc_id already exist they will be overridden, if existing properties don't have a fdc_id they won't be changed """ food = self.get_object() From 3e083e21681ab8f3dbd447fa4a2436409757f46b Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 18:02:22 +0100 Subject: [PATCH 30/40] fully integrated property editor --- cookbook/templates/property_editor.html | 31 +++ cookbook/urls.py | 1 + cookbook/views/views.py | 13 +- .../PropertyEditorView/PropertyEditorView.vue | 209 ++++++++++++++++++ vue/src/apps/PropertyEditorView/main.js | 22 ++ vue/src/components/RecipeContextMenu.vue | 3 + vue/src/locales/en.json | 1 + vue/vue.config.js | 6 +- 8 files changed, 281 insertions(+), 5 deletions(-) create mode 100644 cookbook/templates/property_editor.html create mode 100644 vue/src/apps/PropertyEditorView/PropertyEditorView.vue create mode 100644 vue/src/apps/PropertyEditorView/main.js diff --git a/cookbook/templates/property_editor.html b/cookbook/templates/property_editor.html new file mode 100644 index 00000000..f24a133e --- /dev/null +++ b/cookbook/templates/property_editor.html @@ -0,0 +1,31 @@ +{% extends "base.html" %} +{% load render_bundle from webpack_loader %} +{% load static %} +{% load i18n %} +{% load l10n %} + +{% block title %}{% trans 'Property Editor' %}{% endblock %} + +{% block content_fluid %} + +
+ +
+ + +{% endblock %} + + +{% block script %} + {% if debug %} + + {% else %} + + {% endif %} + + + + {% render_bundle 'property_editor_view' %} +{% endblock %} \ No newline at end of file diff --git a/cookbook/urls.py b/cookbook/urls.py index e8be5160..9db5d5de 100644 --- a/cookbook/urls.py +++ b/cookbook/urls.py @@ -91,6 +91,7 @@ urlpatterns = [ path('history/', views.history, name='view_history'), path('supermarket/', views.supermarket, name='view_supermarket'), path('ingredient-editor/', views.ingredient_editor, name='view_ingredient_editor'), + path('property-editor/', views.property_editor, name='view_property_editor'), path('abuse/', views.report_share_abuse, name='view_report_share_abuse'), path('api/import/', api.import_files, name='view_import'), diff --git a/cookbook/views/views.py b/cookbook/views/views.py index 58a610a2..92c55789 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -204,6 +204,11 @@ def ingredient_editor(request): return render(request, 'ingredient_editor.html', template_vars) +@group_required('user') +def property_editor(request, pk): + return render(request, 'property_editor.html', {'recipe_id': pk}) + + @group_required('guest') def shopping_settings(request): if request.space.demo: @@ -220,10 +225,10 @@ def shopping_settings(request): if not sp: sp = SearchPreferenceForm(user=request.user) fields_searched = ( - len(search_form.cleaned_data['icontains']) - + len(search_form.cleaned_data['istartswith']) - + len(search_form.cleaned_data['trigram']) - + len(search_form.cleaned_data['fulltext']) + len(search_form.cleaned_data['icontains']) + + len(search_form.cleaned_data['istartswith']) + + len(search_form.cleaned_data['trigram']) + + len(search_form.cleaned_data['fulltext']) ) if search_form.cleaned_data['preset'] == 'fuzzy': sp.search = SearchPreference.SIMPLE diff --git a/vue/src/apps/PropertyEditorView/PropertyEditorView.vue b/vue/src/apps/PropertyEditorView/PropertyEditorView.vue new file mode 100644 index 00000000..b785fa09 --- /dev/null +++ b/vue/src/apps/PropertyEditorView/PropertyEditorView.vue @@ -0,0 +1,209 @@ + + + + + + diff --git a/vue/src/apps/PropertyEditorView/main.js b/vue/src/apps/PropertyEditorView/main.js new file mode 100644 index 00000000..40e6a309 --- /dev/null +++ b/vue/src/apps/PropertyEditorView/main.js @@ -0,0 +1,22 @@ +import Vue from 'vue' +import App from './PropertyEditorView.vue' +import i18n from '@/i18n' +import {createPinia, PiniaVuePlugin} from "pinia"; + +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 + +Vue.use(PiniaVuePlugin) +const pinia = createPinia() + +new Vue({ + pinia, + i18n, + render: h => h(App), +}).$mount('#app') diff --git a/vue/src/components/RecipeContextMenu.vue b/vue/src/components/RecipeContextMenu.vue index 72db67f4..dee82fda 100644 --- a/vue/src/components/RecipeContextMenu.vue +++ b/vue/src/components/RecipeContextMenu.vue @@ -10,6 +10,9 @@ {{ $t("Edit") }} + + {{ $t("Property_Editor") }} + {{ $t("convert_internal") }} diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index ca8e7d42..0a4dfb09 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -185,6 +185,7 @@ "move_title": "Move {type}", "Food": "Food", "Property": "Property", + "Property_Editor": "Property Editor", "Conversion": "Conversion", "Original_Text": "Original Text", "Recipe_Book": "Recipe Book", diff --git a/vue/vue.config.js b/vue/vue.config.js index cfdd6b38..5b9d42fb 100644 --- a/vue/vue.config.js +++ b/vue/vue.config.js @@ -53,6 +53,10 @@ const pages = { entry: "./src/apps/IngredientEditorView/main.js", chunks: ["chunk-vendors","locales-chunk","api-chunk"], }, + property_editor_view: { + entry: "./src/apps/PropertyEditorView/main.js", + chunks: ["chunk-vendors","locales-chunk","api-chunk"], + }, shopping_list_view: { entry: "./src/apps/ShoppingListView/main.js", chunks: ["chunk-vendors","locales-chunk","api-chunk"], @@ -137,7 +141,7 @@ module.exports = { config.optimization.minimize(true) - //TODO somehow remov them as they are also added to the manifest config of the service worker + //TODO somehow remove them as they are also added to the manifest config of the service worker /* Object.keys(pages).forEach(page => { config.plugins.delete(`html-${page}`); From 3054297357316cf51a2b20e0930e8683fcfc7276 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 18:11:09 +0100 Subject: [PATCH 31/40] improved error handling and fixed meal plan api --- cookbook/serializer.py | 6 ------ cookbook/views/api.py | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/cookbook/serializer.py b/cookbook/serializer.py index 6e8296cb..6a841a31 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -993,12 +993,6 @@ class MealPlanSerializer(SpacedModelSerializer, WritableNestedModelSerializer): def in_shopping(self, obj): return ShoppingListRecipe.objects.filter(mealplan=obj.id).exists() - def update(self, instance, validated_data): - if 'to_date' not in validated_data or validated_data['to_date'] is None: - validated_data['to_date'] = validated_data['from_date'] - - return super().update(instance, validated_data) - def create(self, validated_data): validated_data['created_by'] = self.context['request'].user diff --git a/cookbook/views/api.py b/cookbook/views/api.py index bac4c42a..d97d5f73 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -642,7 +642,7 @@ class FoodViewSet(viewsets.ModelViewSet, TreeMixin): return self.retrieve(request, pk) except Exception as e: traceback.print_exc() - return JsonResponse({'error': f'{e} - check server log'}, status=500, json_dumps_params={'indent': 4}) + return JsonResponse({'msg': f'there was an error parsing the FDC data, please check the server logs'}, status=500, json_dumps_params={'indent': 4}) def destroy(self, *args, **kwargs): try: From 11c8422fbbb95e5dba66a3fc1d6ad4c94b6009b8 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 18:45:34 +0100 Subject: [PATCH 32/40] fixed youtube import and handle resize without ingredients --- cookbook/helper/recipe_url_import.py | 7 ++++--- vue/src/components/RecipeViewComponent.vue | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index d1ef1b98..fbbc23c9 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -258,13 +258,14 @@ def get_from_youtube_scraper(url, request): ] } - # TODO add automation here try: automation_engine = AutomationEngine(request, source=url) - video = YouTube(url=url) + video = YouTube(url) + video.streams.first() # this is required to execute some kind of generator/web request that fetches the description default_recipe_json['name'] = automation_engine.apply_regex_replace_automation(video.title, Automation.NAME_REPLACE) default_recipe_json['image'] = video.thumbnail_url - default_recipe_json['steps'][0]['instruction'] = automation_engine.apply_regex_replace_automation(video.description, Automation.INSTRUCTION_REPLACE) + if video.description: + default_recipe_json['steps'][0]['instruction'] = automation_engine.apply_regex_replace_automation(video.description, Automation.INSTRUCTION_REPLACE) except Exception: pass diff --git a/vue/src/components/RecipeViewComponent.vue b/vue/src/components/RecipeViewComponent.vue index 16e3b611..07a051ad 100644 --- a/vue/src/components/RecipeViewComponent.vue +++ b/vue/src/components/RecipeViewComponent.vue @@ -277,9 +277,7 @@ export default { } }, handleResize: function () { - if (document.getElementById('nutrition_container') !== null) { - this.ingredient_height = document.getElementById('ingredient_container').clientHeight - document.getElementById('nutrition_container').clientHeight - } else { + if (document.getElementById('ingredient_container') !== null) { this.ingredient_height = document.getElementById('ingredient_container').clientHeight } }, From fd978f9c19fbf217f578047cf3722921143e107e Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 18:58:44 +0100 Subject: [PATCH 33/40] fixed copying recipes with properties --- vue/src/components/RecipeContextMenu.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vue/src/components/RecipeContextMenu.vue b/vue/src/components/RecipeContextMenu.vue index dee82fda..bf22a952 100644 --- a/vue/src/components/RecipeContextMenu.vue +++ b/vue/src/components/RecipeContextMenu.vue @@ -263,9 +263,11 @@ export default { }, } }) - if (recipe.nutrition !== null) { - delete recipe.nutrition.id - } + + recipe.properties = recipe.properties.map(p => { + return { ...p, ...{ id: undefined, } } + }) + apiClient .createRecipe(recipe) .then((new_recipe) => { From 0c381ed46ca1d128cbb1c71d3c0f8e6f8f0aac34 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 19:28:34 +0100 Subject: [PATCH 34/40] fixed recipe card description overlay --- vue/src/components/RecipeCard.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vue/src/components/RecipeCard.vue b/vue/src/components/RecipeCard.vue index 7175e9f7..8445be26 100755 --- a/vue/src/components/RecipeCard.vue +++ b/vue/src/components/RecipeCard.vue @@ -250,6 +250,10 @@ export default { opacity: 1; } +.content:hover .card-img-overlay { + opacity: 0; +} + .content-details { position: absolute; text-align: center; From f3e11e6358cada65471edda0abae9b9bdf297c78 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 20:14:12 +0100 Subject: [PATCH 35/40] fixed and improvements to property editor --- cookbook/helper/fdc_helper.py | 19 + cookbook/serializer.py | 2 + .../PropertyEditorView/PropertyEditorView.vue | 11 +- vue/src/locales/en.json | 2 + vue/src/utils/models.js | 331 +++++++++++++++--- 5 files changed, 308 insertions(+), 57 deletions(-) create mode 100644 cookbook/helper/fdc_helper.py diff --git a/cookbook/helper/fdc_helper.py b/cookbook/helper/fdc_helper.py new file mode 100644 index 00000000..09e0f292 --- /dev/null +++ b/cookbook/helper/fdc_helper.py @@ -0,0 +1,19 @@ +import json + + +def get_all_nutrient_types(): + f = open('') # <--- download the foundation food or any other dataset and retrieve all nutrition ID's from it https://fdc.nal.usda.gov/download-datasets.html + json_data = json.loads(f.read()) + + nutrients = {} + for food in json_data['FoundationFoods']: + for entry in food['foodNutrients']: + nutrients[entry['nutrient']['id']] = entry['nutrient']['name'] + + nutrient_ids = list(nutrients.keys()) + nutrient_ids.sort() + for nid in nutrient_ids: + print('{', f'value: {nid}, text: "{nutrients[nid]} ({nid})"', '},') + + +get_all_nutrient_types() diff --git a/cookbook/serializer.py b/cookbook/serializer.py index 6a841a31..ff4e2dfc 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -19,6 +19,7 @@ from oauth2_provider.models import AccessToken from PIL import Image from rest_framework import serializers from rest_framework.exceptions import NotFound, ValidationError +from rest_framework.fields import IntegerField from cookbook.helper.CustomStorageClass import CachedS3Boto3Storage from cookbook.helper.HelperFunctions import str2bool @@ -524,6 +525,7 @@ class SupermarketSerializer(UniqueFieldsMixin, SpacedModelSerializer, OpenDataMo class PropertyTypeSerializer(OpenDataModelMixin, WritableNestedModelSerializer, UniqueFieldsMixin): id = serializers.IntegerField(required=False) + order = IntegerField(default=0, required=False) def create(self, validated_data): validated_data['name'] = validated_data['name'].strip() diff --git a/vue/src/apps/PropertyEditorView/PropertyEditorView.vue b/vue/src/apps/PropertyEditorView/PropertyEditorView.vue index b785fa09..bf413773 100644 --- a/vue/src/apps/PropertyEditorView/PropertyEditorView.vue +++ b/vue/src/apps/PropertyEditorView/PropertyEditorView.vue @@ -15,10 +15,11 @@ -
+
+ {{$t('FDC_Search')}} -
{{ $t('Name') }} FDC {{ $t('Properties_Food_Amount') }} {{ $t('Properties_Food_Unit') }} - - + {{ pt.name }} ({{ pt.unit }})
- {{ f.food.name }} + {{ f.name }} + - + - + - + + + + :disabled="f.loading"/> - +
+
@@ -26,7 +27,11 @@ diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index 0a4dfb09..d775f7c3 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -84,7 +84,9 @@ "Properties_Food_Amount": "Properties Food Amount", "Properties_Food_Unit": "Properties Food Unit", "FDC_ID": "FDC ID", + "FDC_Search": "FDC Search", "FDC_ID_help": "FDC database ID", + "property_type_fdc_hint": "Only property types with an FDC ID can automatically pull data from the FDC database", "Data_Import_Info": "Enhance your Space by importing a community curated list of foods, units and more to improve your recipe collection.", "Update_Existing_Data": "Update Existing Data", "Use_Metric": "Use Metric Units", diff --git a/vue/src/utils/models.js b/vue/src/utils/models.js index 6b18821d..41adb748 100644 --- a/vue/src/utils/models.js +++ b/vue/src/utils/models.js @@ -23,7 +23,7 @@ export class Models { false: undefined, }, }, - tree: { default: undefined }, + tree: {default: undefined}, }, }, delete: { @@ -50,7 +50,7 @@ export class Models { type: "lookup", field: "target", list: "self", - sticky_options: [{ id: 0, name: "tree_root" }], + sticky_options: [{id: 0, name: "tree_root"}], }, }, }, @@ -71,7 +71,7 @@ export class Models { food_onhand: true, shopping: true, }, - tags: [{ field: "supermarket_category", label: "name", color: "info" }], + tags: [{field: "supermarket_category", label: "name", color: "info"}], // REQUIRED: unordered array of fields that can be set during create create: { // if not defined partialUpdate will use the same parameters, prepending 'id' @@ -177,7 +177,7 @@ export class Models { field: "substitute_siblings", label: "substitute_siblings", // form.label always translated in utils.getForm() help_text: "substitute_siblings_help", // form.help_text always translated - condition: { field: "parent", value: true, condition: "field_exists" }, + condition: {field: "parent", value: true, condition: "field_exists"}, }, substitute_children: { form_field: true, @@ -186,7 +186,7 @@ export class Models { field: "substitute_children", label: "substitute_children", help_text: "substitute_children_help", - condition: { field: "numchild", value: 0, condition: "gt" }, + condition: {field: "numchild", value: 0, condition: "gt"}, }, inherit_fields: { form_field: true, @@ -196,7 +196,7 @@ export class Models { field: "inherit_fields", list: "FOOD_INHERIT_FIELDS", label: "InheritFields", - condition: { field: "food_children_exist", value: true, condition: "preference_equals" }, + condition: {field: "food_children_exist", value: true, condition: "preference_equals"}, help_text: "InheritFields_help", }, child_inherit_fields: { @@ -207,7 +207,7 @@ export class Models { field: "child_inherit_fields", list: "FOOD_INHERIT_FIELDS", label: "ChildInheritFields", // form.label always translated in utils.getForm() - condition: { field: "numchild", value: 0, condition: "gt" }, + condition: {field: "numchild", value: 0, condition: "gt"}, help_text: "ChildInheritFields_help", // form.help_text always translated }, reset_inherit: { @@ -217,7 +217,7 @@ export class Models { field: "reset_inherit", label: "reset_children", help_text: "reset_children_help", - condition: { field: "numchild", value: 0, condition: "gt" }, + condition: {field: "numchild", value: 0, condition: "gt"}, }, form_function: "FoodCreateDefault", }, @@ -304,24 +304,24 @@ export class Models { form_field: true, type: "choice", options: [ - { value: "g", text: "g" }, - { value: "kg", text: "kg" }, - { value: "ounce", text: "ounce" }, - { value: "pound", text: "pound" }, - { value: "ml", text: "ml" }, - { value: "l", text: "l" }, - { value: "fluid_ounce", text: "fluid_ounce" }, - { value: "pint", text: "pint" }, - { value: "quart", text: "quart" }, - { value: "gallon", text: "gallon" }, - { value: "tbsp", text: "tbsp" }, - { value: "tsp", text: "tsp" }, - { value: "imperial_fluid_ounce", text: "imperial_fluid_ounce" }, - { value: "imperial_pint", text: "imperial_pint" }, - { value: "imperial_quart", text: "imperial_quart" }, - { value: "imperial_gallon", text: "imperial_gallon" }, - { value: "imperial_tbsp", text: "imperial_tbsp" }, - { value: "imperial_tsp", text: "imperial_tsp" }, + {value: "g", text: "g"}, + {value: "kg", text: "kg"}, + {value: "ounce", text: "ounce"}, + {value: "pound", text: "pound"}, + {value: "ml", text: "ml"}, + {value: "l", text: "l"}, + {value: "fluid_ounce", text: "fluid_ounce"}, + {value: "pint", text: "pint"}, + {value: "quart", text: "quart"}, + {value: "gallon", text: "gallon"}, + {value: "tbsp", text: "tbsp"}, + {value: "tsp", text: "tsp"}, + {value: "imperial_fluid_ounce", text: "imperial_fluid_ounce"}, + {value: "imperial_pint", text: "imperial_pint"}, + {value: "imperial_quart", text: "imperial_quart"}, + {value: "imperial_gallon", text: "imperial_gallon"}, + {value: "imperial_tbsp", text: "imperial_tbsp"}, + {value: "imperial_tsp", text: "imperial_tsp"}, ], field: "base_unit", label: "Base Unit", @@ -457,7 +457,7 @@ export class Models { static SUPERMARKET = { name: "Supermarket", apiName: "Supermarket", - ordered_tags: [{ field: "category_to_supermarket", label: "category::name", color: "info" }], + ordered_tags: [{field: "category_to_supermarket", label: "category::name", color: "info"}], create: { params: [["name", "description", "category_to_supermarket"]], form: { @@ -540,16 +540,16 @@ export class Models { form_field: true, type: "choice", options: [ - { value: "FOOD_ALIAS", text: "Food_Alias" }, - { value: "UNIT_ALIAS", text: "Unit_Alias" }, - { value: "KEYWORD_ALIAS", text: "Keyword_Alias" }, - { value: "NAME_REPLACE", text: "Name_Replace" }, - { value: "DESCRIPTION_REPLACE", text: "Description_Replace" }, - { value: "INSTRUCTION_REPLACE", text: "Instruction_Replace" }, - { value: "FOOD_REPLACE", text: "Food_Replace" }, - { value: "UNIT_REPLACE", text: "Unit_Replace" }, - { value: "NEVER_UNIT", text: "Never_Unit" }, - { value: "TRANSPOSE_WORDS", text: "Transpose_Words" }, + {value: "FOOD_ALIAS", text: "Food_Alias"}, + {value: "UNIT_ALIAS", text: "Unit_Alias"}, + {value: "KEYWORD_ALIAS", text: "Keyword_Alias"}, + {value: "NAME_REPLACE", text: "Name_Replace"}, + {value: "DESCRIPTION_REPLACE", text: "Description_Replace"}, + {value: "INSTRUCTION_REPLACE", text: "Instruction_Replace"}, + {value: "FOOD_REPLACE", text: "Food_Replace"}, + {value: "UNIT_REPLACE", text: "Unit_Replace"}, + {value: "NEVER_UNIT", text: "Never_Unit"}, + {value: "TRANSPOSE_WORDS", text: "Transpose_Words"}, ], field: "type", label: "Type", @@ -700,7 +700,7 @@ export class Models { }, }, create: { - params: [["name", "unit", "description", "order"]], + params: [["name", "unit", "description", "order", "fdc_id"]], form: { show_help: true, name: { @@ -733,17 +733,240 @@ export class Models { field: "order", label: "Order", placeholder: "", - optional: false, + optional: true, help_text: "OrderInformation", }, fdc_id: { form_field: true, type: "choice", options: [ - { value: 1008, text: "Calories (1008)" }, - { value: 1005, text: "Carbohydrates (1005)" }, - { value: 1003, text: "Protein (1003)" }, - { value: 1004, text: "Fat (1004)" }, + {value: 1002, text: "Nitrogen (1002)"}, + {value: 1003, text: "Protein (1003)"}, + {value: 1004, text: "Total lipid (fat) (1004)"}, + {value: 1005, text: "Carbohydrate, by difference (1005)"}, + {value: 1007, text: "Ash (1007)"}, + {value: 1008, text: "Energy (1008)"}, + {value: 1009, text: "Starch (1009)"}, + {value: 1010, text: "Sucrose (1010)"}, + {value: 1011, text: "Glucose (1011)"}, + {value: 1012, text: "Fructose (1012)"}, + {value: 1013, text: "Lactose (1013)"}, + {value: 1014, text: "Maltose (1014)"}, + {value: 1024, text: "Specific Gravity (1024)"}, + {value: 1032, text: "Citric acid (1032)"}, + {value: 1039, text: "Malic acid (1039)"}, + {value: 1041, text: "Oxalic acid (1041)"}, + {value: 1043, text: "Pyruvic acid (1043)"}, + {value: 1044, text: "Quinic acid (1044)"}, + {value: 1050, text: "Carbohydrate, by summation (1050)"}, + {value: 1051, text: "Water (1051)"}, + {value: 1062, text: "Energy (1062)"}, + {value: 1063, text: "Sugars, Total (1063)"}, + {value: 1075, text: "Galactose (1075)"}, + {value: 1076, text: "Raffinose (1076)"}, + {value: 1077, text: "Stachyose (1077)"}, + {value: 1079, text: "Fiber, total dietary (1079)"}, + {value: 1082, text: "Fiber, soluble (1082)"}, + {value: 1084, text: "Fiber, insoluble (1084)"}, + {value: 1085, text: "Total fat (NLEA) (1085)"}, + {value: 1087, text: "Calcium, Ca (1087)"}, + {value: 1089, text: "Iron, Fe (1089)"}, + {value: 1090, text: "Magnesium, Mg (1090)"}, + {value: 1091, text: "Phosphorus, P (1091)"}, + {value: 1092, text: "Potassium, K (1092)"}, + {value: 1093, text: "Sodium, Na (1093)"}, + {value: 1094, text: "Sulfur, S (1094)"}, + {value: 1095, text: "Zinc, Zn (1095)"}, + {value: 1097, text: "Cobalt, Co (1097)"}, + {value: 1098, text: "Copper, Cu (1098)"}, + {value: 1100, text: "Iodine, I (1100)"}, + {value: 1101, text: "Manganese, Mn (1101)"}, + {value: 1102, text: "Molybdenum, Mo (1102)"}, + {value: 1103, text: "Selenium, Se (1103)"}, + {value: 1105, text: "Retinol (1105)"}, + {value: 1106, text: "Vitamin A, RAE (1106)"}, + {value: 1107, text: "Carotene, beta (1107)"}, + {value: 1108, text: "Carotene, alpha (1108)"}, + {value: 1109, text: "Vitamin E (alpha-tocopherol) (1109)"}, + {value: 1110, text: "Vitamin D (D2 + D3), International Units (1110)"}, + {value: 1111, text: "Vitamin D2 (ergocalciferol) (1111)"}, + {value: 1112, text: "Vitamin D3 (cholecalciferol) (1112)"}, + {value: 1113, text: "25-hydroxycholecalciferol (1113)"}, + {value: 1114, text: "Vitamin D (D2 + D3) (1114)"}, + {value: 1116, text: "Phytoene (1116)"}, + {value: 1117, text: "Phytofluene (1117)"}, + {value: 1118, text: "Carotene, gamma (1118)"}, + {value: 1119, text: "Zeaxanthin (1119)"}, + {value: 1120, text: "Cryptoxanthin, beta (1120)"}, + {value: 1121, text: "Lutein (1121)"}, + {value: 1122, text: "Lycopene (1122)"}, + {value: 1123, text: "Lutein + zeaxanthin (1123)"}, + {value: 1125, text: "Tocopherol, beta (1125)"}, + {value: 1126, text: "Tocopherol, gamma (1126)"}, + {value: 1127, text: "Tocopherol, delta (1127)"}, + {value: 1128, text: "Tocotrienol, alpha (1128)"}, + {value: 1129, text: "Tocotrienol, beta (1129)"}, + {value: 1130, text: "Tocotrienol, gamma (1130)"}, + {value: 1131, text: "Tocotrienol, delta (1131)"}, + {value: 1137, text: "Boron, B (1137)"}, + {value: 1146, text: "Nickel, Ni (1146)"}, + {value: 1159, text: "cis-beta-Carotene (1159)"}, + {value: 1160, text: "cis-Lycopene (1160)"}, + {value: 1161, text: "cis-Lutein/Zeaxanthin (1161)"}, + {value: 1162, text: "Vitamin C, total ascorbic acid (1162)"}, + {value: 1165, text: "Thiamin (1165)"}, + {value: 1166, text: "Riboflavin (1166)"}, + {value: 1167, text: "Niacin (1167)"}, + {value: 1170, text: "Pantothenic acid (1170)"}, + {value: 1175, text: "Vitamin B-6 (1175)"}, + {value: 1176, text: "Biotin (1176)"}, + {value: 1177, text: "Folate, total (1177)"}, + {value: 1178, text: "Vitamin B-12 (1178)"}, + {value: 1180, text: "Choline, total (1180)"}, + {value: 1183, text: "Vitamin K (Menaquinone-4) (1183)"}, + {value: 1184, text: "Vitamin K (Dihydrophylloquinone) (1184)"}, + {value: 1185, text: "Vitamin K (phylloquinone) (1185)"}, + {value: 1188, text: "5-methyl tetrahydrofolate (5-MTHF) (1188)"}, + {value: 1191, text: "10-Formyl folic acid (10HCOFA) (1191)"}, + {value: 1192, text: "5-Formyltetrahydrofolic acid (5-HCOH4 (1192)"}, + {value: 1194, text: "Choline, free (1194)"}, + {value: 1195, text: "Choline, from phosphocholine (1195)"}, + {value: 1196, text: "Choline, from phosphotidyl choline (1196)"}, + {value: 1197, text: "Choline, from glycerophosphocholine (1197)"}, + {value: 1198, text: "Betaine (1198)"}, + {value: 1199, text: "Choline, from sphingomyelin (1199)"}, + {value: 1210, text: "Tryptophan (1210)"}, + {value: 1211, text: "Threonine (1211)"}, + {value: 1212, text: "Isoleucine (1212)"}, + {value: 1213, text: "Leucine (1213)"}, + {value: 1214, text: "Lysine (1214)"}, + {value: 1215, text: "Methionine (1215)"}, + {value: 1216, text: "Cystine (1216)"}, + {value: 1217, text: "Phenylalanine (1217)"}, + {value: 1218, text: "Tyrosine (1218)"}, + {value: 1219, text: "Valine (1219)"}, + {value: 1220, text: "Arginine (1220)"}, + {value: 1221, text: "Histidine (1221)"}, + {value: 1222, text: "Alanine (1222)"}, + {value: 1223, text: "Aspartic acid (1223)"}, + {value: 1224, text: "Glutamic acid (1224)"}, + {value: 1225, text: "Glycine (1225)"}, + {value: 1226, text: "Proline (1226)"}, + {value: 1227, text: "Serine (1227)"}, + {value: 1228, text: "Hydroxyproline (1228)"}, + {value: 1232, text: "Cysteine (1232)"}, + {value: 1253, text: "Cholesterol (1253)"}, + {value: 1257, text: "Fatty acids, total trans (1257)"}, + {value: 1258, text: "Fatty acids, total saturated (1258)"}, + {value: 1259, text: "SFA 4:0 (1259)"}, + {value: 1260, text: "SFA 6:0 (1260)"}, + {value: 1261, text: "SFA 8:0 (1261)"}, + {value: 1262, text: "SFA 10:0 (1262)"}, + {value: 1263, text: "SFA 12:0 (1263)"}, + {value: 1264, text: "SFA 14:0 (1264)"}, + {value: 1265, text: "SFA 16:0 (1265)"}, + {value: 1266, text: "SFA 18:0 (1266)"}, + {value: 1267, text: "SFA 20:0 (1267)"}, + {value: 1268, text: "MUFA 18:1 (1268)"}, + {value: 1269, text: "PUFA 18:2 (1269)"}, + {value: 1270, text: "PUFA 18:3 (1270)"}, + {value: 1271, text: "PUFA 20:4 (1271)"}, + {value: 1272, text: "PUFA 22:6 n-3 (DHA) (1272)"}, + {value: 1273, text: "SFA 22:0 (1273)"}, + {value: 1276, text: "PUFA 18:4 (1276)"}, + {value: 1277, text: "MUFA 20:1 (1277)"}, + {value: 1278, text: "PUFA 20:5 n-3 (EPA) (1278)"}, + {value: 1279, text: "MUFA 22:1 (1279)"}, + {value: 1280, text: "PUFA 22:5 n-3 (DPA) (1280)"}, + {value: 1281, text: "TFA 14:1 t (1281)"}, + {value: 1284, text: "Ergosterol (1284)"}, + {value: 1285, text: "Stigmasterol (1285)"}, + {value: 1286, text: "Campesterol (1286)"}, + {value: 1287, text: "Brassicasterol (1287)"}, + {value: 1288, text: "Beta-sitosterol (1288)"}, + {value: 1289, text: "Campestanol (1289)"}, + {value: 1292, text: "Fatty acids, total monounsaturated (1292)"}, + {value: 1293, text: "Fatty acids, total polyunsaturated (1293)"}, + {value: 1294, text: "Beta-sitostanol (1294)"}, + {value: 1296, text: "Delta-5-avenasterol (1296)"}, + {value: 1298, text: "Phytosterols, other (1298)"}, + {value: 1299, text: "SFA 15:0 (1299)"}, + {value: 1300, text: "SFA 17:0 (1300)"}, + {value: 1301, text: "SFA 24:0 (1301)"}, + {value: 1303, text: "TFA 16:1 t (1303)"}, + {value: 1304, text: "TFA 18:1 t (1304)"}, + {value: 1305, text: "TFA 22:1 t (1305)"}, + {value: 1306, text: "TFA 18:2 t not further defined (1306)"}, + {value: 1311, text: "PUFA 18:2 CLAs (1311)"}, + {value: 1312, text: "MUFA 24:1 c (1312)"}, + {value: 1313, text: "PUFA 20:2 n-6 c,c (1313)"}, + {value: 1314, text: "MUFA 16:1 c (1314)"}, + {value: 1315, text: "MUFA 18:1 c (1315)"}, + {value: 1316, text: "PUFA 18:2 n-6 c,c (1316)"}, + {value: 1317, text: "MUFA 22:1 c (1317)"}, + {value: 1321, text: "PUFA 18:3 n-6 c,c,c (1321)"}, + {value: 1323, text: "MUFA 17:1 (1323)"}, + {value: 1325, text: "PUFA 20:3 (1325)"}, + {value: 1329, text: "Fatty acids, total trans-monoenoic (1329)"}, + {value: 1330, text: "Fatty acids, total trans-dienoic (1330)"}, + {value: 1331, text: "Fatty acids, total trans-polyenoic (1331)"}, + {value: 1333, text: "MUFA 15:1 (1333)"}, + {value: 1334, text: "PUFA 22:2 (1334)"}, + {value: 1335, text: "SFA 11:0 (1335)"}, + {value: 1340, text: "Daidzein (1340)"}, + {value: 1341, text: "Genistein (1341)"}, + {value: 1404, text: "PUFA 18:3 n-3 c,c,c (ALA) (1404)"}, + {value: 1405, text: "PUFA 20:3 n-3 (1405)"}, + {value: 1406, text: "PUFA 20:3 n-6 (1406)"}, + {value: 1409, text: "PUFA 18:3i (1409)"}, + {value: 1411, text: "PUFA 22:4 (1411)"}, + {value: 1414, text: "PUFA 20:3 n-9 (1414)"}, + {value: 2000, text: "Sugars, total including NLEA (2000)"}, + {value: 2003, text: "SFA 5:0 (2003)"}, + {value: 2004, text: "SFA 7:0 (2004)"}, + {value: 2005, text: "SFA 9:0 (2005)"}, + {value: 2006, text: "SFA 21:0 (2006)"}, + {value: 2007, text: "SFA 23:0 (2007)"}, + {value: 2008, text: "MUFA 12:1 (2008)"}, + {value: 2009, text: "MUFA 14:1 c (2009)"}, + {value: 2010, text: "MUFA 17:1 c (2010)"}, + {value: 2012, text: "MUFA 20:1 c (2012)"}, + {value: 2013, text: "TFA 20:1 t (2013)"}, + {value: 2014, text: "MUFA 22:1 n-9 (2014)"}, + {value: 2015, text: "MUFA 22:1 n-11 (2015)"}, + {value: 2016, text: "PUFA 18:2 c (2016)"}, + {value: 2017, text: "TFA 18:2 t (2017)"}, + {value: 2018, text: "PUFA 18:3 c (2018)"}, + {value: 2019, text: "TFA 18:3 t (2019)"}, + {value: 2020, text: "PUFA 20:3 c (2020)"}, + {value: 2021, text: "PUFA 22:3 (2021)"}, + {value: 2022, text: "PUFA 20:4c (2022)"}, + {value: 2023, text: "PUFA 20:5c (2023)"}, + {value: 2024, text: "PUFA 22:5 c (2024)"}, + {value: 2025, text: "PUFA 22:6 c (2025)"}, + {value: 2026, text: "PUFA 20:2 c (2026)"}, + {value: 2028, text: "trans-beta-Carotene (2028)"}, + {value: 2029, text: "trans-Lycopene (2029)"}, + {value: 2032, text: "Cryptoxanthin, alpha (2032)"}, + {value: 2033, text: "Total dietary fiber (AOAC 2011.25) (2033)"}, + {value: 2038, text: "High Molecular Weight Dietary Fiber (HMWDF) (2038)"}, + {value: 2047, text: "Energy (Atwater General Factors) (2047)"}, + {value: 2048, text: "Energy (Atwater Specific Factors) (2048)"}, + {value: 2049, text: "Daidzin (2049)"}, + {value: 2050, text: "Genistin (2050)"}, + {value: 2051, text: "Glycitin (2051)"}, + {value: 2052, text: "Delta-7-Stigmastenol (2052)"}, + {value: 2053, text: "Stigmastadiene (2053)"}, + {value: 2057, text: "Ergothioneine (2057)"}, + {value: 2058, text: "Beta-glucan (2058)"}, + {value: 2059, text: "Vitamin D4 (2059)"}, + {value: 2060, text: "Ergosta-7-enol (2060)"}, + {value: 2061, text: " Ergosta-7,22-dienol (2061)"}, + {value: 2062, text: " Ergosta-5,7-dienol (2062)"}, + {value: 2063, text: "Verbascose (2063)"}, + {value: 2065, text: "Low Molecular Weight Dietary Fiber (LMWDF) (2065)"}, + {value: 2066, text: "Vitamin A (2066)"}, + {value: 2069, text: "Glutathione (2069)"} ], field: "fdc_id", label: "FDC_ID", @@ -1026,7 +1249,7 @@ export class Actions { }, ], }, - ok_label: { function: "translate", phrase: "Save" }, + ok_label: {function: "translate", phrase: "Save"}, }, } static UPDATE = { @@ -1061,7 +1284,7 @@ export class Actions { }, ], }, - ok_label: { function: "translate", phrase: "Delete" }, + ok_label: {function: "translate", phrase: "Delete"}, instruction: { form_field: true, type: "instruction", @@ -1088,17 +1311,17 @@ export class Actions { suffix: "s", params: ["query", "page", "pageSize", "options"], config: { - query: { default: undefined }, - page: { default: 1 }, - pageSize: { default: 25 }, + query: {default: undefined}, + page: {default: 1}, + pageSize: {default: 25}, }, } static MERGE = { function: "merge", params: ["source", "target"], config: { - source: { type: "string" }, - target: { type: "string" }, + source: {type: "string"}, + target: {type: "string"}, }, form: { title: { @@ -1113,7 +1336,7 @@ export class Actions { }, ], }, - ok_label: { function: "translate", phrase: "Merge" }, + ok_label: {function: "translate", phrase: "Merge"}, instruction: { form_field: true, type: "instruction", @@ -1147,8 +1370,8 @@ export class Actions { function: "move", params: ["source", "target"], config: { - source: { type: "string" }, - target: { type: "string" }, + source: {type: "string"}, + target: {type: "string"}, }, form: { title: { @@ -1163,7 +1386,7 @@ export class Actions { }, ], }, - ok_label: { function: "translate", phrase: "Move" }, + ok_label: {function: "translate", phrase: "Move"}, instruction: { form_field: true, type: "instruction", From 21653465e08db8f045d1731765ac7e9b7d6afb65 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 20:37:23 +0100 Subject: [PATCH 36/40] show order and add property types from property editor --- cookbook/urls.py | 2 +- .../PropertyEditorView/PropertyEditorView.vue | 19 ++++++++++++++++--- vue/src/components/Modals/NumberInput.vue | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cookbook/urls.py b/cookbook/urls.py index 9db5d5de..db8680e5 100644 --- a/cookbook/urls.py +++ b/cookbook/urls.py @@ -43,7 +43,7 @@ router.register(r'recipe', api.RecipeViewSet) router.register(r'recipe-book', api.RecipeBookViewSet) router.register(r'recipe-book-entry', api.RecipeBookEntryViewSet) router.register(r'unit-conversion', api.UnitConversionViewSet) -router.register(r'food-property-type', api.PropertyTypeViewSet) +router.register(r'food-property-type', api.PropertyTypeViewSet) # TODO rename + regenerate router.register(r'food-property', api.PropertyViewSet) router.register(r'shopping-list', api.ShoppingListViewSet) router.register(r'shopping-list-entry', api.ShoppingListEntryViewSet) diff --git a/vue/src/apps/PropertyEditorView/PropertyEditorView.vue b/vue/src/apps/PropertyEditorView/PropertyEditorView.vue index bf413773..79bce381 100644 --- a/vue/src/apps/PropertyEditorView/PropertyEditorView.vue +++ b/vue/src/apps/PropertyEditorView/PropertyEditorView.vue @@ -19,7 +19,7 @@
{{$t('FDC_Search')}} -
{{ $t('Name') }}{{ $t('Properties_Food_Amount') }} {{ $t('Properties_Food_Unit') }} - {{ pt.name }} ({{ pt.unit }}) + {{ pt.name }} + ({{ pt.unit }})
+ FDC + FDC +
+
@@ -29,10 +29,14 @@ + @@ -40,11 +44,12 @@ - -
{{ $t('Name') }} {{ pt.name }} ({{ pt.unit }})
+ {{ pt.order}} FDC FDC
+ +
{{ f.name }} + + @@ -52,7 +57,7 @@ + + + + @@ -112,6 +124,7 @@ export default { recipe: null, property_types: [], editing_property_type: null, + new_property_type: false, loading: false, foods: [], } diff --git a/vue/src/components/Modals/NumberInput.vue b/vue/src/components/Modals/NumberInput.vue index a86f0b0e..1dad5e62 100644 --- a/vue/src/components/Modals/NumberInput.vue +++ b/vue/src/components/Modals/NumberInput.vue @@ -14,7 +14,7 @@ export default { props: { field: { type: String, default: "You Forgot To Set Field Name" }, label: { type: String, default: "Text Field" }, - value: { type: String, default: "" }, + value: { type: Number, default: 0 }, placeholder: { type: Number, default: 0 }, help: { type: String, default: undefined }, subtitle: { type: String, default: undefined }, From ecffe300628a638a5e6ffd903572b8aa6dbb65f4 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 2 Dec 2023 21:07:11 +0100 Subject: [PATCH 37/40] dont show property warning for 0 values any more --- cookbook/helper/fdc_helper.py | 4 +- .../PropertyEditorView/PropertyEditorView.vue | 2 +- vue/src/components/PropertyViewComponent.vue | 23 +- vue/src/utils/models.js | 454 +++++++++--------- 4 files changed, 244 insertions(+), 239 deletions(-) diff --git a/cookbook/helper/fdc_helper.py b/cookbook/helper/fdc_helper.py index 09e0f292..b09e7bfa 100644 --- a/cookbook/helper/fdc_helper.py +++ b/cookbook/helper/fdc_helper.py @@ -8,12 +8,12 @@ def get_all_nutrient_types(): nutrients = {} for food in json_data['FoundationFoods']: for entry in food['foodNutrients']: - nutrients[entry['nutrient']['id']] = entry['nutrient']['name'] + nutrients[entry['nutrient']['id']] = {'name': entry['nutrient']['name'], 'unit': entry['nutrient']['unitName']} nutrient_ids = list(nutrients.keys()) nutrient_ids.sort() for nid in nutrient_ids: - print('{', f'value: {nid}, text: "{nutrients[nid]} ({nid})"', '},') + print('{', f'value: {nid}, text: "{nutrients[nid]["name"]} [{nutrients[nid]["unit"]}] ({nid})"', '},') get_all_nutrient_types() diff --git a/vue/src/apps/PropertyEditorView/PropertyEditorView.vue b/vue/src/apps/PropertyEditorView/PropertyEditorView.vue index 79bce381..076628c3 100644 --- a/vue/src/apps/PropertyEditorView/PropertyEditorView.vue +++ b/vue/src/apps/PropertyEditorView/PropertyEditorView.vue @@ -29,7 +29,7 @@ {{ pt.name }} ({{ pt.unit }})
- {{ pt.order}} + {{ pt.order}} FDC FDC
diff --git a/vue/src/components/PropertyViewComponent.vue b/vue/src/components/PropertyViewComponent.vue index 7aa8c218..2c566e52 100644 --- a/vue/src/components/PropertyViewComponent.vue +++ b/vue/src/components/PropertyViewComponent.vue @@ -24,7 +24,7 @@ - + @@ -41,14 +41,18 @@ - -
{{ $t('per_serving') }} {{ $t('total') }} - - + + + +
+ +
+ {{ $t('Property_Editor') }} +
@@ -79,7 +83,7 @@