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
+3
View File
@@ -16,6 +16,7 @@ describe('authService.login', () => {
passwordHash: await bcrypt.hash(password, 4),
role: 'AGENT',
apiKey: null,
notificationPrefs: null,
createdAt: new Date(),
updatedAt: new Date(),
});
@@ -35,6 +36,7 @@ describe('authService.login', () => {
passwordHash: await bcrypt.hash('correct', 4),
role: 'AGENT',
apiKey: null,
notificationPrefs: null,
createdAt: new Date(),
updatedAt: new Date(),
});
@@ -59,6 +61,7 @@ describe('authService.login', () => {
passwordHash: await bcrypt.hash(password, 4),
role: 'SERVICE',
apiKey: 'sk_xyz',
notificationPrefs: null,
createdAt: new Date(),
updatedAt: new Date(),
});
+1
View File
@@ -11,6 +11,7 @@ const stubUser = {
role: 'AGENT' as const,
passwordHash: '',
apiKey: null,
notificationPrefs: null,
createdAt: new Date(),
updatedAt: new Date(),
};