Files
jason ad499f6782
Build and Push Docker Image / build (push) Successful in 1m12s
Assemble QMS app + SQLite refactor + Unraid single-container deploy
Reconstruct the full app from init-source overlays (base + fix-1..6 +
update-1..3, last-wins) at the repo root, complete the missing pieces so it
builds and runs, and stage the Unraid deployment.

App completion:
- types/index.ts: former Prisma enums as string-literal unions + AppUser
- pages/_app.tsx + styles/globals.css (mount AppProvider/ToastProvider)
- API routes: auth/login, auth/me, users, submissions (+REVIEW_READY notify),
  forms (list/create), notifications
- scripts/create-admin.js: idempotent first-admin bootstrap
- 14 unbuilt nav targets stubbed via ComingSoon placeholder

SQLite refactor (single-container, no external DB):
- schema provider -> sqlite; enums -> String; Json -> String;
  FormField.options String[] -> JSON-encoded String
- lib/forms.ts (de)serialises options at the DB boundary
- drop mode:"insensitive" (unsupported on SQLite)
- enum imports repointed from @prisma/client to @/types

Deploy:
- multi-stage Dockerfile (next build -> prod runner), docker-entrypoint.sh
  (prisma db push -> create-admin -> next start), .dockerignore
- docker-compose.yml: br0 10.2.0.x, /mnt/user/appdata/qms -> /data volume
- README rewritten for the Unraid/Gitea Actions flow; .env scrubbed of the
  live Supabase credential; vercel.json removed

Verified: next build clean (41 routes); live SQLite round-trip of
login/session, form options array, and submission -> REVIEW_READY.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 16:58:47 -05:00

59 lines
1.4 KiB
TypeScript

// Shared domain types.
// SQLite (Prisma) supports no native enums, so these former enums are string-literal
// unions kept here as the single source of truth for both client and server code.
export type Role =
| 'ADMIN'
| 'QC'
| 'PRODUCTION'
| 'PRODUCTION_LEAD'
| 'LOGISTICS_LEAD'
| 'MANAGEMENT'
export type FieldType =
| 'SHORT_TEXT'
| 'LONG_TEXT'
| 'NUMBER'
| 'DATE'
| 'SINGLE_CHOICE'
| 'MULTI_CHOICE'
| 'RATING'
| 'PHOTO'
export type FormStatus =
| 'DRAFT'
| 'ACTIVE'
| 'SUSPENDED'
| 'REVIEW_READY'
| 'STANDARD_SET'
| 'ARCHIVED'
export type NCRSeverity = 'OBSERVATION' | 'MINOR' | 'MAJOR'
export type NCRStatus = 'OPEN' | 'INVESTIGATING' | 'ESCALATED' | 'RESOLVED'
export type EscapeStatus = 'OPEN' | 'INVESTIGATING' | 'RESOLVED' | 'ESCALATED'
export type CAPAPriority = 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW'
export type CAPAStatus = 'OPEN' | 'IN_PROGRESS' | 'OVERDUE' | 'CLOSED'
export type NotifType =
| 'CAPA_OVERDUE'
| 'CAPA_ASSIGNED'
| 'AUDIT_DUE'
| 'NCR_ESCALATED'
| 'FORM_REVIEW_READY'
| 'DOC_EXPIRING'
| 'STANDARD_APPROVED'
| 'SOLUTION_CONFIRMED'
export type ShipmentItemType = 'FORM_DATA' | 'NCR_FIX' | 'AUDIT' | 'OTHER'
// The authenticated user as exposed to the client (no password/session fields).
export interface AppUser {
id: string
email: string
name: string
role: Role
department?: string | null
active?: boolean
}