Fix enum mismatch: Update Python enums and seed data to match database uppercase values

- Fixed ProductType enum values from lowercase to uppercase (INGREDIENT, FINISHED_PRODUCT)
- Fixed UnitOfMeasure enum values from lowercase/abbreviated to uppercase (KILOGRAMS, LITERS, etc.)
- Fixed IngredientCategory enum values from lowercase to uppercase (FLOUR, YEAST, etc.)
- Fixed ProductCategory enum values from lowercase to uppercase (BREAD, CROISSANTS, etc.)
- Updated seed data files to use correct uppercase enum values
- Fixed hardcoded enum references throughout the codebase
- This resolves the InvalidTextRepresentationError when inserting inventory data

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Urtzi Alfaro
2025-12-13 16:49:04 +01:00
parent e116ac244c
commit 10c779858a
7 changed files with 1354 additions and 47 deletions

View File

@@ -0,0 +1,181 @@
{
"ingredients": [
{
"id": "10000000-0000-0000-0000-000000000001",
"tenant_id": "80000000-0000-4000-a000-000000000001",
"name": "Harina de Trigo T55 - Enterprise Grade",
"sku": "HAR-T55-ENT-001",
"barcode": null,
"product_type": "INGREDIENT",
"ingredient_category": "FLOUR",
"product_category": "BREAD",
"subcategory": null,
"description": "Premium harina de trigo tipo 55 para uso en todas las ubicaciones",
"brand": "Molinos San José - Enterprise",
"unit_of_measure": "KILOGRAMS",
"package_size": null,
"average_cost": 0.80,
"last_purchase_price": null,
"standard_cost": null,
"low_stock_threshold": 500.0,
"reorder_point": 750.0,
"reorder_quantity": null,
"max_stock_level": null,
"shelf_life_days": null,
"display_life_hours": null,
"best_before_hours": null,
"storage_instructions": null,
"central_baker_product_code": null,
"delivery_days": null,
"minimum_order_quantity": null,
"pack_size": null,
"is_active": true,
"is_perishable": false,
"allergen_info": [
"gluten"
],
"nutritional_info": null,
"produced_locally": false,
"recipe_id": null,
"created_at": "2025-01-15T06:00:00Z",
"updated_at": "2025-01-15T06:00:00Z",
"created_by": "d2e3f4a5-b6c7-48d9-e0f1-a2b3c4d5e6f7",
"enterprise_shared": true,
"shared_locations": ["Madrid Centro", "Barcelona Gràcia", "Valencia Ruzafa"]
},
{
"id": "10000000-0000-0000-0000-000000000002",
"tenant_id": "80000000-0000-4000-a000-000000000001",
"name": "Mantequilla Francesa AOP - Enterprise",
"sku": "MAN-FRA-ENT-001",
"barcode": null,
"product_type": "INGREDIENT",
"ingredient_category": "DAIRY",
"product_category": "PASTRY",
"subcategory": null,
"description": "Mantequilla francesa AOP para uso en croissants y pastelería fina",
"brand": "Lescure - Enterprise",
"unit_of_measure": "KILOGRAMS",
"package_size": null,
"average_cost": 4.20,
"last_purchase_price": null,
"standard_cost": null,
"low_stock_threshold": 200.0,
"reorder_point": 300.0,
"reorder_quantity": null,
"max_stock_level": null,
"shelf_life_days": null,
"display_life_hours": null,
"best_before_hours": null,
"storage_instructions": null,
"central_baker_product_code": null,
"delivery_days": null,
"minimum_order_quantity": null,
"pack_size": null,
"is_active": true,
"is_perishable": true,
"allergen_info": [
"milk"
],
"nutritional_info": null,
"produced_locally": false,
"recipe_id": null,
"created_at": "2025-01-15T06:00:00Z",
"updated_at": "2025-01-15T06:00:00Z",
"created_by": "d2e3f4a5-b6c7-48d9-e0f1-a2b3c4d5e6f7",
"enterprise_shared": true,
"shared_locations": ["Madrid Centro", "Barcelona Gràcia", "Valencia Ruzafa"]
},
{
"id": "20000000-0000-0000-0000-000000000001",
"tenant_id": "80000000-0000-4000-a000-000000000001",
"name": "Baguette Premium - Enterprise Standard",
"sku": "BAG-PRE-ENT-001",
"barcode": null,
"product_type": "FINISHED_PRODUCT",
"ingredient_category": null,
"product_category": "BREAD",
"subcategory": "FRENCH",
"description": "Baguette premium estándar para todas las ubicaciones enterprise",
"brand": "Panadería Central",
"unit_of_measure": "UNITS",
"package_size": null,
"average_cost": 1.80,
"last_purchase_price": null,
"standard_cost": null,
"low_stock_threshold": 100.0,
"reorder_point": 150.0,
"reorder_quantity": null,
"max_stock_level": null,
"shelf_life_days": 1,
"display_life_hours": 24,
"best_before_hours": 12,
"storage_instructions": null,
"central_baker_product_code": null,
"delivery_days": null,
"minimum_order_quantity": null,
"pack_size": null,
"is_active": true,
"is_perishable": true,
"allergen_info": [
"gluten",
"may_contain_sesame"
],
"nutritional_info": null,
"produced_locally": true,
"recipe_id": "30000000-0000-0000-0000-000000000001",
"created_at": "2025-01-15T06:00:00Z",
"updated_at": "2025-01-15T06:00:00Z",
"created_by": "d2e3f4a5-b6c7-48d9-e0f1-a2b3c4d5e6f7",
"enterprise_shared": true,
"shared_locations": ["Madrid Centro", "Barcelona Gràcia", "Valencia Ruzafa"]
}
],
"stock": [
{
"id": "10000000-0000-0000-0000-000000001001",
"tenant_id": "80000000-0000-4000-a000-000000000001",
"ingredient_id": "10000000-0000-0000-0000-000000000001",
"quantity": 850.0,
"location": "Central Warehouse - Madrid",
"production_stage": "RAW_MATERIAL",
"quality_status": "APPROVED",
"expiration_date": "2025-07-15T00:00:00Z",
"supplier_id": "40000000-0000-0000-0000-000000000001",
"batch_number": "ENT-HAR-20250115-001",
"created_at": "2025-01-15T06:00:00Z",
"updated_at": "2025-01-15T06:00:00Z",
"enterprise_shared": true
},
{
"id": "10000000-0000-0000-0000-000000001002",
"tenant_id": "80000000-0000-4000-a000-000000000001",
"ingredient_id": "10000000-0000-0000-0000-000000000002",
"quantity": 280.0,
"location": "Central Warehouse - Madrid",
"production_stage": "RAW_MATERIAL",
"quality_status": "APPROVED",
"expiration_date": "2025-02-15T00:00:00Z",
"supplier_id": "40000000-0000-0000-0000-000000000002",
"batch_number": "ENT-MAN-20250115-001",
"created_at": "2025-01-15T06:00:00Z",
"updated_at": "2025-01-15T06:00:00Z",
"enterprise_shared": true
},
{
"id": "20000000-0000-0000-0000-000000001001",
"tenant_id": "80000000-0000-4000-a000-000000000001",
"ingredient_id": "20000000-0000-0000-0000-000000000001",
"quantity": 120.0,
"location": "Central Warehouse - Madrid",
"production_stage": "FINISHED_PRODUCT",
"quality_status": "APPROVED",
"expiration_date": "2025-01-16T06:00:00Z",
"supplier_id": null,
"batch_number": "ENT-BAG-20250115-001",
"created_at": "2025-01-15T06:00:00Z",
"updated_at": "2025-01-15T06:00:00Z",
"enterprise_shared": true
}
]
}

File diff suppressed because it is too large Load Diff