Clean up fake colors and add missing Bambu Lab colors
- Add migration 023: delete 67 fake colors, rename IronGray typo, add 16 missing real colors from spreadsheet - Fix frontend color mappings: remove typo duplicates, rename Silk prefixed colors to match catalog - Add Translucent Teal, Phantom Blue, Mystic Magenta mappings - Remove non-existent ABS GF, TPU 95A HF entries - Update tests for corrected color names
This commit is contained in:
10
CLAUDE.md
10
CLAUDE.md
@@ -48,14 +48,14 @@ scripts/deploy-frontend.sh # Manual frontend deploy to S3/CloudFront
|
||||
|
||||
### Frontend (Next.js App Router)
|
||||
- `/app/page.tsx` — Public filament inventory table (home page)
|
||||
- `/app/upadaj/` — Admin panel: login, `/dashboard` (filament CRUD), `/colors` (color management), `/requests` (customer color requests)
|
||||
- `/app/upadaj/` — Admin panel: login, `/dashboard` (filament CRUD), `/colors` (color management), `/customers` (customer management), `/sales` (sales recording), `/requests` (customer color requests), `/analytics` (revenue/inventory dashboards)
|
||||
- `/src/services/api.ts` — Axios instance with auth interceptors (auto token injection, 401/403 redirect)
|
||||
- `/src/data/bambuLabColors.ts` — Primary color-to-hex mapping with gradient support (used by `ColorCell` component)
|
||||
- `/src/data/bambuLabColorsComplete.ts` — Extended color database grouped by finish type (used by filters)
|
||||
|
||||
### API (`/api/server.js`)
|
||||
Single-file Express server running on EC2 (port 80). All routes inline.
|
||||
- Endpoints: `/api/login`, `/api/filaments`, `/api/colors`, `/api/sale/bulk`, `/api/color-requests`
|
||||
- Endpoints: `/api/login`, `/api/filaments`, `/api/colors`, `/api/customers`, `/api/sales`, `/api/color-requests`, `/api/analytics/*`
|
||||
- Auth: JWT tokens with 24h expiry, single admin user (password from `ADMIN_PASSWORD` env var)
|
||||
|
||||
### Database (PostgreSQL on RDS)
|
||||
@@ -64,13 +64,15 @@ Key schemas and constraints:
|
||||
```
|
||||
filaments: id, tip (material), finish, boja (color), refill, spulna, kolicina, cena, sale_*
|
||||
colors: id, name, hex, cena_refill (default 3499), cena_spulna (default 3999)
|
||||
customers: id, name, phone (unique), city, notes, created_at
|
||||
sales: id, customer_id (FK→customers), total_amount, notes, created_at + sale_items join table
|
||||
color_requests: id, color_name, message, contact_name, contact_phone, status
|
||||
```
|
||||
|
||||
**Critical constraints:**
|
||||
- `filaments.boja` → FK to `colors.name` (ON UPDATE CASCADE) — colors must exist before filaments reference them
|
||||
- `kolicina = refill + spulna` — enforced by check constraint
|
||||
- Migrations in `/database/migrations/` with sequential numbering (currently up to `020_`)
|
||||
- Migrations in `/database/migrations/` with sequential numbering (currently up to `023_`)
|
||||
|
||||
## Key Patterns
|
||||
|
||||
@@ -86,7 +88,7 @@ color_requests: id, color_name, message, contact_name, contact_phone, status
|
||||
3. Optionally add to `src/data/bambuLabColorsComplete.ts` finish groups
|
||||
|
||||
### API Communication
|
||||
- Service modules in `src/services/api.ts`: `authService`, `colorService`, `filamentService`, `colorRequestService`
|
||||
- Service modules in `src/services/api.ts`: `authService`, `colorService`, `filamentService`, `colorRequestService`, `customerService`, `saleService`, `analyticsService`
|
||||
- Auth token stored in localStorage with 24h expiry
|
||||
- Cache busting on filament fetches via timestamp query param
|
||||
|
||||
|
||||
Reference in New Issue
Block a user