Initial commit
This commit is contained in:
@@ -0,0 +1,400 @@
|
||||
# Seed Data Reference
|
||||
|
||||
This document details all data that gets seeded when you run the seed data operations.
|
||||
|
||||
## Two Types of Seeding
|
||||
|
||||
### 1. System Data Seeding
|
||||
**Access:** Platform Management > Seed Data > "Seed System Data" button
|
||||
|
||||
Seeds platform-wide data needed for the application to function.
|
||||
|
||||
### 2. Company Data Seeding
|
||||
**Access:** Platform Management > Seed Data > "Seed Data" button (for specific company)
|
||||
|
||||
Seeds demo/test data for a specific company.
|
||||
|
||||
---
|
||||
|
||||
## System Data (Seed System Data)
|
||||
|
||||
### Roles (6 roles)
|
||||
- **SuperAdmin** - Platform-wide access
|
||||
- **Administrator** - Company administrator
|
||||
- **Manager** - Operations manager
|
||||
- **Employee** - Can create/edit jobs and quotes
|
||||
- **ShopFloor** - Can update job status
|
||||
- **ReadOnly** - View-only access
|
||||
|
||||
### Default Company (1 company)
|
||||
- **Company Name:** Demo Company
|
||||
- **Company Code:** DEMO
|
||||
- **Plan:** Enterprise
|
||||
- **Location:** Demo City, CA 90210
|
||||
|
||||
### SuperAdmin Users (2 users)
|
||||
1. **SuperAdmin 1**
|
||||
- Email: `superadmin@powdercoating.com`
|
||||
- Password: `SuperAdmin123!`
|
||||
- Role: SuperAdmin
|
||||
|
||||
2. **SuperAdmin 2 (Admin)**
|
||||
- Email: `admin@powdercoating.com`
|
||||
- Password: `Admin123!`
|
||||
- Role: SuperAdmin
|
||||
|
||||
---
|
||||
|
||||
## Company Data (Seed Company Data)
|
||||
|
||||
When you seed data for a company, the following gets created:
|
||||
|
||||
### 1. Lookup Tables
|
||||
|
||||
#### Job Statuses (16 statuses)
|
||||
Complete workflow from creation to delivery:
|
||||
1. **Pending** - Awaiting approval
|
||||
2. **Quoted** - Quote generated
|
||||
3. **Approved** - Ready to start
|
||||
4. **In Preparation** - Job prep
|
||||
5. **Sandblasting** - Surface prep
|
||||
6. **Masking/Taping** - Masking areas
|
||||
7. **Cleaning** - Pre-coat cleaning
|
||||
8. **In Oven** - Pre-heating
|
||||
9. **Coating** - Applying powder
|
||||
10. **Curing** - Heat curing
|
||||
11. **Quality Check** - Inspection
|
||||
12. **Completed** - Work finished
|
||||
13. **Ready for Pickup** - Awaiting customer
|
||||
14. **Delivered** - Job delivered
|
||||
15. **On Hold** - Paused
|
||||
16. **Cancelled** - Cancelled
|
||||
|
||||
#### Job Priorities (5 priorities)
|
||||
- **Low** - No rush
|
||||
- **Normal** - Standard priority (default)
|
||||
- **High** - Expedited
|
||||
- **Urgent** - Rush job
|
||||
- **Rush** - Highest priority
|
||||
|
||||
#### Quote Statuses (7 statuses)
|
||||
- **Draft** - Being prepared
|
||||
- **Pending** - Sent to customer
|
||||
- **Accepted** - Customer approved
|
||||
- **Rejected** - Customer declined
|
||||
- **Expired** - Past validity date
|
||||
- **Revised** - Being updated
|
||||
- **Converted** - Converted to job
|
||||
|
||||
#### Inventory Categories (5 categories)
|
||||
- **POWDER** - Powder coating materials
|
||||
- **CLEANER** - Cleaning supplies
|
||||
- **MASKING** - Masking materials
|
||||
- **CONSUMABLE** - General consumables
|
||||
- **CHEMICAL** - Chemicals and treatments
|
||||
|
||||
#### Appointment Statuses (6 statuses)
|
||||
- **Scheduled** - Appointment set
|
||||
- **Confirmed** - Customer confirmed
|
||||
- **In Progress** - Currently happening
|
||||
- **Completed** - Finished
|
||||
- **Cancelled** - Cancelled
|
||||
- **No Show** - Customer didn't show
|
||||
|
||||
#### Appointment Types (6 types)
|
||||
- **Estimate** - Quote/estimate appointment
|
||||
- **Pickup** - Customer pickup
|
||||
- **Delivery** - Delivery appointment
|
||||
- **Consultation** - Sales consultation
|
||||
- **Inspection** - Quality inspection
|
||||
- **Follow Up** - Follow-up meeting
|
||||
|
||||
### 2. Inventory Items (10 items)
|
||||
|
||||
#### Powder Coatings (8 powders)
|
||||
1. **Matte Black** (RAL 9005) - 500 lbs
|
||||
2. **Gloss White** (RAL 9010) - 400 lbs
|
||||
3. **Gloss Red** (RAL 3020) - 150 lbs
|
||||
4. **Metallic Blue** (RAL 5002) - 200 lbs
|
||||
5. **Textured Gray** (RAL 7037) - 300 lbs
|
||||
6. **Safety Yellow** (RAL 1003) - 125 lbs
|
||||
7. **Pure Orange** (RAL 2004) - 100 lbs
|
||||
8. **Forest Green** (RAL 6009) - 175 lbs
|
||||
|
||||
Each powder includes:
|
||||
- SKU (prefixed with company code)
|
||||
- Color code (RAL standard)
|
||||
- Finish type (Matte, Gloss, Metallic, Textured)
|
||||
- Manufacturer (Tiger Drylac or Axalta)
|
||||
- Quantity on hand
|
||||
- Reorder points
|
||||
- Cost information
|
||||
- Coverage specs (30 sq ft/lb)
|
||||
- Transfer efficiency (65%)
|
||||
|
||||
#### Consumables (2 items)
|
||||
1. **Pre-Treatment Cleaner** - 50 gallons
|
||||
2. **High-Temp Masking Tape** - 200 rolls
|
||||
|
||||
### 3. Company Operating Costs (1 record)
|
||||
|
||||
Default rates for pricing calculations:
|
||||
- **Labor Rate:** $25.00/hour
|
||||
- **Oven Operating Cost:** $15.00/hour
|
||||
- **Sandblaster Cost:** $12.00/hour
|
||||
- **Coating Booth Cost:** $10.00/hour
|
||||
- **Powder Coating Cost:** $0.85/sq ft
|
||||
- **General Markup:** 30%
|
||||
- **Rush Charge:** 25% (percentage-based)
|
||||
- **Tax Rate:** 7.5%
|
||||
|
||||
### 4. Pricing Tiers (4 tiers)
|
||||
|
||||
Volume discount tiers:
|
||||
- **Standard** - 0% discount (default)
|
||||
- **Silver** - 5% discount
|
||||
- **Gold** - 10% discount
|
||||
- **Platinum** - 15% discount
|
||||
|
||||
### 5. Customers (25 customers)
|
||||
|
||||
#### Commercial Customers (15 customers)
|
||||
Full-featured B2B customers with:
|
||||
- Company names (e.g., "Acme Manufacturing Corp")
|
||||
- Contact information
|
||||
- Tax IDs
|
||||
- Credit limits ($15,000 - $75,000)
|
||||
- Current balances
|
||||
- Payment terms (Net 15, Net 30, Net 60)
|
||||
- Assigned pricing tiers
|
||||
- Industry notes
|
||||
|
||||
**Industries represented:**
|
||||
- Manufacturing
|
||||
- Automotive parts
|
||||
- Railings & gates
|
||||
- Fitness equipment
|
||||
- Transit authority
|
||||
- Wheel restoration
|
||||
- Furniture manufacturing
|
||||
- Motorsports
|
||||
- Green energy
|
||||
- Architectural metalwork
|
||||
- Marine equipment
|
||||
- HVAC systems
|
||||
- Playground equipment
|
||||
- Office furniture
|
||||
- Agricultural equipment
|
||||
|
||||
#### Individual Customers (10 customers)
|
||||
Consumer/hobbyist customers:
|
||||
- Personal names (e.g., "James Thompson")
|
||||
- Email and phone
|
||||
- "Due on receipt" payment terms
|
||||
- Project notes (classic cars, patio furniture, motorcycles, etc.)
|
||||
|
||||
### 6. Equipment (5 equipment records)
|
||||
|
||||
Shop equipment with maintenance tracking:
|
||||
1. **Batch Powder Coating Oven**
|
||||
- Manufacturer: Nordson
|
||||
- Model: Batch-2000
|
||||
- Capacity: Large
|
||||
- Purchase: $45,000
|
||||
- Status: Operational
|
||||
- Last service: 60 days ago
|
||||
|
||||
2. **Sandblasting Cabinet**
|
||||
- Manufacturer: Empire Abrasive
|
||||
- Model: SB-900
|
||||
- Capacity: Medium
|
||||
- Purchase: $12,500
|
||||
- Status: Operational
|
||||
- Last service: 30 days ago
|
||||
|
||||
3. **Powder Coating Gun #1**
|
||||
- Manufacturer: Wagner
|
||||
- Model: GM-7000
|
||||
- Capacity: Small
|
||||
- Purchase: $3,200
|
||||
- Status: Operational
|
||||
- Last service: 15 days ago
|
||||
|
||||
4. **Air Compressor**
|
||||
- Manufacturer: Quincy
|
||||
- Model: QT-10
|
||||
- Capacity: Large
|
||||
- Purchase: $8,500
|
||||
- Status: Operational
|
||||
- Last service: 90 days ago
|
||||
|
||||
5. **Conveyor System**
|
||||
- Manufacturer: Midwest Automation
|
||||
- Model: CV-500
|
||||
- Capacity: Large
|
||||
- Purchase: $28,000
|
||||
- Status: Needs Maintenance
|
||||
- Scheduled maintenance due
|
||||
|
||||
### 7. Catalog Items (varies)
|
||||
|
||||
Product catalog for standard items. Includes:
|
||||
- Categories (hierarchical structure)
|
||||
- Items with default pricing
|
||||
- Default service flags (sandblasting, masking)
|
||||
- Estimated time per item
|
||||
|
||||
**Note:** Catalog seeding varies by implementation.
|
||||
|
||||
### 8. Quotes (sample quotes)
|
||||
|
||||
Demo quotes showing:
|
||||
- Quote numbers
|
||||
- Customer references
|
||||
- Line items with pricing
|
||||
- Status workflow examples
|
||||
- Validity dates
|
||||
|
||||
### 9. Jobs (sample jobs)
|
||||
|
||||
Demo jobs demonstrating:
|
||||
- Job numbers
|
||||
- Customer assignments
|
||||
- Status progression
|
||||
- Priority levels
|
||||
- Job items and pricing
|
||||
- Date tracking
|
||||
|
||||
### 10. Appointments (sample appointments)
|
||||
|
||||
Demo appointments showing:
|
||||
- Appointment types in use
|
||||
- Scheduling examples
|
||||
- Customer associations
|
||||
- Status tracking
|
||||
|
||||
### 11. Demo Company Users (DEMO company only)
|
||||
|
||||
**Only created for company code "DEMO":**
|
||||
|
||||
1. **Company Admin**
|
||||
- Email: `admin@demo.com`
|
||||
- Password: `CompanyAdmin123!`
|
||||
- Role: Administrator
|
||||
- Department: Management
|
||||
- Full permissions
|
||||
|
||||
2. **Manager**
|
||||
- Email: `manager@demo.com`
|
||||
- Password: `Manager123!`
|
||||
- Role: Manager
|
||||
- Department: Operations
|
||||
- Most permissions (cannot approve quotes)
|
||||
|
||||
---
|
||||
|
||||
## Idempotent Seeding
|
||||
|
||||
The seeding process is **idempotent** - it checks if data already exists and skips it:
|
||||
|
||||
### Duplicate Detection
|
||||
- **Customers:** Checked by email address
|
||||
- **Inventory:** Checked by SKU
|
||||
- **Lookups:** Checked by count (if 16 job statuses exist, skip)
|
||||
- **Operating Costs:** Checked by company ID
|
||||
- **Pricing Tiers:** Checked by company ID
|
||||
- **Users:** Checked by email address
|
||||
|
||||
### What Happens on Re-run
|
||||
✅ **Skipped:** Existing records are preserved
|
||||
✅ **Created:** Only missing records are added
|
||||
✅ **Reported:** Results show what was created vs skipped
|
||||
|
||||
### Error Handling (New!)
|
||||
If individual records fail (e.g., duplicate email):
|
||||
- ⊘ Record is skipped with friendly error message
|
||||
- ✓ Other records continue to be seeded
|
||||
- 📊 Summary shows successful + skipped counts
|
||||
- ⚠️ Warnings section lists all skipped items with reasons
|
||||
|
||||
---
|
||||
|
||||
## Seeding Workflow
|
||||
|
||||
### Recommended Order
|
||||
|
||||
1. **Seed System Data** (one time)
|
||||
- Creates roles, default company, SuperAdmin users
|
||||
|
||||
2. **Seed Company Data** (per company)
|
||||
- Creates lookups, inventory, customers, etc.
|
||||
- Can be run multiple times safely
|
||||
- Can reset company data and re-seed for testing
|
||||
|
||||
### Testing Workflow
|
||||
|
||||
```
|
||||
1. Reset company data (using ResetCompanyData.sql)
|
||||
2. Modify seed code if needed
|
||||
3. Run "Seed Data" for company
|
||||
4. Review results and warnings
|
||||
5. Test with fresh data
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Customization
|
||||
|
||||
### How to Modify Seed Data
|
||||
|
||||
Seed data is defined in these files:
|
||||
|
||||
```
|
||||
src/PowderCoating.Infrastructure/Services/
|
||||
├── SeedDataService.cs # Main service, inventory, costs, tiers
|
||||
├── SeedDataService.Customers.cs # Customer data
|
||||
├── SeedDataService.Equipment.cs # Equipment data
|
||||
├── SeedDataService.Jobs.cs # Job samples
|
||||
├── SeedDataService.Quotes.cs # Quote samples
|
||||
├── SeedDataService.Catalog.cs # Catalog items
|
||||
├── SeedDataService.Appointments.cs # Appointments
|
||||
└── SeedDataService.Lookups.cs # All lookup tables
|
||||
```
|
||||
|
||||
### Modifying Quantities
|
||||
|
||||
To change how many items are seeded:
|
||||
|
||||
1. Open the relevant partial class file
|
||||
2. Add/remove items from the collection
|
||||
3. Rebuild the application
|
||||
4. Reset company data if re-testing
|
||||
5. Re-run seed operation
|
||||
|
||||
**Example:** To add a new powder color, edit `SeedDataService.cs` and add a new `InventoryItem` to the `inventoryItems` list in `SeedInventoryItemsAsync()`.
|
||||
|
||||
---
|
||||
|
||||
## Production Considerations
|
||||
|
||||
### DO NOT seed in production!
|
||||
|
||||
Seed data is for **development and testing only**:
|
||||
- Contains demo customers with fake data
|
||||
- Uses simple passwords
|
||||
- Includes placeholder information
|
||||
- Not suitable for real business use
|
||||
|
||||
### For Production
|
||||
|
||||
Instead of seeding:
|
||||
1. Create companies via admin interface
|
||||
2. Users register/are invited by company admin
|
||||
3. Customers are added as they come in
|
||||
4. Inventory is imported or entered manually
|
||||
5. Operating costs are configured per company
|
||||
6. Pricing tiers are customized per business model
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** 2026-02-16
|
||||
Reference in New Issue
Block a user