This commit is contained in:
Eric Gullickson
2025-11-04 18:38:06 -06:00
parent d8d0ada83f
commit d4156cf521
20 changed files with 1149 additions and 186 deletions

View File

@@ -32,26 +32,26 @@ Notes:
- Trims/engines include `id` to enable the next hop in the UI.
### Authentication
- Header: `Authorization: Bearer ${API_KEY}`
- API env: `API_KEY`
- Auth0 JWT via `Authorization: Bearer ${JWT_TOKEN}` (required for all platform endpoints)
- Configured in backend: `src/core/plugins/auth.plugin.ts` with JWKS validation
### Caching (Redis)
- Keys: `dropdown:years`, `dropdown:makes:{year}`, `dropdown:models:{year}:{make}`, `dropdown:trims:{year}:{model}`, `dropdown:engines:{year}:{model}:{trim}`
- Default TTL: 1 hour (3600 seconds)
- **Configurable**: Set via `CACHE_TTL` environment variable in seconds
- Dropdown data TTL: 6 hours (21600 seconds)
- VIN decode cache TTL: 7 days (604800 seconds)
- Cache key format for VIN decodes: `vin:decode:{vin}`
- Implementation: `backend/src/features/platform/domain/platform-cache.service.ts`
### Seeds & Specific Examples
Legacy FastAPI SQL seed scripts covered:
- Base schema (`001_schema.sql`)
- Constraints/indexes (`002_constraints_indexes.sql`)
- Minimal Honda/Toyota scaffolding (`003_seed_minimal.sql`)
- Chevrolet/GMC examples (`004_seed_filtered_makes.sql`)
- Targeted sample vehicles (`005_seed_specific_vehicles.sql`)
Contact the data team for access to these archival scripts if reseeding is required.
Platform seed migrations (TypeScript backend):
- Schema definition (`backend/src/features/platform/migrations/001_create_platform_schema.sql`)
- Constraints and indexes (`backend/src/features/platform/migrations/002_create_indexes.sql`)
- Sample vehicle data (`backend/src/features/platform/migrations/003_seed_vehicles.sql`)
Seeds are auto-migrated on backend container start via `backend/src/_system/migrations/run-all.ts`.
Reapply seeds on an existing volume:
- `docker compose exec -T mvp-postgres psql -U mvp_user -d mvp_db -f /docker-entrypoint-initdb.d/005_seed_specific_vehicles.sql`
- Clear platform cache: `docker compose exec -T mvp-redis sh -lc "redis-cli FLUSHALL"`
Clear platform cache:
- `docker compose exec -T mvp-redis sh -lc "redis-cli FLUSHALL"`
- Or restart containers: `make rebuild`
## MotoVaultPro Backend (Application Service)
@@ -147,8 +147,9 @@ VIN/License rule
- Note: This will destroy ALL application data, not just platform data, as database and cache are shared
## Security Summary
- Platform: `Authorization: Bearer ${API_KEY}` required on all `/api/v1/vehicles/*` endpoints.
- App Backend: Auth0 JWT required on all protected `/api/*` routes.
- Platform Module: Auth0 JWT via `Authorization: Bearer ${JWT_TOKEN}` required on all `/api/platform/*` endpoints.
- Vehicles Feature: Auth0 JWT required on all protected `/api/vehicles/*` routes.
- Health Check: `/api/health` is unauthenticated (Traefik readiness probe).
## CI Summary
- Workflow `.github/workflows/ci.yml` builds backend/frontend/platform API.