From d23cf9b857a204f3674a56027d091fd880668567 Mon Sep 17 00:00:00 2001 From: saridsa2 Date: Wed, 15 Apr 2026 10:31:07 +0530 Subject: [PATCH] fix(seed): clinic fields use the real Clinic schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Seed script was writing weekdayHours / saturdayHours / sundayHours + requiredDocuments as strings — neither exist on Clinic that way. Switched to per-day booleans + opensAt/closesAt. requiredDocuments is a relation, so dropped from the clinic payload. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/seed-new-entities.ts | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/scripts/seed-new-entities.ts b/scripts/seed-new-entities.ts index e93aba6..1ee58fd 100644 --- a/scripts/seed-new-entities.ts +++ b/scripts/seed-new-entities.ts @@ -5,11 +5,13 @@ * Prerequisites: doctors already seeded via seed-data.ts * * Platform field mapping (SDK name → platform name): - * Clinic: address→addressCustom, operatingHoursWeekday→weekdayHours, - * operatingHoursSaturday→saturdayHours, operatingHoursSunday→sundayHours, + * Clinic: address→addressCustom, + * per-day booleans openMonday..openSunday + opensAt/closesAt (HH:MM), * clinicStatus→status, onlineBookingEnabled→onlineBooking, * arriveEarlyMinutes→arriveEarlyMin, paymentCash→acceptsCash, - * paymentCard→acceptsCard, paymentUpi→acceptsUpi + * paymentCard→acceptsCard, paymentUpi→acceptsUpi. + * requiredDocuments is a RELATION (ClinicRequiredDocument); seed rows + * separately — not a string on the Clinic itself. * HealthPackage: packageDepartment→department, durationMinutes→durationMin, isActive→active * InsurancePartner: planTypes→planTypesAccepted */ @@ -68,15 +70,16 @@ async function main() { }, phone: { primaryPhoneNumber: '08041234567', primaryPhoneCallingCode: '+91', primaryPhoneCountryCode: 'IN' }, email: { primaryEmail: 'koramangala@globalhospital.com' }, - weekdayHours: '8:00 AM – 8:00 PM', - saturdayHours: '8:00 AM – 8:00 PM', - sundayHours: '9:00 AM – 2:00 PM', + openMonday: true, openTuesday: true, openWednesday: true, + openThursday: true, openFriday: true, openSaturday: true, openSunday: true, + opensAt: '08:00', + closesAt: '20:00', status: 'ACTIVE', walkInAllowed: true, onlineBooking: true, cancellationWindowHours: 4, arriveEarlyMin: 15, - requiredDocuments: 'ID proof + medical records', + // requiredDocuments is a relation (ClinicRequiredDocument) — seed separately acceptsCash: 'YES', acceptsCard: 'YES', acceptsUpi: 'YES', @@ -95,15 +98,15 @@ async function main() { }, phone: { primaryPhoneNumber: '08041234568', primaryPhoneCallingCode: '+91', primaryPhoneCountryCode: 'IN' }, email: { primaryEmail: 'whitefield@globalhospital.com' }, - weekdayHours: '8:00 AM – 8:00 PM', - saturdayHours: '8:00 AM – 8:00 PM', - sundayHours: 'Closed', + openMonday: true, openTuesday: true, openWednesday: true, + openThursday: true, openFriday: true, openSaturday: true, openSunday: false, + opensAt: '08:00', + closesAt: '20:00', status: 'ACTIVE', walkInAllowed: true, onlineBooking: true, cancellationWindowHours: 4, arriveEarlyMin: 15, - requiredDocuments: 'ID proof + medical records', acceptsCash: 'YES', acceptsCard: 'YES', acceptsUpi: 'YES', @@ -122,15 +125,15 @@ async function main() { }, phone: { primaryPhoneNumber: '08041234569', primaryPhoneCallingCode: '+91', primaryPhoneCountryCode: 'IN' }, email: { primaryEmail: 'indiranagar@globalhospital.com' }, - weekdayHours: '9:00 AM – 7:00 PM', - saturdayHours: '9:00 AM – 7:00 PM', - sundayHours: '10:00 AM – 1:00 PM', + openMonday: true, openTuesday: true, openWednesday: true, + openThursday: true, openFriday: true, openSaturday: true, openSunday: true, + opensAt: '09:00', + closesAt: '19:00', status: 'ACTIVE', walkInAllowed: true, onlineBooking: true, cancellationWindowHours: 4, arriveEarlyMin: 15, - requiredDocuments: 'ID proof + medical records', acceptsCash: 'YES', acceptsCard: 'YES', acceptsUpi: 'YES',