feat(patients): drop phone/dateOfBirth, name fields optional
Reduced the patient record to the minimum a dental clinic actually needs:
just a code, optional first/last name and free-text notes. Phone and
date-of-birth fields are gone from the UI everywhere — Add form, edit
dialog inside the table, the Bağlantı Bilgileri block on job detail, and
the table column list. The patient list now surfaces 'Notlar' instead.
Backend
- DB: firstName and lastName columns set to required=false via Appwrite
MCP (tables_db_update_string_column). Existing rows untouched.
- schema.ts Patient interface: firstName/lastName now optional, phone
and dateOfBirth removed from the type entirely. The underlying columns
are still in the DB so legacy rows aren't broken — we just stop
referencing them in code.
- validation/patient.ts: firstName/lastName drop min(1), phone and dob
fields removed.
- patient-actions.ts: pickFields no longer reads phone/dob, create and
update payloads no longer write them.
UI fallbacks
- PatientsTable: header has 'Notlar' instead of Telefon/Doğum. Ad Soyad
cell shows the joined name or em-dash. Edit dialog mirrors the same
simplified form.
- jobs/[jobId] detail page: when patient row has neither name, the page
title falls back to 'Hasta {patientCode}' (same as before for jobs
without a linked patient). The Hasta Bilgileri card now shows Ad Soyad
and Patient Code side by side, with notes spanning both columns.
This commit is contained in:
@@ -37,8 +37,6 @@ function pickFields(formData: FormData) {
|
||||
patientCode: String(formData.get("patientCode") ?? "").trim(),
|
||||
firstName: String(formData.get("firstName") ?? "").trim(),
|
||||
lastName: String(formData.get("lastName") ?? "").trim(),
|
||||
phone: String(formData.get("phone") ?? "").trim(),
|
||||
dateOfBirth: String(formData.get("dateOfBirth") ?? "").trim(),
|
||||
notes: String(formData.get("notes") ?? "").trim(),
|
||||
};
|
||||
}
|
||||
@@ -134,8 +132,6 @@ export async function createPatientAction(
|
||||
patientCode: code,
|
||||
firstName: parsed.data.firstName,
|
||||
lastName: parsed.data.lastName,
|
||||
phone: parsed.data.phone,
|
||||
dateOfBirth: parsed.data.dateOfBirth,
|
||||
notes: parsed.data.notes,
|
||||
archived: false,
|
||||
},
|
||||
@@ -193,8 +189,6 @@ export async function updatePatientAction(
|
||||
await tablesDB.updateRow(DATABASE_ID, TABLES.patients, id, {
|
||||
firstName: parsed.data.firstName,
|
||||
lastName: parsed.data.lastName,
|
||||
phone: parsed.data.phone,
|
||||
dateOfBirth: parsed.data.dateOfBirth,
|
||||
notes: parsed.data.notes,
|
||||
});
|
||||
await logAudit({
|
||||
|
||||
@@ -87,10 +87,8 @@ export interface Patient extends Row {
|
||||
clinicTenantId: string;
|
||||
createdBy: string;
|
||||
patientCode: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
phone?: string;
|
||||
dateOfBirth?: string;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
notes?: string;
|
||||
archived?: boolean;
|
||||
}
|
||||
|
||||
@@ -7,19 +7,18 @@ export const patientSchema = z.object({
|
||||
.max(50)
|
||||
.optional()
|
||||
.transform((v) => (v ? v.toUpperCase() : undefined)),
|
||||
firstName: z.string().trim().min(1, "Ad zorunlu.").max(100),
|
||||
lastName: z.string().trim().min(1, "Soyad zorunlu.").max(100),
|
||||
phone: z
|
||||
firstName: z
|
||||
.string()
|
||||
.trim()
|
||||
.max(30)
|
||||
.max(100)
|
||||
.optional()
|
||||
.transform((v) => (v ? v : undefined)),
|
||||
dateOfBirth: z
|
||||
lastName: z
|
||||
.string()
|
||||
.trim()
|
||||
.max(100)
|
||||
.optional()
|
||||
.transform((v) => (v ? new Date(v).toISOString() : undefined)),
|
||||
.transform((v) => (v ? v : undefined)),
|
||||
notes: z
|
||||
.string()
|
||||
.trim()
|
||||
|
||||
Reference in New Issue
Block a user