Files
DentalManagementMH05/packages/db/shared/schemas/results/AppointmentProcedureAggregateResult.schema.ts
Gitead 3e899376c3 feat: Select Procedures flow, batch-column NPI provider fix, auto PDF save
- Add 'Select Procedures' right-click option on appointment page (separate from Claims/PreAuth)
- Select Procedures form saves CDT codes + NPI provider to AppointmentProcedure storage
- Remove Save button from insurance claim form; Claims/PreAuth opens for insurance submission only
- Claims/PreAuth auto-prefills from saved procedures including NPI provider
- Batch-column: procedures npiProviderId takes priority over stale claim npiProviderId
- Batch-column: auto-save PDF to patient Documents after successful submission (no socket needed)
- Add npiProviderId column to AppointmentProcedure table (prisma db push)
- Fix 'invalid db creation invocation': guard staffId, npiProviderId, procedureDate as Date object, totalBilled NaN guard
- Add full error logging to batch-column catch block

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 00:25:24 -04:00

64 lines
2.2 KiB
TypeScript

import * as z from 'zod';
export const AppointmentProcedureAggregateResultSchema = z.object({ _count: z.object({
id: z.number(),
appointmentId: z.number(),
patientId: z.number(),
npiProviderId: z.number(),
procedureCode: z.number(),
procedureLabel: z.number(),
fee: z.number(),
category: z.number(),
toothNumber: z.number(),
toothSurface: z.number(),
oralCavityArea: z.number(),
source: z.number(),
comboKey: z.number(),
createdAt: z.number(),
appointment: z.number(),
patient: z.number(),
npiProvider: z.number()
}).optional(),
_sum: z.object({
id: z.number().nullable(),
appointmentId: z.number().nullable(),
patientId: z.number().nullable(),
npiProviderId: z.number().nullable(),
fee: z.number().nullable()
}).nullable().optional(),
_avg: z.object({
id: z.number().nullable(),
appointmentId: z.number().nullable(),
patientId: z.number().nullable(),
npiProviderId: z.number().nullable(),
fee: z.number().nullable()
}).nullable().optional(),
_min: z.object({
id: z.number().int().nullable(),
appointmentId: z.number().int().nullable(),
patientId: z.number().int().nullable(),
npiProviderId: z.number().int().nullable(),
procedureCode: z.string().nullable(),
procedureLabel: z.string().nullable(),
fee: z.number().nullable(),
category: z.string().nullable(),
toothNumber: z.string().nullable(),
toothSurface: z.string().nullable(),
oralCavityArea: z.string().nullable(),
comboKey: z.string().nullable(),
createdAt: z.date().nullable()
}).nullable().optional(),
_max: z.object({
id: z.number().int().nullable(),
appointmentId: z.number().int().nullable(),
patientId: z.number().int().nullable(),
npiProviderId: z.number().int().nullable(),
procedureCode: z.string().nullable(),
procedureLabel: z.string().nullable(),
fee: z.number().nullable(),
category: z.string().nullable(),
toothNumber: z.string().nullable(),
toothSurface: z.string().nullable(),
oralCavityArea: z.string().nullable(),
comboKey: z.string().nullable(),
createdAt: z.date().nullable()
}).nullable().optional()});