added DR update API
9 open threads
9 open threads
Merge request reports
Activity
requested review from @roshan.suvarnkar
assigned to @prathviraj.thokal
11 IsOptional, 12 IsNumber, 13 IsUUID, 14 IsNotEmpty, 15 } from 'class-validator'; 16 import { ApiProperty } from '@nestjs/swagger'; 17 import { Type } from 'class-transformer'; 18 19 /** 20 * 21 */ 22 export class UpdateDoctorsRequestDto { 23 @IsUUID() 24 @IsNotEmpty({ message: 'Doctor ID must be a valid UUID' }) 25 @ApiProperty({ example: 'uuid', description: 'Doctor ID' }) 26 doctorId?: string; if this is mandatory, remove ? same for all fields, if it is non mandatory then give optional validator
Edited by Roshan Suvarnkarchanged this line in version 4 of the diff
- src/doctors/doctors.controller.spec.ts 0 → 100644
51 latitude: 73.383683, 52 longitude: 82.2882872, 53 }; 54 55 const response: UpdateDoctorsResponseDto = { 56 doctorId: 'new-doctor-uuid', 57 }; 58 59 (doctorsService.updateDoctorById as jest.Mock).mockResolvedValue(response); 60 61 const result = await doctorsController.updateDoctors(dto); 62 63 expect(doctorsService.updateDoctorById).toHaveBeenCalledWith(dto); 64 expect(result).toEqual(response); 65 }); 66 }); - src/doctors/doctors.controller.ts 0 → 100644
44 /** 45 * Update doctor master based on the request parameters. 46 * 47 * @param {UpdateDoctorsRequestDto} UpdateDoctorsRequestDto - The data transfer object containing the information for updating doctor. 48 * @returns {Promise<UpdateDoctorsResponseDto>} The updated doctor information. 49 */ 50 51 /** 52 * 53 * @param UpdateDoctorsRequestDto 54 */ 55 @Post('/update') 56 @ApiOperation({ summary: 'Update Doctor details' }) 57 @ApiResponse({ 58 status: 200, 59 description: 'Doctor Details Updated Successfully.', - src/doctors/doctors.service.ts 0 → 100644
60 longitude, 61 stateId, 62 cityId, 63 } = dto; 64 const existingDoctor = await this.prisma.doctor_master.findUnique({ 65 where: { id: doctorId }, 66 }); 67 68 if (!existingDoctor) { 69 throw new AppException( 70 `Doctor with ID ${doctorId} not found`, 71 errorCode.DATA_NOT_FOUND, 72 ); 73 } 74 75 if (existingDoctor?.registration_no == doctorRegNo) { changed this line in version 5 of the diff
- src/doctors/doctors.controller.ts 0 → 100644
49 */ 50 51 /** 52 * 53 * @param UpdateDoctorsRequestDto 54 */ 55 @Post('/update') 56 @ApiOperation({ summary: 'Update Doctor details' }) 57 @ApiResponse({ 58 status: 200, 59 description: 'Doctor Details Updated Successfully.', 60 type: UpdateDoctorsResponseDto 61 }) 62 @ApiResponse({ status: 400, description: 'Bad Request.' }) 63 async updateDoctors( 64 @Body() UpdateDoctorsRequestDto: UpdateDoctorsRequestDto, changed this line in version 6 of the diff
added 5 commits
-
b7980027...cb3bb791 - 2 commits from branch
develop-beta
- 29390cd8 - Merge branch 'develop-beta' of...
- 5502c037 - ES lint changes
- d27bc12c - Added default
Toggle commit list-
b7980027...cb3bb791 - 2 commits from branch
79 @IsString({ message: 'HPR code must be a string' }) 80 @ApiProperty({ 81 example: 'HPR-112', 82 description: 'HPR code of the doctor', 83 }) 84 hprCode?: string; 85 86 @IsOptional() 87 @IsEmail({}, { message: 'Invalid email format' }) 88 @ApiProperty({ 89 example: 'niveus@example.com', 90 description: 'Email of the doctor', 91 }) 92 emailId?: string; 93 94 // @IsOptional() changed this line in version 9 of the diff
- src/doctors/doctors.service.ts 0 → 100644
96 updated_at: new Date(), 97 }, 98 }); 99 100 const data = { 101 name: doctorName ?? '', 102 registration_no: doctorRegNo ?? '', 103 speciality_id: doctorSpecialityId ?? '', 104 qualification_id: doctorQualificationId ?? '', 105 doctor_contact: contactNo ?? '', 106 hpr_code: hprCode ?? '', 107 doctor_email_id: emailId ?? '', 108 pan_no: panNo, 109 address: address ?? '', 110 pincode_id: pincode ?? '', 111 latitude: latitude ?? 33.34444, changed this line in version 9 of the diff
- src/doctors/doctors.service.ts 0 → 100644
97 }, 98 }); 99 100 const data = { 101 name: doctorName ?? '', 102 registration_no: doctorRegNo ?? '', 103 speciality_id: doctorSpecialityId ?? '', 104 qualification_id: doctorQualificationId ?? '', 105 doctor_contact: contactNo ?? '', 106 hpr_code: hprCode ?? '', 107 doctor_email_id: emailId ?? '', 108 pan_no: panNo, 109 address: address ?? '', 110 pincode_id: pincode ?? '', 111 latitude: latitude ?? 33.34444, 112 longitude: longitude ?? 34.44444, changed this line in version 9 of the diff
- src/doctors/doctors.service.ts 0 → 100644
96 updated_at: new Date(), 97 }, 98 }); 99 100 const data = { 101 name: doctorName ?? '', 102 registration_no: doctorRegNo ?? '', 103 speciality_id: doctorSpecialityId ?? '', 104 qualification_id: doctorQualificationId ?? '', 105 doctor_contact: contactNo ?? '', 106 hpr_code: hprCode ?? '', 107 doctor_email_id: emailId ?? '', 108 pan_no: panNo, 109 address: address ?? '', 110 pincode_id: pincode ?? '', 111 latitude: latitude ?? '', changed this line in version 10 of the diff
Please register or sign in to reply