Phase 2a: Prisma schema + shared schemas for v1.0 features

- New models: Attachment, Webhook, Notification, SavedView
- New fields: User.notificationPrefs (Json), indexes on Ticket
- post-push.sql manages the tsvector columns + GIN indexes + triggers for
  FTS on Ticket (title/overview/displayId) and Comment (body); Prisma can't
  express these
- package.json scripts: db:push and start:prod now chain `prisma db execute`
  against post-push.sql after `prisma db push`
- db:migrate script removed — project uses push workflow, not migrations
- Shared Zod schemas: attachment (25MB limit + mimetype allowlist), savedView,
  notification (prefs, mark-read, webhook CRUD)
- Shared type additions: Attachment, Notification, SavedView, Webhook,
  PaginatedResponse<T>
- Test fixtures updated for the new User.notificationPrefs column

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-18 15:52:16 -04:00
parent 77679922a8
commit 0806aec4a4
12 changed files with 475 additions and 24 deletions
+6 -3
View File
@@ -5,9 +5,8 @@
"dev": "tsx watch src/index.ts",
"build": "tsc",
"start": "node dist/server/src/index.js",
"start:prod": "prisma db push && node dist/server/src/index.js",
"db:migrate": "prisma migrate dev",
"db:push": "prisma db push",
"start:prod": "prisma db push && prisma db execute --file prisma/post-push.sql --schema prisma/schema.prisma && node dist/server/src/index.js",
"db:push": "prisma db push && prisma db execute --file prisma/post-push.sql --schema prisma/schema.prisma",
"db:generate": "prisma generate",
"db:seed": "tsx prisma/seed.ts",
"typecheck": "tsc --noEmit",
@@ -23,7 +22,9 @@
"express-async-errors": "^3.1.0",
"express-rate-limit": "^7.5.0",
"jsonwebtoken": "^9.0.2",
"multer": "^2.1.1",
"node-cron": "^3.0.3",
"nodemailer": "^8.0.5",
"pino": "^9.5.0",
"pino-http": "^10.3.0",
"pino-pretty": "^13.0.0",
@@ -34,8 +35,10 @@
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jsonwebtoken": "^9.0.7",
"@types/multer": "^2.1.0",
"@types/node": "^22.10.0",
"@types/node-cron": "^3.0.11",
"@types/nodemailer": "^8.0.0",
"@types/supertest": "^6.0.2",
"prisma": "^5.22.0",
"supertest": "^7.0.0",