From 29065f533749c398b16c76145b8d4251c135c86f Mon Sep 17 00:00:00 2001 From: Urtzi Alfaro Date: Sun, 21 Sep 2025 11:57:03 +0200 Subject: [PATCH] Improve the production frontend 3 --- add_real_recipes.sh | 142 -------- add_sample_recipes.sh | 145 --------- frontend/src/locales/es/auth.json | 6 + .../app/settings/profile/ProfilePage.tsx | 7 + insert_real_recipes.sql | 302 ------------------ services/tenant/app/api/tenants.py | 1 - 6 files changed, 13 insertions(+), 590 deletions(-) delete mode 100755 add_real_recipes.sh delete mode 100755 add_sample_recipes.sh delete mode 100644 insert_real_recipes.sql diff --git a/add_real_recipes.sh b/add_real_recipes.sh deleted file mode 100755 index 4f7412b5..00000000 --- a/add_real_recipes.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash - -# Add real recipes using actual inventory data -TENANT_ID="c464fb3e-7af2-46e6-9e43-85318f34199a" -USER_ID="550e8400-e29b-41d4-a716-446655440000" # User UUID format -API_BASE="http://localhost:8009" - -echo "🧁 Adding real recipes with actual inventory data..." -echo "📍 Tenant ID: $TENANT_ID" -echo "🌐 API Base: $API_BASE" -echo "=" | tr -d '\n' && printf '%.0s=' {1..50} && echo - -# Real finished product IDs from inventory -CROISSANT_ID="c9a049b7-d1ae-4bf5-99cc-ed2c46f0a509" -NAPOLITANA_ID="72c1020f-64be-4b42-8857-e774908204d9" -PALMERA_ID="9e888a05-9dda-488b-a06c-0c60a4479e67" -PAN_TOSTADO_ID="368fba0e-8ec5-4048-a2f1-79b63f9e11cf" - -# Real ingredient IDs from inventory -HARINA_TRIGO_ID="1e1d496f-c041-4f42-82a9-2ae7837c9231" # Harina de Trigo -LEVADURA_ID="de2f0852-75f5-4b18-8f0e-7c707f79a9f9" # Levadura Fresca -MANTEQUILLA_ID="89e6224a-a055-4148-a2f1-86a5091becec" # Mantequilla - -# Recipe 1: Croissant de Mantequilla -echo "Creating Recipe 1: Croissant de Mantequilla..." -curl -X POST "$API_BASE/api/v1/recipes/" \ - -H "Content-Type: application/json" \ - -H "x-tenant-id: $TENANT_ID" \ - -H "x-user-id: $USER_ID" \ - -d '{ - "name": "Croissant de Mantequilla", - "recipe_code": "CRO001", - "finished_product_id": "'$CROISSANT_ID'", - "description": "Croissant clĂĄsico francĂ©s con mantequilla, hojaldrado perfecto y textura crujiente", - "category": "pastry", - "difficulty_level": 3, - "yield_quantity": 12, - "yield_unit": "units", - "prep_time_minutes": 240, - "cook_time_minutes": 18, - "total_time_minutes": 258, - "is_signature_item": true, - "target_margin_percentage": 65.0, - "ingredients": [ - {"ingredient_id": "'$HARINA_TRIGO_ID'", "quantity": 500, "unit": "g", "is_optional": false, "ingredient_order": 1}, - {"ingredient_id": "'$MANTEQUILLA_ID'", "quantity": 300, "unit": "g", "is_optional": false, "ingredient_order": 2}, - {"ingredient_id": "'$LEVADURA_ID'", "quantity": 12, "unit": "g", "is_optional": false, "ingredient_order": 3} - ] - }' - -echo -e "\n\n" - -# Recipe 2: Napolitana de Chocolate -echo "Creating Recipe 2: Napolitana de Chocolate..." -curl -X POST "$API_BASE/api/v1/recipes/" \ - -H "Content-Type: application/json" \ - -H "x-tenant-id: $TENANT_ID" \ - -H "x-user-id: $USER_ID" \ - -d '{ - "name": "Napolitana de Chocolate", - "recipe_code": "NAP001", - "finished_product_id": "'$NAPOLITANA_ID'", - "description": "Hojaldre relleno de chocolate, dulce y crujiente, perfecto para merienda", - "category": "pastry", - "difficulty_level": 2, - "yield_quantity": 8, - "yield_unit": "units", - "prep_time_minutes": 45, - "cook_time_minutes": 20, - "total_time_minutes": 65, - "is_signature_item": false, - "target_margin_percentage": 70.0, - "ingredients": [ - {"ingredient_id": "'$HARINA_TRIGO_ID'", "quantity": 300, "unit": "g", "is_optional": false, "ingredient_order": 1}, - {"ingredient_id": "'$MANTEQUILLA_ID'", "quantity": 200, "unit": "g", "is_optional": false, "ingredient_order": 2} - ] - }' - -echo -e "\n\n" - -# Recipe 3: Palmera de AzĂșcar -echo "Creating Recipe 3: Palmera de AzĂșcar..." -curl -X POST "$API_BASE/api/v1/recipes/" \ - -H "Content-Type: application/json" \ - -H "x-tenant-id: $TENANT_ID" \ - -H "x-user-id: $USER_ID" \ - -d '{ - "name": "Palmera de AzĂșcar", - "recipe_code": "PAL001", - "finished_product_id": "'$PALMERA_ID'", - "description": "Palmera de hojaldre con azĂșcar caramelizado, dulce y crujiente", - "category": "pastry", - "difficulty_level": 2, - "yield_quantity": 10, - "yield_unit": "units", - "prep_time_minutes": 30, - "cook_time_minutes": 15, - "total_time_minutes": 45, - "is_signature_item": false, - "target_margin_percentage": 75.0, - "ingredients": [ - {"ingredient_id": "'$HARINA_TRIGO_ID'", "quantity": 400, "unit": "g", "is_optional": false, "ingredient_order": 1}, - {"ingredient_id": "'$MANTEQUILLA_ID'", "quantity": 150, "unit": "g", "is_optional": false, "ingredient_order": 2} - ] - }' - -echo -e "\n\n" - -# Recipe 4: Pan Tostado Artesanal -echo "Creating Recipe 4: Pan Tostado Artesanal..." -curl -X POST "$API_BASE/api/v1/recipes/" \ - -H "Content-Type: application/json" \ - -H "x-tenant-id: $TENANT_ID" \ - -H "x-user-id: $USER_ID" \ - -d '{ - "name": "Pan Tostado Artesanal", - "recipe_code": "PAN001", - "finished_product_id": "'$PAN_TOSTADO_ID'", - "description": "Pan artesanal con corteza crujiente y miga tierna, perfecto para tostadas", - "category": "bread", - "difficulty_level": 2, - "yield_quantity": 2, - "yield_unit": "units", - "prep_time_minutes": 180, - "cook_time_minutes": 35, - "total_time_minutes": 215, - "is_signature_item": true, - "target_margin_percentage": 60.0, - "ingredients": [ - {"ingredient_id": "'$HARINA_TRIGO_ID'", "quantity": 600, "unit": "g", "is_optional": false, "ingredient_order": 1}, - {"ingredient_id": "'$LEVADURA_ID'", "quantity": 15, "unit": "g", "is_optional": false, "ingredient_order": 2} - ] - }' - -echo -e "\n\n🎉 Real recipes creation completed!" -echo "✅ Created recipes for existing products:" -echo " ‱ Croissant de Mantequilla" -echo " ‱ Napolitana de Chocolate" -echo " ‱ Palmera de AzĂșcar" -echo " ‱ Pan Tostado Artesanal" -echo "" -echo "🔗 All recipes are linked to real products and ingredients from inventory!" \ No newline at end of file diff --git a/add_sample_recipes.sh b/add_sample_recipes.sh deleted file mode 100755 index 4e83d64c..00000000 --- a/add_sample_recipes.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/bash - -# Add sample recipes using the API -TENANT_ID="c464fb3e-7af2-46e6-9e43-85318f34199a" -API_BASE="http://localhost:8009" - -echo "🧁 Adding sample recipes via API..." -echo "📍 Tenant ID: $TENANT_ID" -echo "🌐 API Base: $API_BASE" -echo "=" | tr -d '\n' && printf '%.0s=' {1..50} && echo - -# Sample finished product IDs (these should exist in your system) -PRODUCT_ID_1="550e8400-e29b-41d4-a716-446655440001" -PRODUCT_ID_2="550e8400-e29b-41d4-a716-446655440002" -PRODUCT_ID_3="550e8400-e29b-41d4-a716-446655440003" -PRODUCT_ID_4="550e8400-e29b-41d4-a716-446655440004" - -# Sample ingredient IDs (these should exist in your system) -ING_ID_1="660e8400-e29b-41d4-a716-446655440001" # Harina integral -ING_ID_2="660e8400-e29b-41d4-a716-446655440002" # Agua -ING_ID_3="660e8400-e29b-41d4-a716-446655440003" # Levadura -ING_ID_4="660e8400-e29b-41d4-a716-446655440004" # Sal -ING_ID_5="660e8400-e29b-41d4-a716-446655440005" # Harina de fuerza -ING_ID_6="660e8400-e29b-41d4-a716-446655440006" # Mantequilla -ING_ID_7="660e8400-e29b-41d4-a716-446655440007" # Leche -ING_ID_8="660e8400-e29b-41d4-a716-446655440008" # AzĂșcar -ING_ID_9="660e8400-e29b-41d4-a716-446655440009" # Manzanas -ING_ID_10="660e8400-e29b-41d4-a716-446655440010" # Huevos -ING_ID_11="660e8400-e29b-41d4-a716-446655440011" # LimĂłn - -# Recipe 1: Pan de Molde Integral -echo "Creating Recipe 1: Pan de Molde Integral..." -curl -X POST "$API_BASE/api/v1/recipes/" \ - -H "Content-Type: application/json" \ - -H "x-tenant-id: $TENANT_ID" \ - -d '{ - "name": "Pan de Molde Integral", - "recipe_code": "PAN001", - "finished_product_id": "'$PRODUCT_ID_1'", - "description": "Pan integral artesanal con semillas, perfecto para desayunos saludables.", - "category": "bread", - "difficulty_level": 2, - "yield_quantity": 1, - "yield_unit": "units", - "prep_time_minutes": 120, - "cook_time_minutes": 35, - "total_time_minutes": 155, - "is_signature_item": false, - "target_margin_percentage": 40.0, - "ingredients": [ - {"ingredient_id": "'$ING_ID_1'", "quantity": 500, "unit": "g", "is_optional": false, "ingredient_order": 1}, - {"ingredient_id": "'$ING_ID_2'", "quantity": 300, "unit": "ml", "is_optional": false, "ingredient_order": 2}, - {"ingredient_id": "'$ING_ID_3'", "quantity": 10, "unit": "g", "is_optional": false, "ingredient_order": 3}, - {"ingredient_id": "'$ING_ID_4'", "quantity": 8, "unit": "g", "is_optional": false, "ingredient_order": 4} - ] - }' - -echo -e "\n\n" - -# Recipe 2: Croissants de Mantequilla -echo "Creating Recipe 2: Croissants de Mantequilla..." -curl -X POST "$API_BASE/api/v1/recipes/" \ - -H "Content-Type: application/json" \ - -H "x-tenant-id: $TENANT_ID" \ - -d '{ - "name": "Croissants de Mantequilla", - "recipe_code": "CRO001", - "finished_product_id": "'$PRODUCT_ID_2'", - "description": "Croissants franceses tradicionales con laminado de mantequilla.", - "category": "pastry", - "difficulty_level": 3, - "yield_quantity": 12, - "yield_unit": "units", - "prep_time_minutes": 480, - "cook_time_minutes": 20, - "total_time_minutes": 500, - "is_signature_item": true, - "target_margin_percentage": 52.8, - "ingredients": [ - {"ingredient_id": "'$ING_ID_5'", "quantity": 500, "unit": "g", "is_optional": false, "ingredient_order": 1}, - {"ingredient_id": "'$ING_ID_6'", "quantity": 250, "unit": "g", "is_optional": false, "ingredient_order": 2}, - {"ingredient_id": "'$ING_ID_7'", "quantity": 150, "unit": "ml", "is_optional": false, "ingredient_order": 3}, - {"ingredient_id": "'$ING_ID_8'", "quantity": 50, "unit": "g", "is_optional": false, "ingredient_order": 4} - ] - }' - -echo -e "\n\n" - -# Recipe 3: Tarta de Manzana -echo "Creating Recipe 3: Tarta de Manzana..." -curl -X POST "$API_BASE/api/v1/recipes/" \ - -H "Content-Type: application/json" \ - -H "x-tenant-id: $TENANT_ID" \ - -d '{ - "name": "Tarta de Manzana", - "recipe_code": "TAR001", - "finished_product_id": "'$PRODUCT_ID_3'", - "description": "Tarta casera de manzana con canela y masa quebrada.", - "category": "cake", - "difficulty_level": 1, - "yield_quantity": 8, - "yield_unit": "portions", - "prep_time_minutes": 45, - "cook_time_minutes": 40, - "total_time_minutes": 85, - "is_signature_item": false, - "target_margin_percentage": 65.0, - "ingredients": [ - {"ingredient_id": "'$ING_ID_9'", "quantity": 1000, "unit": "g", "is_optional": false, "ingredient_order": 1}, - {"ingredient_id": "'$ING_ID_1'", "quantity": 250, "unit": "g", "is_optional": false, "ingredient_order": 2}, - {"ingredient_id": "'$ING_ID_6'", "quantity": 125, "unit": "g", "is_optional": false, "ingredient_order": 3}, - {"ingredient_id": "'$ING_ID_8'", "quantity": 100, "unit": "g", "is_optional": false, "ingredient_order": 4} - ] - }' - -echo -e "\n\n" - -# Recipe 4: Magdalenas de LimĂłn -echo "Creating Recipe 4: Magdalenas de LimĂłn..." -curl -X POST "$API_BASE/api/v1/recipes/" \ - -H "Content-Type: application/json" \ - -H "x-tenant-id: $TENANT_ID" \ - -d '{ - "name": "Magdalenas de LimĂłn", - "recipe_code": "MAG001", - "finished_product_id": "'$PRODUCT_ID_4'", - "description": "Magdalenas suaves y esponjosas con ralladura de limĂłn.", - "category": "pastry", - "difficulty_level": 1, - "yield_quantity": 12, - "yield_unit": "units", - "prep_time_minutes": 20, - "cook_time_minutes": 25, - "total_time_minutes": 45, - "is_signature_item": false, - "target_margin_percentage": 57.8, - "ingredients": [ - {"ingredient_id": "'$ING_ID_1'", "quantity": 200, "unit": "g", "is_optional": false, "ingredient_order": 1}, - {"ingredient_id": "'$ING_ID_10'", "quantity": 3, "unit": "units", "is_optional": false, "ingredient_order": 2}, - {"ingredient_id": "'$ING_ID_8'", "quantity": 150, "unit": "g", "is_optional": false, "ingredient_order": 3}, - {"ingredient_id": "'$ING_ID_11'", "quantity": 2, "unit": "units", "is_optional": false, "ingredient_order": 4} - ] - }' - -echo -e "\n\n🎉 Sample recipes creation completed!" \ No newline at end of file diff --git a/frontend/src/locales/es/auth.json b/frontend/src/locales/es/auth.json index 71fcd6bc..eefc9821 100644 --- a/frontend/src/locales/es/auth.json +++ b/frontend/src/locales/es/auth.json @@ -145,6 +145,12 @@ "cashier": "Cajero", "assistant": "Asistente" }, + "global_roles": { + "user": "Usuario", + "admin": "Administrador", + "manager": "Gestor", + "super_admin": "Super Administrador" + }, "permissions": { "read": "Lectura", "write": "Escritura", diff --git a/frontend/src/pages/app/settings/profile/ProfilePage.tsx b/frontend/src/pages/app/settings/profile/ProfilePage.tsx index 55836f5e..cfb8a35e 100644 --- a/frontend/src/pages/app/settings/profile/ProfilePage.tsx +++ b/frontend/src/pages/app/settings/profile/ProfilePage.tsx @@ -7,6 +7,7 @@ import { useCurrentTenant } from '../../../../stores'; import { useToast } from '../../../../hooks/ui/useToast'; import { useAuthProfile, useUpdateProfile, useChangePassword } from '../../../../api/hooks/auth'; import { subscriptionService, type UsageSummary, type AvailablePlans } from '../../../../api'; +import { useTranslation } from 'react-i18next'; interface ProfileFormData { first_name: string; @@ -78,6 +79,7 @@ interface NotificationPreferences { const ProfilePage: React.FC = () => { const user = useAuthUser(); + const { t } = useTranslation('auth'); const { addToast } = useToast(); const { data: profile, isLoading: profileLoading, error: profileError } = useAuthProfile(); @@ -596,6 +598,11 @@ const ProfilePage: React.FC = () => { {profileData.first_name} {profileData.last_name}

