Skip to content
Snippets Groups Projects
Commit fbe41cd6 authored by Prathviraj Suryakant Thokal's avatar Prathviraj Suryakant Thokal
Browse files

Changes in DTO

parent 90e9f433
Branches
No related tags found
1 merge request!31Changes in test cases
/**
@file <file name>
@description <description>
@author <Your Name>
@created <YYYY-MM-DD>
**/
* @file get-hospital-list-response.dto.ts
* @description DTO for hospital list response used in GetHospitals API
* @author Prathviraj Thokal
* @created 2024-06-23
*/
import { Expose, Type } from 'class-transformer';
import { ApiProperty, PartialType } from '@nestjs/swagger';
import { ApiProperty } from '@nestjs/swagger';
import { HospitalItemDto } from './hospital-list-item.dto';
export class GetHospitalListResponseDto extends PartialType(HospitalItemDto) {
}
/**
*
*/
export class GetHospitalsResponseDto {
@Expose()
@ApiProperty({
......@@ -25,10 +17,10 @@ export class GetHospitalsResponseDto {
totalCount: number;
@Expose()
@Type(() => GetHospitalListResponseDto)
@Type(() => HospitalItemDto)
@ApiProperty({
type: [GetHospitalListResponseDto],
type: [HospitalItemDto],
description: 'List of hospitals',
})
list: GetHospitalListResponseDto[];
list: HospitalItemDto[];
}
......@@ -48,6 +48,27 @@ export class HospitalItemDto {
})
hospitalName: string;
@Expose()
@ApiProperty({
example: 'Apollo Hospitals',
description: 'Propreitor Name',
})
propreitorName: string;
@Expose()
@ApiProperty({
example: 'Apollo Hospitals',
description: 'Propreitor Name',
})
state: string;
@Expose()
@ApiProperty({
example: 'Apollo Hospitals',
description: 'Propreitor Name',
})
city: string;
@Expose()
@ApiProperty({
example: 'Mumbai',
......
......@@ -14,6 +14,7 @@ import {
import {
GetHospitalsResponseDto
} from './dto/get-hospitals/get-hospital-list-response.dto';
import { Decimal } from '@prisma/client/runtime/library';
/**
* Service to encapsulate hospital domain logic such as user search.
......@@ -39,15 +40,23 @@ export class HospitalService {
id: h.hospital_id,
hospitalName: h.name,
hospitalNo: h.hospital_no,
rohiniId: h.rohini_id,
hfrId: h.hfr_id,
registrationNo: h.registration_no,
hospitalRegNo: h.registration_no,
type: h.hospital_type_master?.name ? h.hospital_type_master.name : null,
registrationAuthority: h.registration_authority,
website: h.website,
isHospitalRegistered: h.is_hospital_registered,
registeredFrom: h.registered_from,
registeredTill: h.registered_till,
type: h.hospital_type_master?.name ?? null,
propreitorName: h.propreitor_name,
panNo: h.pan_no,
address: h.address,
locality: h.locality,
state: h.state_master?.name ? h.state_master.name : null,
city: h.city_master?.name ? h.city_master.name : null,
pincode: h.pincode_master?.name ? h.pincode_master.name : null,
state: h.state_master?.name ?? null,
city: h.city_master?.name ?? null,
pincode: h.pincode_master?.name ?? null,
contactNo: h.contact,
emailId: h.email_id,
status: h.status,
......@@ -55,6 +64,10 @@ export class HospitalService {
stateId: h.state_id,
cityId: h.city_id,
pincodeId: h.pincode_id,
latitude: new Decimal(h.latitude).toNumber(),
longitude: new Decimal(h.longitude).toNumber(),
isEPDEnabled: h.is_epd_enabled,
isNonNetwork: h.is_non_network
}));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment