mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 00:24:54 +00:00
Merge pull request #38 from HamzaSha1/ZOD-333-junior-incorrect-relationship-label-displayed-as-child-instead-of-daughter-or-son-in-child-confirmation-details-after-the-scan-the-qr-code
Zod 333 junior incorrect relationship label displayed as child instead of daughter or son in child confirmation details after the scan the qr code
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Gender } from '~/customer/enums';
|
||||
import { Guardian } from '~/guardian/entities/guradian.entity';
|
||||
import { Junior } from '~/junior/entities';
|
||||
import { GuardianRelationship } from '~/junior/enums';
|
||||
import { ChildRelationshipLabel, GuardianRelationship, Relationship } from '~/junior/enums';
|
||||
|
||||
export class QrCodeValidationDetailsResponse {
|
||||
@ApiProperty()
|
||||
@ -26,6 +27,17 @@ export class QrCodeValidationDetailsResponse {
|
||||
this.phoneNumber = person.customer.user.phoneNumber;
|
||||
this.email = person.customer.user.email;
|
||||
this.dateOfBirth = person.customer.dateOfBirth;
|
||||
this.relationship = guardian ? junior.relationship : GuardianRelationship[junior.relationship];
|
||||
|
||||
if (guardian) {
|
||||
this.relationship = junior.relationship;
|
||||
} else {
|
||||
if (junior.relationship === Relationship.PARENT) {
|
||||
this.relationship = junior.customer.gender === Gender.MALE
|
||||
? ChildRelationshipLabel.SON
|
||||
: ChildRelationshipLabel.DAUGHTER;
|
||||
} else {
|
||||
this.relationship = GuardianRelationship[junior.relationship];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
5
src/junior/enums/child-relationship-label.enum.ts
Normal file
5
src/junior/enums/child-relationship-label.enum.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export enum ChildRelationshipLabel {
|
||||
SON = 'SON',
|
||||
DAUGHTER = 'DAUGHTER',
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
export * from './child-relationship-label.enum';
|
||||
export * from './guardian-relationship.enum';
|
||||
export * from './relationship.enum';
|
||||
export * from './theme-color.enum';
|
||||
|
||||
Reference in New Issue
Block a user