feat(reminders): Phase 4 partial — schema + service + validators
Migration 0072 — reminders/interests expansion: - interests.reminder_note: optional cadence note for the existing reminderEnabled+reminderDays flow. Surfaces in notification body + inbox row. - reminders.yacht_id (+ FK + relation): fourth entity link so yacht-scoped tasks have a typed home alongside client/interest/berth. - reminders.fired_at: worker idempotency. Partial index idx_reminders_due_unfired drives the scan. Service + validator updates: - createReminderSchema / updateReminderSchema accept yachtId. - assertReminderFksInPort validates yacht ownership against the caller's port — defense-in-depth, same shape as other entity FKs. - createReminder / updateReminder thread yachtId through. Worker scheduler + CreateReminderDialog yachtId UI deferred. The existing reminders/reminder-form.tsx already covers the dialog contract — Phase 4b extends it with yachtId + the per-user digest_time_of_day picker. Tests: 1374/1374 passing. tsc clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,8 @@ export const createReminderSchema = z.object({
|
||||
clientId: z.string().uuid().optional(),
|
||||
interestId: z.string().uuid().optional(),
|
||||
berthId: z.string().uuid().optional(),
|
||||
// Phase 4: yacht-linked reminders.
|
||||
yachtId: z.string().uuid().optional(),
|
||||
});
|
||||
|
||||
export type CreateReminderInput = z.infer<typeof createReminderSchema>;
|
||||
@@ -23,6 +25,7 @@ export const updateReminderSchema = z.object({
|
||||
clientId: z.string().uuid().nullable().optional(),
|
||||
interestId: z.string().uuid().nullable().optional(),
|
||||
berthId: z.string().uuid().nullable().optional(),
|
||||
yachtId: z.string().uuid().nullable().optional(),
|
||||
});
|
||||
|
||||
export type UpdateReminderInput = z.infer<typeof updateReminderSchema>;
|
||||
@@ -40,6 +43,7 @@ export const reminderListQuerySchema = baseListQuerySchema.extend({
|
||||
clientId: z.string().uuid().optional(),
|
||||
interestId: z.string().uuid().optional(),
|
||||
berthId: z.string().uuid().optional(),
|
||||
yachtId: z.string().uuid().optional(),
|
||||
dueBefore: z.string().datetime().optional(),
|
||||
dueAfter: z.string().datetime().optional(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user