diff --git a/src/seed.ts b/src/seed.ts index 564bd2f232f15238ed80f0440362804fb984a1ca..1cc95f4a330621de93233a886aae8c708b02f438 100644 --- a/src/seed.ts +++ b/src/seed.ts @@ -1560,6 +1560,195 @@ const doctorQualificationsForeignKeys: ForeignKeyConfig< }, ]; +//doctor_master + +const doctorMasterData: Array<{ + name: string; + doctor_email_id: string; + doctor_contact: string; + registration_no: string; + hpr_code: string; + pan_no: string; + address: string; + pincodeName: string; + specialityName: string; + latitude: number; + longitude: number; + speciality_id?: string; + pincode_id?: string; + userName: string; + created_by?: string; + updated_by?: string; +}> = [ + { + name: 'Dr. Fatima Khan', + doctor_email_id: 'f.khan@apollo.com', + doctor_contact: '+917845612378', + registration_no: 'DL301246', + hpr_code: 'DLHPR11224', + pan_no: 'JKLPO9876M', + address: 'New Delhi', + pincodeName: '400078', + specialityName: 'General Practitioner (GP)', + latitude: 28.56789, + longitude: 77.21, + userName: 'Prathviraj', + }, + { + name: 'Dr. Sneha Joshi', + doctor_email_id: 's.joshi@kokilaben.com', + doctor_contact: '+919987654321', + registration_no: 'MH456321', + hpr_code: 'MHHPR5533', + pan_no: 'BBKPS4321H', + address: 'Mumbai, Maharashtra', + pincodeName: '400033', + specialityName: 'Pediatrician', + latitude: 19.0760, + longitude: 72.8777, + userName: 'Prathviraj' + }, + { + name: 'Dr. Arvind Nair', + doctor_email_id: 'a.nair@apollochennai.com', + doctor_contact: '+919999998888', + registration_no: 'TN224466', + hpr_code: 'TNHPR9922', + pan_no: 'CCDPN3344E', + address: 'Chennai, Tamil Nadu', + pincodeName: '400079', + specialityName: 'Cardiologist', + latitude: 13.0827, + longitude: 80.2707, + userName: 'Prathviraj' + }, + { + name: 'Dr. Reema Thakur', + doctor_email_id: 'r.thakur@fortischd.com', + doctor_contact: '+917001002003', + registration_no: 'PB102938', + hpr_code: 'PBHPR3344', + pan_no: 'EEMPQ5678N', + address: 'Chandigarh', + pincodeName: '400604', + specialityName: 'Ophthalmologist', + latitude: 30.7333, + longitude: 76.7794, + userName: 'Prathviraj' + }, + { + name: 'Dr. Rajesh Shetty', + doctor_email_id: 'rajesh.shetty@manipal.com', + doctor_contact: '+918765432101', + registration_no: 'KA998877', + hpr_code: 'KAHPR7766', + pan_no: 'AABPS1111M', + address: 'Udupi, Karnataka', + pincodeName: '400012', + specialityName: 'Neurologist', + latitude: 13.339168, + longitude: 74.742142, + userName: 'Prathviraj' + } + ]; + + +const doctorMasterForeignKeys: ForeignKeyConfig< + (typeof doctorMasterData)[0] +>[] = [ + { + parentModel: 'pincode_master', + parentLookupKey: 'name', + childReferenceKey: 'pincodeName', + childForeignKeyField: 'pincode_id', + }, + { + parentModel: 'doctor_speciality_master', + parentLookupKey: 'name', + childReferenceKey: 'specialityName', + childForeignKeyField: 'speciality_id', + }, + { + parentModel: 'user', + parentLookupKey: 'name', + childReferenceKey: 'userName', + childForeignKeyField: 'created_by', + }, + { + parentModel: 'user', + parentLookupKey: 'name', + childReferenceKey: 'userName', + childForeignKeyField: 'updated_by', + }, + ]; + + +//doctor_qualification seed +const doctorQualificationData: Array<{ + doctor_id?: string; + doctorName: string; + doctor_qualification_id?: string; + doctorQualificationName: string; + userName: string; + created_by?: string; + updated_by?: string; +}> = [ + { + doctorName: 'Dr. Fatima Khan', + doctorQualificationName: 'MBBS', + userName: 'Prathviraj', + }, + { + doctorName: 'Dr. Sneha Joshi', + doctorQualificationName: 'BMLT', + userName: 'Prathviraj', + }, + { + doctorName: 'Dr. Arvind Nair', + doctorQualificationName: 'MD', + userName: 'Prathviraj', + }, + { + doctorName: 'Dr. Rajesh Shetty', + doctorQualificationName: 'DGO', + userName: 'Prathviraj', + }, + { + doctorName: 'Dr. Reema Thakur', + doctorQualificationName: 'BDS', + userName: 'Prathviraj', + }, + ]; + +const doctorQualificationForeignKeys: ForeignKeyConfig< + (typeof doctorQualificationData)[0] +>[] = [ + { + parentModel: 'doctor_master', + parentLookupKey: 'name', + childReferenceKey: 'doctorName', + childForeignKeyField: 'doctor_id', + }, + { + parentModel: 'doctor_qualification_master', + parentLookupKey: 'name', + childReferenceKey: 'doctorQualificationName', + childForeignKeyField: 'doctor_qualification_id', + }, + { + parentModel: 'user', + parentLookupKey: 'name', + childReferenceKey: 'userName', + childForeignKeyField: 'created_by', + }, + { + parentModel: 'user', + parentLookupKey: 'name', + childReferenceKey: 'userName', + childForeignKeyField: 'updated_by', + }, + ]; + /** * Seeds the user model with initial data. */ @@ -1683,6 +1872,21 @@ async function run() { doctorQualificationsForeignKeys, ); + await seedWithMultipleParents( + prisma, + 'doctor_master', + doctorMasterData, + doctorMasterForeignKeys + ); + + await seedWithMultipleParents( + prisma, + 'doctor_qualifications', + doctorQualificationData, + doctorQualificationForeignKeys + ); + + console.log('Data seeded successfully.'); } catch (error) { console.error('Error seeding data:', error);