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:
abdalhamid99
2025-10-19 09:58:57 +03:00
committed by GitHub
3 changed files with 20 additions and 2 deletions

View File

@ -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];
}
}
}
}

View File

@ -0,0 +1,5 @@
export enum ChildRelationshipLabel {
SON = 'SON',
DAUGHTER = 'DAUGHTER',
}

View File

@ -1,3 +1,4 @@
export * from './child-relationship-label.enum';
export * from './guardian-relationship.enum';
export * from './relationship.enum';
export * from './theme-color.enum';