Create the frontend receipes page to use real API
This commit is contained in:
302
insert_real_recipes.sql
Normal file
302
insert_real_recipes.sql
Normal file
@@ -0,0 +1,302 @@
|
||||
-- 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;
|
||||
Reference in New Issue
Block a user