feat(patient-status schema updated)- applied changes

This commit is contained in:
2025-10-30 21:13:33 +05:30
parent 103142b2d3
commit 54f83ab398
9 changed files with 146 additions and 63 deletions

View File

@@ -52,7 +52,7 @@ model Patient {
policyHolder String?
allergies String?
medicalConditions String?
status String @default("active")
status PatientStatus @default(UNKNOWN)
userId Int
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id])
@@ -65,6 +65,12 @@ model Patient {
@@index([createdAt])
}
enum PatientStatus {
ACTIVE
INACTIVE
UNKNOWN
}
model Appointment {
id Int @id @default(autoincrement())
patientId Int

View File

@@ -1,5 +1,9 @@
import { PatientUncheckedCreateInputObjectSchema } from "@repo/db/usedSchemas";
import {
PatientStatusSchema,
PatientUncheckedCreateInputObjectSchema,
} from "@repo/db/usedSchemas";
import { z } from "zod";
import { makeEnumOptions } from "../utils";
export type Patient = z.infer<typeof PatientUncheckedCreateInputObjectSchema>;
@@ -28,6 +32,17 @@ export const insuranceIdSchema = z.preprocess(
.nullable()
);
//patient status
export type PatientStatus = z.infer<typeof PatientStatusSchema>;
// enum → select options
export const patientStatusOptions =
makeEnumOptions<
typeof PatientStatusSchema extends z.ZodTypeAny
? z.infer<typeof PatientStatusSchema>
: string
>(PatientStatusSchema);
export const insertPatientSchema = (
PatientUncheckedCreateInputObjectSchema as unknown as z.ZodObject<any>
)

View File

@@ -1,6 +1,7 @@
// using this, as the browser load only the required files , not whole db/shared/schemas/ files.
export * from '../shared/schemas/objects/AppointmentUncheckedCreateInput.schema';
export * from '../shared/schemas/objects/PatientUncheckedCreateInput.schema';
export * from '../shared/schemas/enums/PatientStatus.schema';
export * from '../shared/schemas/objects/UserUncheckedCreateInput.schema';
export * from '../shared/schemas/objects/StaffUncheckedCreateInput.schema'
export * from '../shared/schemas/objects/ClaimUncheckedCreateInput.schema'