Files
DentalManagementMH06/packages/db/shared/schemas/results/AppointmentGroupByResult.schema.ts
ff 9d0cfe5dba feat: appointment type inference, procedure codes on cards, claim attachment fixes
- Add appointment type categories matching insurance claim form (recall, filling, pedo, dentures, implant, endo, crown, perio, extraction, ortho, consultation, emergency, other)
- Auto-infer appointment type from CDT codes with priority rules (endo > implant > crown > ...)
- typeLocked flag prevents auto-overwrite when user manually sets type
- Show appointment type label and procedure codes on schedule cards
- Background sync on /day route retroactively fixes stale appointment types
- Fix PUT /api/claims/:id to save claimFiles (previously silently dropped)
- Auto-link AppointmentFile records to ClaimFile when claim is created or updated
- Fix D5750 (denture reline) CDT range to map correctly to dentures category
- Fix typeLocked Zod rejection in appointment update route

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 14:18:10 -04:00

84 lines
2.4 KiB
TypeScript

import * as z from 'zod';
export const AppointmentGroupByResultSchema = z.array(z.object({
id: z.number().int(),
patientId: z.number().int(),
userId: z.number().int(),
staffId: z.number().int(),
title: z.string(),
date: z.date(),
startTime: z.string(),
endTime: z.string(),
type: z.string(),
typeLocked: z.boolean(),
notes: z.string(),
procedureCodeNotes: z.string(),
status: z.string(),
movedByAi: z.boolean(),
createdAt: z.date(),
_count: z.object({
id: z.number(),
patientId: z.number(),
userId: z.number(),
staffId: z.number(),
title: z.number(),
date: z.number(),
startTime: z.number(),
endTime: z.number(),
type: z.number(),
typeLocked: z.number(),
notes: z.number(),
procedureCodeNotes: z.number(),
status: z.number(),
movedByAi: z.number(),
createdAt: z.number(),
eligibilityStatus: z.number(),
patient: z.number(),
user: z.number(),
staff: z.number(),
procedures: z.number(),
claims: z.number(),
files: z.number()
}).optional(),
_sum: z.object({
id: z.number().nullable(),
patientId: z.number().nullable(),
userId: z.number().nullable(),
staffId: z.number().nullable()
}).nullable().optional(),
_avg: z.object({
id: z.number().nullable(),
patientId: z.number().nullable(),
userId: z.number().nullable(),
staffId: z.number().nullable()
}).nullable().optional(),
_min: z.object({
id: z.number().int().nullable(),
patientId: z.number().int().nullable(),
userId: z.number().int().nullable(),
staffId: z.number().int().nullable(),
title: z.string().nullable(),
date: z.date().nullable(),
startTime: z.string().nullable(),
endTime: z.string().nullable(),
type: z.string().nullable(),
notes: z.string().nullable(),
procedureCodeNotes: z.string().nullable(),
status: z.string().nullable(),
createdAt: z.date().nullable()
}).nullable().optional(),
_max: z.object({
id: z.number().int().nullable(),
patientId: z.number().int().nullable(),
userId: z.number().int().nullable(),
staffId: z.number().int().nullable(),
title: z.string().nullable(),
date: z.date().nullable(),
startTime: z.string().nullable(),
endTime: z.string().nullable(),
type: z.string().nullable(),
notes: z.string().nullable(),
procedureCodeNotes: z.string().nullable(),
status: z.string().nullable(),
createdAt: z.date().nullable()
}).nullable().optional()
}));