From ca4ea87d37b2f573c24de26d54f0225ed1394d48 Mon Sep 17 00:00:00 2001
From: kovakmedya
Date: Thu, 21 May 2026 23:01:52 +0300
Subject: [PATCH] feat(patients): drop phone/dateOfBirth, name fields optional
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
---
src/app/(dashboard)/jobs/[jobId]/page.tsx | 20 ++++----
.../patients/components/patient-form.tsx | 26 ++--------
.../patients/components/patients-table.tsx | 47 ++++---------------
src/lib/appwrite/patient-actions.ts | 6 ---
src/lib/appwrite/schema.ts | 6 +--
src/lib/validation/patient.ts | 11 ++---
6 files changed, 32 insertions(+), 84 deletions(-)
diff --git a/src/app/(dashboard)/jobs/[jobId]/page.tsx b/src/app/(dashboard)/jobs/[jobId]/page.tsx
index d7cd44c..717f838 100644
--- a/src/app/(dashboard)/jobs/[jobId]/page.tsx
+++ b/src/app/(dashboard)/jobs/[jobId]/page.tsx
@@ -100,10 +100,13 @@ export default async function JobDetailPage({
{counterpartLabel}: {counterpart?.companyName ?? "—"}