mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 00:24:54 +00:00
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Gender } from '~/customer/enums';
|
|
import { DocumentMetaResponseDto } from '~/document/dtos/response';
|
|
import { User } from '~/user/entities';
|
|
|
|
export class UserResponseDto {
|
|
@ApiProperty()
|
|
id!: string;
|
|
|
|
@ApiProperty()
|
|
countryCode!: string;
|
|
|
|
@ApiProperty()
|
|
phoneNumber!: string;
|
|
|
|
@ApiProperty()
|
|
email!: string;
|
|
|
|
@ApiProperty()
|
|
firstName!: string;
|
|
|
|
@ApiProperty()
|
|
lastName!: string;
|
|
|
|
@ApiProperty()
|
|
dateOfBirth!: Date;
|
|
|
|
@ApiPropertyOptional({ type: DocumentMetaResponseDto, nullable: true })
|
|
profilePicture!: DocumentMetaResponseDto | null;
|
|
|
|
@ApiProperty()
|
|
isPhoneVerified!: boolean;
|
|
|
|
@ApiProperty()
|
|
isEmailVerified!: boolean;
|
|
|
|
@ApiPropertyOptional({ enum: Gender, nullable: true })
|
|
gender!: Gender | null;
|
|
|
|
|
|
constructor(user: User) {
|
|
this.id = user.id;
|
|
this.countryCode = user.countryCode;
|
|
this.phoneNumber = user.phoneNumber;
|
|
this.dateOfBirth = user.customer?.dateOfBirth;
|
|
this.email = user.email;
|
|
this.firstName = user.firstName;
|
|
this.lastName = user.lastName;
|
|
this.profilePicture = user.profilePicture ? new DocumentMetaResponseDto(user.profilePicture) : null;
|
|
this.isEmailVerified = user.isEmailVerified;
|
|
this.isPhoneVerified = user.isPhoneVerified;
|
|
this.gender = (user.customer?.gender as Gender) || null;
|
|
}
|
|
}
|