{profileData.email}

+ {user?.role && ( +

+ {t(`global_roles.${user.role}`)} +

+ )}
En lĂ­nea diff --git a/insert_real_recipes.sql b/insert_real_recipes.sql deleted file mode 100644 index 40cbc896..00000000 --- a/insert_real_recipes.sql +++ /dev/null @@ -1,302 +0,0 @@ --- Insert real recipes using actual inventory data --- Tenant ID: c464fb3e-7af2-46e6-9e43-85318f34199a --- User email for created_by: fsdfsdfs@sdfsdf.com - --- Real finished product IDs from inventory: --- Croissant: c9a049b7-d1ae-4bf5-99cc-ed2c46f0a509 --- Napolitana: 72c1020f-64be-4b42-8857-e774908204d9 --- Palmera: 9e888a05-9dda-488b-a06c-0c60a4479e67 --- Pan Tostado: 368fba0e-8ec5-4048-a2f1-79b63f9e11cf - --- Real ingredient IDs from inventory: --- Harina de Trigo: 1e1d496f-c041-4f42-82a9-2ae7837c9231 --- Levadura Fresca: de2f0852-75f5-4b18-8f0e-7c707f79a9f9 --- Mantequilla: 89e6224a-a055-4148-a2f1-86a5091becec - -BEGIN; - --- Recipe 1: Croissant de Mantequilla -INSERT INTO recipes ( - id, tenant_id, name, recipe_code, version, finished_product_id, - description, category, difficulty_level, yield_quantity, yield_unit, - prep_time_minutes, cook_time_minutes, total_time_minutes, - estimated_cost_per_unit, target_margin_percentage, suggested_selling_price, - batch_size_multiplier, status, is_signature_item, is_seasonal, - created_at, updated_at, created_by -) VALUES ( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - 'Croissant de Mantequilla', - 'CRO001', - '1.0', - 'c9a049b7-d1ae-4bf5-99cc-ed2c46f0a509', - 'Croissant clĂĄsico francĂ©s con mantequilla, hojaldrado perfecto y textura crujiente', - 'pastry', - 3, - 12, - 'UNITS', - 240, - 18, - 258, - 1.25, - 65.0, - 3.38, - 1.0, - 'ACTIVE', - true, - false, - NOW(), - NOW(), - NULL -); - --- Get the recipe ID for ingredients -INSERT INTO recipe_ingredients ( - id, tenant_id, recipe_id, ingredient_id, quantity, unit, - is_optional, ingredient_order -) VALUES --- Harina de Trigo -( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - (SELECT id FROM recipes WHERE recipe_code = 'CRO001' AND tenant_id = 'c464fb3e-7af2-46e6-9e43-85318f34199a'), - '1e1d496f-c041-4f42-82a9-2ae7837c9231', - 0.5, - 'KILOGRAMS', - false, - 1 -), --- Mantequilla -( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - (SELECT id FROM recipes WHERE recipe_code = 'CRO001' AND tenant_id = 'c464fb3e-7af2-46e6-9e43-85318f34199a'), - '89e6224a-a055-4148-a2f1-86a5091becec', - 0.3, - 'KILOGRAMS', - false, - 2 -), --- Levadura Fresca -( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - (SELECT id FROM recipes WHERE recipe_code = 'CRO001' AND tenant_id = 'c464fb3e-7af2-46e6-9e43-85318f34199a'), - 'de2f0852-75f5-4b18-8f0e-7c707f79a9f9', - 0.012, - 'KILOGRAMS', - false, - 3 -); - --- Recipe 2: Napolitana de Chocolate -INSERT INTO recipes ( - id, tenant_id, name, recipe_code, version, finished_product_id, - description, category, difficulty_level, yield_quantity, yield_unit, - prep_time_minutes, cook_time_minutes, total_time_minutes, - estimated_cost_per_unit, target_margin_percentage, suggested_selling_price, - batch_size_multiplier, status, is_signature_item, is_seasonal, - created_at, updated_at, created_by -) VALUES ( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - 'Napolitana de Chocolate', - 'NAP001', - '1.0', - '72c1020f-64be-4b42-8857-e774908204d9', - 'Hojaldre relleno de chocolate, dulce y crujiente, perfecto para merienda', - 'pastry', - 2, - 8, - 'UNITS', - 45, - 20, - 65, - 2.00, - 70.0, - 6.67, - 1.0, - 'ACTIVE', - false, - false, - NOW(), - NOW(), - NULL -); - --- Ingredients for Napolitana -INSERT INTO recipe_ingredients ( - id, tenant_id, recipe_id, ingredient_id, quantity, unit, - is_optional, ingredient_order -) VALUES --- Harina de Trigo -( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - (SELECT id FROM recipes WHERE recipe_code = 'NAP001' AND tenant_id = 'c464fb3e-7af2-46e6-9e43-85318f34199a'), - '1e1d496f-c041-4f42-82a9-2ae7837c9231', - 0.3, - 'KILOGRAMS', - false, - 1 -), --- Mantequilla -( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - (SELECT id FROM recipes WHERE recipe_code = 'NAP001' AND tenant_id = 'c464fb3e-7af2-46e6-9e43-85318f34199a'), - '89e6224a-a055-4148-a2f1-86a5091becec', - 0.2, - 'KILOGRAMS', - false, - 2 -); - --- Recipe 3: Palmera de AzĂșcar -INSERT INTO recipes ( - id, tenant_id, name, recipe_code, version, finished_product_id, - description, category, difficulty_level, yield_quantity, yield_unit, - prep_time_minutes, cook_time_minutes, total_time_minutes, - estimated_cost_per_unit, target_margin_percentage, suggested_selling_price, - batch_size_multiplier, status, is_signature_item, is_seasonal, - created_at, updated_at, created_by -) VALUES ( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - 'Palmera de AzĂșcar', - 'PAL001', - '1.0', - '9e888a05-9dda-488b-a06c-0c60a4479e67', - 'Palmera de hojaldre con azĂșcar caramelizado, dulce y crujiente', - 'pastry', - 2, - 10, - 'UNITS', - 30, - 15, - 45, - 1.80, - 75.0, - 7.20, - 1.0, - 'ACTIVE', - false, - false, - NOW(), - NOW(), - NULL -); - --- Ingredients for Palmera -INSERT INTO recipe_ingredients ( - id, tenant_id, recipe_id, ingredient_id, quantity, unit, - is_optional, ingredient_order -) VALUES --- Harina de Trigo -( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - (SELECT id FROM recipes WHERE recipe_code = 'PAL001' AND tenant_id = 'c464fb3e-7af2-46e6-9e43-85318f34199a'), - '1e1d496f-c041-4f42-82a9-2ae7837c9231', - 0.4, - 'KILOGRAMS', - false, - 1 -), --- Mantequilla -( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - (SELECT id FROM recipes WHERE recipe_code = 'PAL001' AND tenant_id = 'c464fb3e-7af2-46e6-9e43-85318f34199a'), - '89e6224a-a055-4148-a2f1-86a5091becec', - 0.15, - 'KILOGRAMS', - false, - 2 -); - --- Recipe 4: Pan Tostado Artesanal -INSERT INTO recipes ( - id, tenant_id, name, recipe_code, version, finished_product_id, - description, category, difficulty_level, yield_quantity, yield_unit, - prep_time_minutes, cook_time_minutes, total_time_minutes, - estimated_cost_per_unit, target_margin_percentage, suggested_selling_price, - batch_size_multiplier, status, is_signature_item, is_seasonal, - created_at, updated_at, created_by -) VALUES ( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - 'Pan Tostado Artesanal', - 'PAN001', - '1.0', - '368fba0e-8ec5-4048-a2f1-79b63f9e11cf', - 'Pan artesanal con corteza crujiente y miga tierna, perfecto para tostadas', - 'bread', - 2, - 2, - 'UNITS', - 180, - 35, - 215, - 3.50, - 60.0, - 9.33, - 1.0, - 'ACTIVE', - true, - false, - NOW(), - NOW(), - NULL -); - --- Ingredients for Pan Tostado -INSERT INTO recipe_ingredients ( - id, tenant_id, recipe_id, ingredient_id, quantity, unit, - is_optional, ingredient_order -) VALUES --- Harina de Trigo -( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - (SELECT id FROM recipes WHERE recipe_code = 'PAN001' AND tenant_id = 'c464fb3e-7af2-46e6-9e43-85318f34199a'), - '1e1d496f-c041-4f42-82a9-2ae7837c9231', - 0.6, - 'KILOGRAMS', - false, - 1 -), --- Levadura Fresca -( - gen_random_uuid(), - 'c464fb3e-7af2-46e6-9e43-85318f34199a', - (SELECT id FROM recipes WHERE recipe_code = 'PAN001' AND tenant_id = 'c464fb3e-7af2-46e6-9e43-85318f34199a'), - 'de2f0852-75f5-4b18-8f0e-7c707f79a9f9', - 0.015, - 'KILOGRAMS', - false, - 2 -); - -COMMIT; - --- Verify the data was inserted -SELECT - r.name, - r.recipe_code, - r.category, - r.difficulty_level, - r.yield_quantity, - r.yield_unit, - r.total_time_minutes, - r.estimated_cost_per_unit, - r.suggested_selling_price, - r.is_signature_item, - COUNT(ri.id) as ingredient_count -FROM recipes r -LEFT JOIN recipe_ingredients ri ON r.id = ri.recipe_id -WHERE r.tenant_id = 'c464fb3e-7af2-46e6-9e43-85318f34199a' -GROUP BY r.id, r.name, r.recipe_code, r.category, r.difficulty_level, - r.yield_quantity, r.yield_unit, r.total_time_minutes, - r.estimated_cost_per_unit, r.suggested_selling_price, r.is_signature_item -ORDER BY r.created_at DESC; \ No newline at end of file diff --git a/services/tenant/app/api/tenants.py b/services/tenant/app/api/tenants.py index dc4831bb..3d66f01e 100644 --- a/services/tenant/app/api/tenants.py +++ b/services/tenant/app/api/tenants.py @@ -235,7 +235,6 @@ async def get_nearby_tenants_enhanced( return tenants @router.put("/tenants/{tenant_id}", response_model=TenantResponse) -@track_endpoint_metrics("tenant_update") async def update_tenant_enhanced( update_data: TenantUpdate, tenant_id: UUID = Path(..., description="Tenant ID"),