Files
bakery-ia/add_sample_recipes.sh

145 lines
5.9 KiB
Bash
Raw Normal View History

#!/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!"