- Filter patient list by userId so each user sees only their own patients - Sort patients by updatedAt DESC so recently checked patients appear first - Add updatedAt field to Patient model (DB migration via raw SQL + db:generate) - Fix DDMA name extraction: read from detail page "Name:" label, not search results row text which included appended dates - Fix PDF capture: use driver.get() instead of click() to avoid race condition that was saving the search results page instead of the patient detail page - Strip trailing bare dates from extracted names (e.g. "Rodriguez 04/27/2026") - Handle "Last, First" comma format and single-word last names in splitName - Normalize insuranceId consistently in createOrUpdatePatientByInsuranceId - Fix OTP persistent session: stop clearing LocalStorage/IndexedDB on startup (these hold the DDMA device trust token that skips OTP on subsequent logins) - Increase post-navigation wait time for full page render before PDF generation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
67 lines
4.5 KiB
TypeScript
67 lines
4.5 KiB
TypeScript
import * as z from 'zod';
|
|
import type { Prisma } from '../../../generated/prisma';
|
|
import { IntFieldUpdateOperationsInputObjectSchema as IntFieldUpdateOperationsInputObjectSchema } from './IntFieldUpdateOperationsInput.schema';
|
|
import { DecimalFieldUpdateOperationsInputObjectSchema as DecimalFieldUpdateOperationsInputObjectSchema } from './DecimalFieldUpdateOperationsInput.schema';
|
|
import { PaymentStatusSchema } from '../enums/PaymentStatus.schema';
|
|
import { EnumPaymentStatusFieldUpdateOperationsInputObjectSchema as EnumPaymentStatusFieldUpdateOperationsInputObjectSchema } from './EnumPaymentStatusFieldUpdateOperationsInput.schema';
|
|
import { NullableStringFieldUpdateOperationsInputObjectSchema as NullableStringFieldUpdateOperationsInputObjectSchema } from './NullableStringFieldUpdateOperationsInput.schema';
|
|
import { DateTimeFieldUpdateOperationsInputObjectSchema as DateTimeFieldUpdateOperationsInputObjectSchema } from './DateTimeFieldUpdateOperationsInput.schema';
|
|
import { ClaimUpdateOneWithoutPaymentNestedInputObjectSchema as ClaimUpdateOneWithoutPaymentNestedInputObjectSchema } from './ClaimUpdateOneWithoutPaymentNestedInput.schema';
|
|
import { PatientUpdateOneRequiredWithoutPaymentNestedInputObjectSchema as PatientUpdateOneRequiredWithoutPaymentNestedInputObjectSchema } from './PatientUpdateOneRequiredWithoutPaymentNestedInput.schema';
|
|
import { ServiceLineTransactionUpdateManyWithoutPaymentNestedInputObjectSchema as ServiceLineTransactionUpdateManyWithoutPaymentNestedInputObjectSchema } from './ServiceLineTransactionUpdateManyWithoutPaymentNestedInput.schema';
|
|
import { ServiceLineUpdateManyWithoutPaymentNestedInputObjectSchema as ServiceLineUpdateManyWithoutPaymentNestedInputObjectSchema } from './ServiceLineUpdateManyWithoutPaymentNestedInput.schema'
|
|
|
|
import { DecimalJSLikeSchema, isValidDecimalInput } from '../../helpers/decimal-helpers';
|
|
|
|
import Decimal from "decimal.js";
|
|
const makeSchema = () => z.object({
|
|
userId: z.union([z.number().int(), z.lazy(() => IntFieldUpdateOperationsInputObjectSchema)]).optional(),
|
|
totalBilled: z.union([z.union([
|
|
z.number(),
|
|
z.string(),
|
|
z.instanceof(Decimal),
|
|
z.instanceof(Decimal),
|
|
DecimalJSLikeSchema,
|
|
]).refine((v) => isValidDecimalInput(v), {
|
|
message: "Field 'totalBilled' must be a Decimal",
|
|
}), z.lazy(() => DecimalFieldUpdateOperationsInputObjectSchema)]).optional(),
|
|
totalPaid: z.union([z.union([
|
|
z.number(),
|
|
z.string(),
|
|
z.instanceof(Decimal),
|
|
z.instanceof(Decimal),
|
|
DecimalJSLikeSchema,
|
|
]).refine((v) => isValidDecimalInput(v), {
|
|
message: "Field 'totalPaid' must be a Decimal",
|
|
}), z.lazy(() => DecimalFieldUpdateOperationsInputObjectSchema)]).optional(),
|
|
totalAdjusted: z.union([z.union([
|
|
z.number(),
|
|
z.string(),
|
|
z.instanceof(Decimal),
|
|
z.instanceof(Decimal),
|
|
DecimalJSLikeSchema,
|
|
]).refine((v) => isValidDecimalInput(v), {
|
|
message: "Field 'totalAdjusted' must be a Decimal",
|
|
}), z.lazy(() => DecimalFieldUpdateOperationsInputObjectSchema)]).optional(),
|
|
totalDue: z.union([z.union([
|
|
z.number(),
|
|
z.string(),
|
|
z.instanceof(Decimal),
|
|
z.instanceof(Decimal),
|
|
DecimalJSLikeSchema,
|
|
]).refine((v) => isValidDecimalInput(v), {
|
|
message: "Field 'totalDue' must be a Decimal",
|
|
}), z.lazy(() => DecimalFieldUpdateOperationsInputObjectSchema)]).optional(),
|
|
status: z.union([PaymentStatusSchema, z.lazy(() => EnumPaymentStatusFieldUpdateOperationsInputObjectSchema)]).optional(),
|
|
notes: z.union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputObjectSchema)]).optional().nullable(),
|
|
icn: z.union([z.string(), z.lazy(() => NullableStringFieldUpdateOperationsInputObjectSchema)]).optional().nullable(),
|
|
createdAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputObjectSchema)]).optional(),
|
|
updatedAt: z.union([z.coerce.date(), z.lazy(() => DateTimeFieldUpdateOperationsInputObjectSchema)]).optional(),
|
|
claim: z.lazy(() => ClaimUpdateOneWithoutPaymentNestedInputObjectSchema).optional(),
|
|
patient: z.lazy(() => PatientUpdateOneRequiredWithoutPaymentNestedInputObjectSchema).optional(),
|
|
serviceLineTransactions: z.lazy(() => ServiceLineTransactionUpdateManyWithoutPaymentNestedInputObjectSchema).optional(),
|
|
serviceLines: z.lazy(() => ServiceLineUpdateManyWithoutPaymentNestedInputObjectSchema).optional()
|
|
}).strict();
|
|
export const PaymentUpdateWithoutUpdatedByInputObjectSchema: z.ZodType<Prisma.PaymentUpdateWithoutUpdatedByInput> = makeSchema() as unknown as z.ZodType<Prisma.PaymentUpdateWithoutUpdatedByInput>;
|
|
export const PaymentUpdateWithoutUpdatedByInputObjectZodSchema = makeSchema();
|