diff --git a/prisma/models/city_master.prisma b/prisma/models/city_master.prisma index 3c070590032f1de56b05a3afedef8b30e5d3bb64..d1c81a6beeaf502fdc7f035f88242e5b431bf82f 100644 --- a/prisma/models/city_master.prisma +++ b/prisma/models/city_master.prisma @@ -8,6 +8,6 @@ model city_master { hospital_bank_details hospital_bank_details[] hospital_corporate hospital_corporate[] pincode_master pincode_master[] - state state_master @relation(fields: [state_id], references: [id]) - doctor_master doctor_master[] + state state_master @relation(fields: [state_id], references: [id]) + doctor_master doctor_master[] @relation("CityDoctorRelation") } \ No newline at end of file diff --git a/prisma/models/doctor_master.prisma b/prisma/models/doctor_master.prisma index 6b30e2d07db284608fd7b6470c2c390ff6831d69..a5d6fb02d6f2a6f17bb9b9671a144dee915a9504 100644 --- a/prisma/models/doctor_master.prisma +++ b/prisma/models/doctor_master.prisma @@ -1,5 +1,5 @@ model doctor_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String @db.VarChar(100) registration_no String @unique @db.VarChar(100) qualification_id String @db.Uuid @@ -12,14 +12,14 @@ model doctor_master { state_id String @db.Uuid city_id String @db.Uuid pincode_id String @db.Uuid - latitude Decimal @db.Decimal(9, 6) - longitude Decimal @db.Decimal(9, 6) + latitude Decimal? @db.Decimal(9, 6) + longitude Decimal? @db.Decimal(9, 6) created_by String @db.Uuid updated_by String @db.Uuid is_active Boolean created_at DateTime @default(now()) - updated_at DateTime - city_master city_master @relation(fields: [city_id], references: [id]) + updated_at DateTime @updatedAt + city_master city_master @relation("CityDoctorRelation", fields: [city_id], references: [id]) user_doctor_master_created_byTouser user @relation("doctor_master_created_byTouser", fields: [created_by], references: [id]) pincode_master pincode_master @relation(fields: [pincode_id], references: [id]) doctor_qualification_master doctor_qualification_master @relation(fields: [qualification_id], references: [id]) diff --git a/prisma/models/doctor_qualification_master.prisma b/prisma/models/doctor_qualification_master.prisma index 9c3ecdb2a2afcce8172531aa792fa112b068e17c..f3180a2fdfd63cf023afcb3ca311c6c7e12cc6d9 100644 --- a/prisma/models/doctor_qualification_master.prisma +++ b/prisma/models/doctor_qualification_master.prisma @@ -1,8 +1,8 @@ model doctor_qualification_master { - id String @id @db.Uuid + id String @id @default(uuid()) @db.Uuid name String is_active Boolean created_at DateTime @default(now()) - updated_at DateTime + updated_at DateTime @updatedAt doctor_master doctor_master[] } \ No newline at end of file diff --git a/src/app.module.ts b/src/app.module.ts index e857f914957e244e2e5fd4566df61c70ca025e55..891bfec2b3e29b2d7522bf032d56ee95400caa8e 100755 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -14,6 +14,7 @@ import { ThrottlerModule, ThrottlerStorage } from '@nestjs/throttler'; import { GlobalThrottlerGuard, TraceIdInterceptor } from 'nest-common-utilities'; import { MicroserviceModule } from './microservices/microservice.module' import { HospitalModule } from './hospital/hospital.module'; +import { DoctorsModule } from './doctors/doctors.module'; /** * The root application module that imports and configures all feature modules, @@ -25,7 +26,8 @@ import { HospitalModule } from './hospital/hospital.module'; ConfigModule.forRoot({ isGlobal: true }), HealthCheckModule, MicroserviceModule, - HospitalModule + HospitalModule, + DoctorsModule ], controllers: [AppController], providers: [ diff --git a/src/config/prisma.config.ts b/src/config/prisma.config.ts index 5b8b090e9b87748108304630bfe9f30d26b87809..80091538c0af71648eaa76c93c3df979efb772eb 100755 --- a/src/config/prisma.config.ts +++ b/src/config/prisma.config.ts @@ -6,6 +6,7 @@ **/ const encryptedFields = { user: ['hashemail'], + doctor_master: ['pan_no'] }; export default encryptedFields; diff --git a/src/doctors/doctors.controller.spec.ts b/src/doctors/doctors.controller.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..d23601b254e65dc20d502142a13fbad7eee32a5a --- /dev/null +++ b/src/doctors/doctors.controller.spec.ts @@ -0,0 +1,69 @@ +/** + @file <file name> + @description <description> + @author <Your Name> + @created <YYYY-MM-DD> +**/ +import { Test, TestingModule } from '@nestjs/testing'; +import { DoctorsController } from './doctors.controller'; +import { DoctorsService } from './doctors.service'; +import { UpdateDoctorsRequestDto } from './dto/update-doctors-request.dto'; +import { UpdateDoctorsResponseDto } from './dto/update-doctors-response.dto'; + +describe('DoctorsController', () => { + let doctorsController: DoctorsController; + let doctorsService: DoctorsService; + + beforeEach(async () => { + const moduleRef: TestingModule = await Test.createTestingModule({ + controllers: [DoctorsController], + providers: [ + { + provide: DoctorsService, + useValue: { + updateDoctorById: jest.fn(), + }, + }, + ], + }).compile(); + + doctorsController = moduleRef.get<DoctorsController>(DoctorsController); + doctorsService = moduleRef.get<DoctorsService>(DoctorsService); + }); + + describe('updateDoctors', () => { + it('should update doctor and return the updated doctorId', async () => { + const dto: UpdateDoctorsRequestDto = { + doctorId: '53f12c09-7be7-407b-8c5d-26892a354c26', + userId: '6f6b90a9-331e-4874-a374-ebf65a1bce2a', + doctorName: 'Dr. Prathviraj Thokal', + doctorRegNo: 'RED-1111', + doctorSpecialityId: 'b9fc627e-93f3-4b93-9ac3-3f3c3ad1e007', + doctorQualificationId: '58c1b3f1-0007-4444-aaaa-000000000007', + contactNo: '7208806389', + hprCode: 'HPR-111', + emailId: 'prathviraj@abc.com', + panNo: 'SLEUS7686D', + address: 'Mumbai', + stateId: 'f77da58f-422f-4b26-b6ab-ab02fe9cd00d', + cityId: 'e9af1491-7b1e-4010-9542-af36700d5f89', + pincode: '2c1fe645-989c-4705-91ef-36f3c78c0d08', + latitude: 73.383683, + longitude: 82.2882872, + }; + + const response: UpdateDoctorsResponseDto = { + doctorId: 'new-doctor-uuid', + }; + + (doctorsService.updateDoctorById as jest.Mock).mockResolvedValue( + response, + ); + + const result = await doctorsController.updateDoctors(dto); + + expect(doctorsService.updateDoctorById).toHaveBeenCalledWith(dto); + expect(result).toEqual(response); + }); + }); +}); diff --git a/src/doctors/doctors.controller.ts b/src/doctors/doctors.controller.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0d5e8b4fffd5892dfadb7f25f5d3d4224e9bbeb --- /dev/null +++ b/src/doctors/doctors.controller.ts @@ -0,0 +1,76 @@ +/** + @file <file name> + @description <description> + @author <Your Name> + @created <YYYY-MM-DD> +**/ + +import { + Controller, + Post, + Body, +} from '@nestjs/common'; +import { + Logger, +} from 'nest-common-utilities'; +import { ApiOperation, ApiResponse } from '@nestjs/swagger'; +import { DoctorsService } from './doctors.service'; +import { UpdateDoctorsRequestDto } from './dto/update-doctors-request.dto'; +import { UpdateDoctorsResponseDto } from './dto/update-doctors-response.dto'; + +/** + * Controller to manage doctor-related API endpoints. + */ + +/** + * + */ +@Controller('doctors') +export class DoctorsController { + private logger = new Logger(DoctorsController.name); + + /** + * Initializes the DoctorsController. + * + * @param doctorsService - Service for handling doctors business logic. + */ + + /** + * Service for handling doctor-related API endpoints. + * + * @param doctorsService - Service providing business logic for doctor + * operations. + */ + constructor(private readonly doctorsService: DoctorsService) {} + + /** + * Update doctor master based on the request parameters. + * + * @param {UpdateDoctorsRequestDto} UpdateDoctorsRequestDto - The + * data transfer object containing the information for updating doctor. + * @returns {Promise<UpdateDoctorsResponseDto>} The updated + * doctor information. + */ + + /** + * Handles the HTTP POST request to update an existing doctor's details. + * Delegates the logic to the doctorsService. Returns the updated doctor + * information in the response. + * + * @param updateDoctorsRequestDto - The DTO containing doctor update data. + * @returns A promise that resolves to the updated doctor response DTO. + */ + @Post('/update') + @ApiOperation({ summary: 'Update Doctor details' }) + @ApiResponse({ + status: 200, + description: 'Doctor Details Updated Successfully.', + type: UpdateDoctorsResponseDto, + }) + @ApiResponse({ status: 400, description: 'Bad Request.' }) + async updateDoctors( + @Body() updateDoctorsRequestDto: UpdateDoctorsRequestDto, + ): Promise<UpdateDoctorsResponseDto> { + return this.doctorsService.updateDoctorById(updateDoctorsRequestDto); + } +} diff --git a/src/doctors/doctors.module.ts b/src/doctors/doctors.module.ts new file mode 100644 index 0000000000000000000000000000000000000000..06a1a70e6f0463f62a3535e7bb02743012dfef5b --- /dev/null +++ b/src/doctors/doctors.module.ts @@ -0,0 +1,21 @@ +/** + @file <file name> + @description <description> + @author <Your Name> + @created <YYYY-MM-DD> +**/ + +import { Module } from '@nestjs/common'; +import { DoctorsController } from './doctors.controller'; +import { PrismaModule } from '../prisma/prisma.module' +import { DoctorsService } from './doctors.service'; + +/** + * + */ +@Module({ + imports : [PrismaModule], + controllers: [DoctorsController], + providers: [DoctorsService] +}) +export class DoctorsModule { } \ No newline at end of file diff --git a/src/doctors/doctors.service.spec.ts b/src/doctors/doctors.service.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..566649f465ffb3836d6f91818848ee7e4f193335 --- /dev/null +++ b/src/doctors/doctors.service.spec.ts @@ -0,0 +1,121 @@ +/** + @file <file name> + @description <description> + @author <Your Name> + @created <YYYY-MM-DD> +**/ +import { Test, TestingModule } from '@nestjs/testing'; +import { DoctorsService } from './doctors.service'; +import { PrismaService } from '../prisma/prisma.service'; +import { AppException } from 'nest-common-utilities'; +import { UpdateDoctorsRequestDto } from './dto/update-doctors-request.dto'; + +describe('DoctorsService', () => { + let doctorsService: DoctorsService; + let prismaService: PrismaService; + + beforeEach(async () => { + const moduleRef: TestingModule = await Test.createTestingModule({ + providers: [ + DoctorsService, + { + provide: PrismaService, + useValue: { + doctor_master: { + findUnique: jest.fn(), + update: jest.fn(), + create: jest.fn(), + }, + }, + }, + ], + }).compile(); + + doctorsService = moduleRef.get<DoctorsService>(DoctorsService); + prismaService = moduleRef.get<PrismaService>(PrismaService); + }); + + const dto: UpdateDoctorsRequestDto = { + doctorId: '53f12c09-7be7-407b-8c5d-26892a354c26', + userId: '6f6b90a9-331e-4874-a374-ebf65a1bce2a', + doctorName: 'Dr. Prathviraj Thokal', + doctorRegNo: 'RED-1111', + doctorSpecialityId: 'b9fc627e-93f3-4b93-9ac3-3f3c3ad1e007', + doctorQualificationId: '58c1b3f1-0007-4444-aaaa-000000000007', + contactNo: '7208806389', + hprCode: 'HPR-111', + emailId: 'prathviraj@abc.com', + panNo: 'SLEUS7686D', + address: 'Mumbai', + stateId: 'f77da58f-422f-4b26-b6ab-ab02fe9cd00d', + cityId: 'e9af1491-7b1e-4010-9542-af36700d5f89', + pincode: '2c1fe645-989c-4705-91ef-36f3c78c0d08', + latitude: 73.383683, + longitude: 82.2882872, + }; + + it('should throw AppException if doctor not found', async () => { + (prismaService.doctor_master.findUnique as jest.Mock).mockResolvedValue( + null, + ); + + await expect(doctorsService.updateDoctorById(dto)).rejects.toThrow( + AppException, + ); + + expect(prismaService.doctor_master.findUnique).toHaveBeenCalledWith({ + where: { id: dto.doctorId }, + }); + }); + + it('should deactivate old doctor and create new doctor record', async () => { + (prismaService.doctor_master.findUnique as jest.Mock).mockResolvedValue({ + id: dto.doctorId, + }); + + (prismaService.doctor_master.update as jest.Mock).mockResolvedValue({ + id: dto.doctorId, + is_active: false, + }); + + const newDoctorRecord = { id: 'new-doctor-uuid' }; + (prismaService.doctor_master.create as jest.Mock).mockResolvedValue( + newDoctorRecord, + ); + + const result = await doctorsService.updateDoctorById(dto); + + expect(prismaService.doctor_master.update).toHaveBeenCalledWith({ + where: { id: dto.doctorId }, + data: expect.objectContaining({ + is_active: false, + updated_by: dto.userId, + updated_at: expect.any(Date), + }), + }); + + expect(prismaService.doctor_master.create).toHaveBeenCalledWith({ + data: expect.objectContaining({ + name: dto.doctorName, + registration_no: dto.doctorRegNo, + speciality_id: dto.doctorSpecialityId, + qualification_id: dto.doctorQualificationId, + doctor_contact: dto.contactNo, + hpr_code: dto.hprCode, + doctor_email_id: dto.emailId, + pan_no: dto.panNo, + address: dto.address, + pincode_id: dto.pincode, + latitude: dto.latitude, + longitude: dto.longitude, + state_id: dto.stateId, + city_id: dto.cityId, + is_active: true, + created_by: dto.userId, + updated_by: dto.userId, + }), + }); + + expect(result).toEqual({ doctorId: newDoctorRecord.id }); + }); +}); diff --git a/src/doctors/doctors.service.ts b/src/doctors/doctors.service.ts new file mode 100644 index 0000000000000000000000000000000000000000..8360f41b17018a717c5e30c065c154913a5041b8 --- /dev/null +++ b/src/doctors/doctors.service.ts @@ -0,0 +1,125 @@ +/** + @file <file name> + @description <description> + @author <Your Name> + @created <YYYY-MM-DD> +**/ + +import { Injectable } from '@nestjs/common'; +import { PrismaService } from '../prisma/prisma.service'; +import { Logger, AppException, errorCode } from 'nest-common-utilities'; +import { UpdateDoctorsRequestDto } from './dto/update-doctors-request.dto'; +import { UpdateDoctorsResponseDto } from './dto/update-doctors-response.dto'; + +/** + * Service to encapsulate doctors + * domain logic such as create doctor update doctor. + */ + +/** + * + */ +@Injectable() +export class DoctorsService { + private logger = new Logger(DoctorsService.name); + + /** + * Constructs the DoctorsService. + * + * @param prisma - The Prisma service for database interactions. + */ + constructor(private prisma: PrismaService) {} + + /** + * Update the doctor details by using doctor ID + * + * @param {UpdateDoctorsRequestDto} dto - The data transfer + * object containing the doctor information to be updated. + * @returns {Promise<UpdateDoctorsResponseDto>} A promise + * that resolves to the updated doctor's data. + */ + + /** + * Updates an existing doctor record by deactivating the old entry and + * creating a new one with updated details. + * + * This method checks if the doctor with the given ID exists. If not, + * it throws an exception. If the doctor exists, it marks the current + * record as inactive, then inserts a new record with the updated data. + * + * @param {UpdateDoctorsRequestDto} dto - The DTO containing updated + * doctor information. + * + * @returns {Promise<UpdateDoctorsResponseDto>} The response containing + * the ID of the newly created doctor record. + * + * @throws {AppException} If no doctor is found with the given ID. + */ + async updateDoctorById( + dto: UpdateDoctorsRequestDto, + ): Promise<UpdateDoctorsResponseDto> { + const { + doctorId, + userId, + doctorName, + doctorRegNo, + doctorSpecialityId, + doctorQualificationId, + contactNo, + hprCode, + emailId, + panNo, + address, + pincode, + latitude, + longitude, + stateId, + cityId, + } = dto; + const existingDoctor = await this.prisma.doctor_master.findUnique({ + where: { id: doctorId }, + }); + + if (!existingDoctor) { + throw new AppException( + `Doctor with ID ${doctorId} not found`, + errorCode.DATA_NOT_FOUND, + ); + } + + // Deactivate the old doctor record + await this.prisma.doctor_master.update({ + where: { id: doctorId }, + data: { + is_active: false, + updated_by: userId, + updated_at: new Date(), + }, + }); + + const data = { + name: doctorName ?? '', + registration_no: doctorRegNo ?? '', + speciality_id: doctorSpecialityId ?? '', + qualification_id: doctorQualificationId ?? '', + doctor_contact: contactNo ?? '', + hpr_code: hprCode ?? '', + doctor_email_id: emailId ?? '', + pan_no: panNo, + address: address ?? '', + pincode_id: pincode ?? '', + latitude: latitude ?? null, + longitude: longitude ?? null, + state_id: stateId ?? '', + city_id: cityId ?? '', + is_active: true, + created_by: userId ?? '', + updated_by: userId ?? '', + }; + //@ts-ignore + const newDoctor = await this.prisma.doctor_master.create({ data }); + return { + doctorId: newDoctor.id, + }; + } +} diff --git a/src/doctors/dto/update-doctors-request.dto.ts b/src/doctors/dto/update-doctors-request.dto.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ca09375b7da318715a0536b9d0a5318c1e78263 --- /dev/null +++ b/src/doctors/dto/update-doctors-request.dto.ts @@ -0,0 +1,155 @@ +/** + @file <file name> + @description <description> + @author <Your Name> + @created <YYYY-MM-DD> +**/ + +import { + IsString, + IsEmail, + IsOptional, + IsNumber, + IsUUID, + IsNotEmpty, +} from 'class-validator'; +import { ApiProperty } from '@nestjs/swagger'; +import { Type } from 'class-transformer'; + +/** + * + */ +export class UpdateDoctorsRequestDto { + @IsUUID() + @IsNotEmpty({ message: 'Doctor ID must be a valid UUID' }) + @ApiProperty({ example: 'uuid', description: 'Doctor ID' }) + doctorId: string; + + @IsUUID() + @IsNotEmpty({ message: 'User ID must be a valid UUID' }) + @ApiProperty({ + example: '2733a326-f4e2-4005-ad18-3b8f67a7613c', + description: 'User ID', + }) + userId: string; + + @IsOptional() + @IsString({ message: 'Doctor name must be a string' }) + @ApiProperty({ + example: 'Dr. Prathviraj Thokal', + description: 'Name of the doctor', + }) + doctorName?: string; + + @IsOptional() + @IsString({ message: 'Doctor registration number must be a string' }) + @ApiProperty({ + example: 'DRREG-112', + description: 'Registration number of the doctor', + }) + doctorRegNo?: string; + + @IsOptional() + @IsUUID() + @IsNotEmpty({ message: 'Doctor speciality ID must be a valid UUID' }) + @ApiProperty({ + example: '2733a326-f4e2-4005-ad18-3b8f67a7613c', + description: 'Doctor speciality ID', + }) + doctorSpecialityId?: string; + + @IsOptional() + @IsUUID() + @IsNotEmpty({ message: 'Doctor qualification ID must be a valid UUID' }) + @ApiProperty({ + example: '2733a326-f4e2-4005-ad18-3b8f67a7613c', + description: 'Doctor qualification ID', + }) + doctorQualificationId?: string; + + @IsOptional() + @IsString({ message: 'Contact number must be a string' }) + @ApiProperty({ + example: '7208806389', + description: 'Contact number of the doctor', + }) + contactNo?: string; + + @IsOptional() + @IsString({ message: 'HPR code must be a string' }) + @ApiProperty({ + example: 'HPR-112', + description: 'HPR code of the doctor', + }) + hprCode?: string; + + @IsOptional() + @IsEmail({}, { message: 'Invalid email format' }) + @ApiProperty({ + example: 'niveus@example.com', + description: 'Email of the doctor', + }) + emailId?: string; + + @IsOptional() + @IsString({ message: 'Pan number must be a string' }) + @ApiProperty({ + example: 'HSLDY8769P', + description: 'Pan number of the doctor', + }) + panNo?: string; + + @IsOptional() + @IsString({ message: 'Address must be a string' }) + @ApiProperty({ + example: 'Mumbai', + description: 'Address of the doctor', + }) + address?: string; + + @IsOptional() + @IsUUID() + @IsNotEmpty({ message: 'Pincode ID must be a valid UUID' }) + @ApiProperty({ + example: '2733a326-f4e2-4005-ad18-3b8f67a7613c', + description: 'Pincode ID', + }) + pincode?: string; + + @IsOptional() + @Type(() => Number) + @IsNumber() + @ApiProperty({ + example: 76.22222, + description: 'Latitude', + }) + latitude?: number; + + @IsOptional() + @Type(() => Number) + @IsNumber() + @ApiProperty({ + example: 76.22222, + description: 'Longitude', + }) + longitude?: number; + + //State and city ID + @IsOptional() + @IsUUID() + @IsNotEmpty({ message: 'State ID must be a valid UUID' }) + @ApiProperty({ + example: '2733a326-f4e2-4005-ad18-3b8f67a7613c', + description: 'State ID', + }) + stateId?: string; + + @IsOptional() + @IsUUID() + @IsNotEmpty({ message: 'City ID must be a valid UUID' }) + @ApiProperty({ + example: '2733a326-f4e2-4005-ad18-3b8f67a7613c', + description: 'City ID', + }) + cityId?: string; +} diff --git a/src/doctors/dto/update-doctors-response.dto.ts b/src/doctors/dto/update-doctors-response.dto.ts new file mode 100644 index 0000000000000000000000000000000000000000..bb7c14d33f3aaa71074388a393c363efceec191f --- /dev/null +++ b/src/doctors/dto/update-doctors-response.dto.ts @@ -0,0 +1,21 @@ +/** + @file <file name> + @description <description> + @author <Your Name> + @created <YYYY-MM-DD> +**/ + +import { Expose } from 'class-transformer'; +import { ApiProperty } from '@nestjs/swagger'; + +/** + * + */ +export class UpdateDoctorsResponseDto { + @Expose() + @ApiProperty({ + example: '550e8400-e29b-41d4-a716-446655440002', + description: 'UUID of the Doctor', + }) + doctorId: string; +} \ No newline at end of file diff --git a/src/seed.ts b/src/seed.ts index fc1e54908881fc3f55d354b046898f241459b9d7..30ad2f597de9ed17b6821f07bb77465030828f24 100644 --- a/src/seed.ts +++ b/src/seed.ts @@ -26,6 +26,20 @@ const userData = [ password: '123456', role: 'user', }, + { + name: 'Prathviraj', + email: 'prathvirajadmin@niveus.com', + hashemail: 'prathvirajadmin@niveus.com', + password: '123456', + role: 'admin', + }, + { + name: 'Prathvirajuser', + email: 'prathvirajuser@niveus.com', + hashemail: 'prathvirajuser@niveus.com', + password: '123456', + role: 'user', + }, ]; const hospitalSpecialtyMasterData = [ @@ -558,6 +572,59 @@ const hospitalForeignKeys: ForeignKeyConfig<typeof hospitals[0]>[] = [ ]; +const doctorSpecialityMaster = [ + { name: "General Practitioner (GP)", is_active: true }, + { name: "Pediatrician", is_active: true }, + { name: "Dermatologist", is_active: true }, + { name: "Cardiologist", is_active: true }, + { name: "Ophthalmologist", is_active: true }, + { name: "Orthopaedic Surgeon", is_active: true }, + { name: "Neurologist", is_active: true }, + { name: "Psychiatrist", is_active: true }, + { name: "OBS/GYN", is_active: true }, + { name: "Anesthesiologist", is_active: true }, + { name: "Radiologist", is_active: true }, + { name: "ENT Specialist", is_active: true }, + { name: "Urologist", is_active: true }, + { name: "Endocrinologist", is_active: true }, + { name: "Gastroenterologist", is_active: true }, + { name: "Pulmonologist", is_active: true }, + { name: "Nephrologist", is_active: true }, + { name: "Oncologist", is_active: true }, + { name: "Rheumatologist", is_active: true }, + { name: "Allergist/Immunologist", is_active: true }, + { name: "Emergency Medicine Physician", is_active: true }, + { name: "Pathologist", is_active: true }, + { name: "Infectious Disease Specialist", is_active: true }, +]; + +const doctorQualifications = [ + { name: 'BHMS', is_active: true }, + { name: 'BAMS', is_active: true }, + { name: 'BUMS', is_active: true }, + { name: 'BPT', is_active: true }, + { name: 'MPT', is_active: true }, + { name: 'BIMS', is_active: true }, + { name: 'MBBS', is_active: true }, + { name: 'MD', is_active: true }, + { name: 'MS', is_active: true }, + { name: 'BDS', is_active: true }, + { name: 'MDS', is_active: true }, + { name: 'DHMS', is_active: true }, + { name: 'DA', is_active: true }, + { name: 'DCH', is_active: true }, + { name: 'DGO', is_active: true }, + { name: 'DLO', is_active: true }, + { name: 'DMRD', is_active: true }, + { name: 'DO', is_active: true }, + { name: 'PGDMCH', is_active: true }, + { name: 'PGDIM', is_active: true }, + { name: 'PGMT', is_active: true }, + { name: 'PGD-MLRN', is_active: true }, + { name: 'PGD-CM', is_active: true }, + { name: 'PGD-OTN', is_active: true }, + { name: 'BMLT', is_active: true } +]; /** * Seeds the user model with initial data. @@ -651,6 +718,9 @@ async function run() { hospitalForeignKeys ); + await seedModel(prisma, 'doctor_speciality_master' as keyof PrismaService, doctorSpecialityMaster); + await seedModel(prisma, 'doctor_qualification_master' as keyof PrismaService, doctorQualifications); + console.log('Data seeded successfully.'); } catch (error) { console.error('Error seeding data:', error);