feat: adding enhancment for zod admin portal kyc and add customer additional fields

This commit is contained in:
Abdalhamid Alhamad
2025-03-02 10:49:58 +03:00
parent dae9cb6323
commit 54ce5b022d
11 changed files with 242 additions and 16 deletions

View File

@ -0,0 +1,89 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Customer } from '~/customer/entities';
import { CustomerStatus, KycStatus } from '~/customer/enums';
import { DocumentMetaResponseDto } from '~/document/dtos/response';
export class InternalCustomerDetailsResponseDto {
@ApiProperty()
id!: string;
@ApiProperty()
customerStatus!: CustomerStatus;
@ApiProperty()
kycStatus!: KycStatus;
@ApiProperty()
rejectionReason!: string | null;
@ApiProperty()
fullName!: string;
@ApiProperty()
phoneNumber!: string;
@ApiProperty()
dateOfBirth!: Date;
@ApiProperty()
nationalId!: string;
@ApiProperty()
nationalIdExpiry!: Date;
@ApiProperty()
countryOfResidence!: string;
@ApiProperty()
sourceOfIncome!: string;
@ApiProperty()
profession!: string;
@ApiProperty()
professionType!: string;
@ApiProperty()
isPep!: boolean;
@ApiProperty()
gender!: string;
@ApiProperty()
isJunior!: boolean;
@ApiProperty()
isGuardian!: boolean;
@ApiProperty({ type: DocumentMetaResponseDto })
civilIdFront!: DocumentMetaResponseDto;
@ApiProperty({ type: DocumentMetaResponseDto })
civilIdBack!: DocumentMetaResponseDto;
@ApiPropertyOptional({ type: DocumentMetaResponseDto })
profilePicture!: DocumentMetaResponseDto | null;
constructor(customer: Customer) {
this.id = customer.id;
this.customerStatus = customer.customerStatus;
this.kycStatus = customer.kycStatus;
this.rejectionReason = customer.rejectionReason;
this.fullName = `${customer.firstName} ${customer.lastName}`;
this.phoneNumber = customer.user.fullPhoneNumber;
this.dateOfBirth = customer.dateOfBirth;
this.nationalId = customer.nationalId;
this.nationalIdExpiry = customer.nationalIdExpiry;
this.countryOfResidence = customer.countryOfResidence;
this.sourceOfIncome = customer.sourceOfIncome;
this.profession = customer.profession;
this.professionType = customer.professionType;
this.isPep = customer.isPep;
this.gender = customer.gender;
this.isJunior = customer.isJunior;
this.isGuardian = customer.isGuardian;
this.civilIdFront = new DocumentMetaResponseDto(customer.civilIdFront);
this.civilIdBack = new DocumentMetaResponseDto(customer.civilIdBack);
this.profilePicture = customer.profilePicture ? new DocumentMetaResponseDto(customer.profilePicture) : null;
}
}