Files
DentalManagementMH06/packages/db/shared/schemas/objects/AppointmentWhereInput.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

49 lines
4.6 KiB
TypeScript

import * as z from 'zod';
import type { Prisma } from '../../../generated/prisma';
import { IntFilterObjectSchema as IntFilterObjectSchema } from './IntFilter.schema';
import { StringFilterObjectSchema as StringFilterObjectSchema } from './StringFilter.schema';
import { DateTimeFilterObjectSchema as DateTimeFilterObjectSchema } from './DateTimeFilter.schema';
import { BoolFilterObjectSchema as BoolFilterObjectSchema } from './BoolFilter.schema';
import { StringNullableFilterObjectSchema as StringNullableFilterObjectSchema } from './StringNullableFilter.schema';
import { EnumPatientStatusFilterObjectSchema as EnumPatientStatusFilterObjectSchema } from './EnumPatientStatusFilter.schema';
import { PatientStatusSchema } from '../enums/PatientStatus.schema';
import { PatientScalarRelationFilterObjectSchema as PatientScalarRelationFilterObjectSchema } from './PatientScalarRelationFilter.schema';
import { PatientWhereInputObjectSchema as PatientWhereInputObjectSchema } from './PatientWhereInput.schema';
import { UserScalarRelationFilterObjectSchema as UserScalarRelationFilterObjectSchema } from './UserScalarRelationFilter.schema';
import { UserWhereInputObjectSchema as UserWhereInputObjectSchema } from './UserWhereInput.schema';
import { StaffNullableScalarRelationFilterObjectSchema as StaffNullableScalarRelationFilterObjectSchema } from './StaffNullableScalarRelationFilter.schema';
import { StaffWhereInputObjectSchema as StaffWhereInputObjectSchema } from './StaffWhereInput.schema';
import { AppointmentProcedureListRelationFilterObjectSchema as AppointmentProcedureListRelationFilterObjectSchema } from './AppointmentProcedureListRelationFilter.schema';
import { ClaimListRelationFilterObjectSchema as ClaimListRelationFilterObjectSchema } from './ClaimListRelationFilter.schema';
import { AppointmentFileListRelationFilterObjectSchema as AppointmentFileListRelationFilterObjectSchema } from './AppointmentFileListRelationFilter.schema'
const appointmentwhereinputSchema = z.object({
AND: z.union([z.lazy(() => AppointmentWhereInputObjectSchema), z.lazy(() => AppointmentWhereInputObjectSchema).array()]).optional(),
OR: z.lazy(() => AppointmentWhereInputObjectSchema).array().optional(),
NOT: z.union([z.lazy(() => AppointmentWhereInputObjectSchema), z.lazy(() => AppointmentWhereInputObjectSchema).array()]).optional(),
id: z.union([z.lazy(() => IntFilterObjectSchema), z.number().int()]).optional(),
patientId: z.union([z.lazy(() => IntFilterObjectSchema), z.number().int()]).optional(),
userId: z.union([z.lazy(() => IntFilterObjectSchema), z.number().int()]).optional(),
staffId: z.union([z.lazy(() => IntFilterObjectSchema), z.number().int()]).optional(),
title: z.union([z.lazy(() => StringFilterObjectSchema), z.string()]).optional(),
date: z.union([z.lazy(() => DateTimeFilterObjectSchema), z.coerce.date()]).optional(),
startTime: z.union([z.lazy(() => StringFilterObjectSchema), z.string()]).optional(),
endTime: z.union([z.lazy(() => StringFilterObjectSchema), z.string()]).optional(),
type: z.union([z.lazy(() => StringFilterObjectSchema), z.string()]).optional(),
typeLocked: z.union([z.lazy(() => BoolFilterObjectSchema), z.boolean()]).optional(),
notes: z.union([z.lazy(() => StringNullableFilterObjectSchema), z.string()]).optional().nullable(),
procedureCodeNotes: z.union([z.lazy(() => StringNullableFilterObjectSchema), z.string()]).optional().nullable(),
status: z.union([z.lazy(() => StringFilterObjectSchema), z.string()]).optional(),
movedByAi: z.union([z.lazy(() => BoolFilterObjectSchema), z.boolean()]).optional(),
createdAt: z.union([z.lazy(() => DateTimeFilterObjectSchema), z.coerce.date()]).optional(),
eligibilityStatus: z.union([z.lazy(() => EnumPatientStatusFilterObjectSchema), PatientStatusSchema]).optional(),
patient: z.union([z.lazy(() => PatientScalarRelationFilterObjectSchema), z.lazy(() => PatientWhereInputObjectSchema)]).optional(),
user: z.union([z.lazy(() => UserScalarRelationFilterObjectSchema), z.lazy(() => UserWhereInputObjectSchema)]).optional(),
staff: z.union([z.lazy(() => StaffNullableScalarRelationFilterObjectSchema), z.lazy(() => StaffWhereInputObjectSchema)]).optional(),
procedures: z.lazy(() => AppointmentProcedureListRelationFilterObjectSchema).optional(),
claims: z.lazy(() => ClaimListRelationFilterObjectSchema).optional(),
files: z.lazy(() => AppointmentFileListRelationFilterObjectSchema).optional()
}).strict();
export const AppointmentWhereInputObjectSchema: z.ZodType<Prisma.AppointmentWhereInput> = appointmentwhereinputSchema as unknown as z.ZodType<Prisma.AppointmentWhereInput>;
export const AppointmentWhereInputObjectZodSchema = appointmentwhereinputSchema;