Files
bakery-ia/shared/database/README.md
2025-09-17 16:06:30 +02:00

123 lines
3.7 KiB
Markdown

# Database Demo Data
This directory contains comprehensive demo data for the bakery inventory system.
## Files
### `demo_inventory_data.sql`
Complete demo dataset that creates a realistic bakery inventory scenario. This file includes:
**Demo Configuration:**
- Tenant ID: `c464fb3e-7af2-46e6-9e43-85318f34199a`
- Demo User: `demo@panaderiasanpablo.com`
- Bakery: "Panadería San Pablo - Demo"
**What's Included:**
1. **Raw Ingredients (16 items):**
- Flours (Wheat, Whole wheat)
- Yeasts (Fresh, Dry active)
- Fats (Butter, Olive oil)
- Dairy & Eggs (Milk, Fresh eggs)
- Sugars (White, Brown)
- Seasonings (Salt, Chocolate, Vanilla, Cinnamon)
- Nuts & Fruits (Walnuts, Raisins)
2. **Finished Products (8 items):**
- Croissants (with par-baked and fully-baked stages)
- Breads (Whole wheat, Toasted)
- Pastries (Napolitanas, Palmeras, Magdalenas)
- Other products (Empanadas, Coffee with milk)
3. **Stock Lots with Diverse Scenarios:**
- **Good Stock**: Normal levels, fresh products
- **Low Stock**: Below threshold items (Yeast, Butter, Coffee)
- **Critical Stock**: Items needing immediate attention
- **Out of Stock**: Completely sold out (Napolitanas)
- **Expired Stock**: Items past expiration date (Some eggs)
- **Expires Soon**: Items expiring today/tomorrow (Milk, some croissants)
- **Overstock**: Items with excess inventory (Sugar, Salt)
4. **Production Stages:**
- `raw_ingredient`: Base materials
- `par_baked`: Semi-finished products from central bakery
- `fully_baked`: Ready-to-sell products
5. **Stock Movements History:**
- **Purchases**: Raw material deliveries
- **Production Use**: Materials consumed in production
- **Transformations**: Par-baked to fully-baked conversions
- **Sales**: Customer purchases
- **Waste**: Expired/damaged products
- **Reservations**: Items reserved for specific orders
## Usage
### Run the Demo Data Script
```sql
-- Connect to your PostgreSQL database
\i shared/database/demo_inventory_data.sql
```
### Expected Results
The script will create:
- **24 ingredients** (16 raw + 8 finished products)
- **25+ stock lots** with different scenarios
- **15+ stock movements** showing transaction history
- **Summary reports** showing inventory status
### Demo Scenarios Included
1. **Critical Alerts Testing:**
- Expired eggs (past expiration date)
- Low stock yeast (below 1.0kg threshold)
- Milk expiring today
- Out of stock napolitanas
2. **Production Workflow:**
- Par-baked croissants ready for final baking
- Fresh products baked this morning
- Reserved stock for afternoon production
3. **Sales Patterns:**
- Popular items sold out (napolitanas)
- Steady sales of bread and pastries
- Morning rush reflected in stock levels
4. **Inventory Management:**
- Multiple batches with different expiration dates
- FIFO rotation scenarios
- Waste tracking for expired items
## Customization
To modify the demo for different scenarios, edit the variables at the top of `demo_inventory_data.sql`:
```sql
-- Demo Configuration Variables
demo_tenant_id UUID := 'your-tenant-id'::UUID;
demo_user_email VARCHAR := 'your-demo-email@domain.com';
demo_bakery_name VARCHAR := 'Your Bakery Name';
```
## Testing Scenarios
The demo data is designed to test all major inventory features:
- ✅ Stock level calculations
- ✅ Expiration date tracking
- ✅ Low stock alerts
- ✅ Out of stock handling
- ✅ Multi-batch inventory
- ✅ Production stage tracking
- ✅ Movement history
- ✅ Waste management
- ✅ Reserved stock
- ✅ Cost calculations
- ✅ Storage location tracking
- ✅ Quality status monitoring
Perfect for demos, development, and testing!