fix: patient language field silently dropped by stale browser-side validation schema
packages/db/usedSchemas/browser.ts (the browser-resolved copy of the Patient zod schema, kept separate from the Node copy since it can't import Prisma-generated code) was missing several fields added to the real schema over time — preferredLanguage, gender, insuranceProvider, insuranceId, groupNumber, policyHolder, and the PLAN_NOT_ACCEPTED status. Since the schema isn't strict, those fields were silently stripped from every patient create/update in the browser with no validation error, so edits to them never reached the server. Also fixes the AI call greeting always playing in English regardless of the patient's preferred language — the greeting text was a single hardcoded string, unlike every later turn in the conversation which already branched by language.
This commit is contained in:
@@ -2,7 +2,7 @@ import * as z from "zod";
|
||||
|
||||
// ─── Enums ────────────────────────────────────────────────────────────────────
|
||||
|
||||
export const PatientStatusSchema = z.enum(["ACTIVE", "INACTIVE", "UNKNOWN"]);
|
||||
export const PatientStatusSchema = z.enum(["ACTIVE", "INACTIVE", "UNKNOWN", "PLAN_NOT_ACCEPTED"]);
|
||||
export type PatientStatus = z.infer<typeof PatientStatusSchema>;
|
||||
|
||||
export const ClaimStatusSchema = z.enum([
|
||||
@@ -85,13 +85,23 @@ export const PatientUncheckedCreateInputObjectSchema = z.object({
|
||||
firstName: z.string(),
|
||||
lastName: z.string(),
|
||||
dateOfBirth: z.string(),
|
||||
gender: z.string().optional(),
|
||||
phone: z.string().optional(),
|
||||
email: z.string().optional(),
|
||||
address: z.string().optional(),
|
||||
city: z.string().optional(),
|
||||
state: z.string().optional(),
|
||||
zipCode: z.string().optional(),
|
||||
insuranceProvider: z.string().optional().nullable(),
|
||||
insuranceId: z.string().optional().nullable(),
|
||||
groupNumber: z.string().optional().nullable(),
|
||||
policyHolder: z.string().optional().nullable(),
|
||||
allergies: z.string().optional().nullable(),
|
||||
medicalConditions: z.string().optional().nullable(),
|
||||
preferredLanguage: z.string().optional().nullable(),
|
||||
status: PatientStatusSchema.optional(),
|
||||
userId: z.number().int().optional(),
|
||||
createdAt: z.coerce.date().optional(),
|
||||
});
|
||||
|
||||
export const StaffUncheckedCreateInputObjectSchema = z.object({
|
||||
|
||||
Reference in New Issue
Block a user