From c4d2cf1610d7aac29d6ee1cb7d7f67ce56a7e8e5 Mon Sep 17 00:00:00 2001 From: Alex Garel Date: Fri, 20 Dec 2024 16:06:02 +0100 Subject: [PATCH 1/2] feat: first beauty taxonomies --- backend/editor/utils.py | 2 +- taxonomy-editor-frontend/src/constants.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/editor/utils.py b/backend/editor/utils.py index d0cc2760..b6ff4edd 100644 --- a/backend/editor/utils.py +++ b/backend/editor/utils.py @@ -18,6 +18,6 @@ def taxonomy_path_in_repository(taxonomy_name): """Helper function to get the path of a taxonomy in the repository""" path = taxonomy_name # hacky for now until we restructure better - if path in ("food_ingredients", "food_categories"): + if path in ("food_ingredients", "food_categories", "beauty_categories", "beauty_labels"): path = path.replace("_", "/") return f"taxonomies/{path}.txt" diff --git a/taxonomy-editor-frontend/src/constants.ts b/taxonomy-editor-frontend/src/constants.ts index 11e483a0..a36d9997 100644 --- a/taxonomy-editor-frontend/src/constants.ts +++ b/taxonomy-editor-frontend/src/constants.ts @@ -50,4 +50,6 @@ export const TAXONOMY_NAMES = [ "States", "Test", "Vitamins", + "Beauty Categories", + "Beauty Labels", ]; From e507ed42fa210e68b3f46e74948a01d8abba9ff9 Mon Sep 17 00:00:00 2001 From: Alex Garel Date: Fri, 20 Dec 2024 16:13:39 +0100 Subject: [PATCH 2/2] feat: added some product taxonomies --- backend/editor/utils.py | 12 +++++++++++- taxonomy-editor-frontend/src/constants.ts | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/editor/utils.py b/backend/editor/utils.py index b6ff4edd..640f6e62 100644 --- a/backend/editor/utils.py +++ b/backend/editor/utils.py @@ -14,10 +14,20 @@ def file_cleanup(filepath): log.warn(f"Taxonomy file {filepath} not found for deletion") +SPLIT_WITH_SLASH = { + "food_ingredients", + "food_categories", + "beauty_categories", + "beauty_labels", + "product_categories", + "product_labels", +} + + def taxonomy_path_in_repository(taxonomy_name): """Helper function to get the path of a taxonomy in the repository""" path = taxonomy_name # hacky for now until we restructure better - if path in ("food_ingredients", "food_categories", "beauty_categories", "beauty_labels"): + if path in SPLIT_WITH_SLASH: path = path.replace("_", "/") return f"taxonomies/{path}.txt" diff --git a/taxonomy-editor-frontend/src/constants.ts b/taxonomy-editor-frontend/src/constants.ts index a36d9997..4e98f9ec 100644 --- a/taxonomy-editor-frontend/src/constants.ts +++ b/taxonomy-editor-frontend/src/constants.ts @@ -52,4 +52,6 @@ export const TAXONOMY_NAMES = [ "Vitamins", "Beauty Categories", "Beauty Labels", + "Product Categories", + "Product Labels", ];