Skip to content
Snippets Groups Projects

added DR update API

9 open threads

Merge request reports

Approval is optional
Merge blocked: 1 check failed
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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;
  • 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 });
  • 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.',
  • 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) {
  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • 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,
  • added 1 commit

    Compare with previous version

  • added 5 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • 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()
  • 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,
  • 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,
  • added 1 commit

    Compare with previous version

  • 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 ?? '',
  • added 1 commit

    Compare with previous version

  • Please register or sign in to reply
    Loading