mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 00:24:54 +00:00
38 lines
1.7 KiB
TypeScript
38 lines
1.7 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { IsDateString, IsEmail, IsEnum, IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
|
|
import { i18nValidationMessage as i18n } from 'nestjs-i18n';
|
|
import { Gender } from '~/customer/enums';
|
|
export class UpdateUserRequestDto {
|
|
@ApiProperty({ example: 'John' })
|
|
@IsString({ message: i18n('validation.IsString', { path: 'general', property: 'user.firstName' }) })
|
|
@IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'user.firstName' }) })
|
|
@IsOptional()
|
|
firstName!: string;
|
|
|
|
@ApiProperty({ example: 'Doe' })
|
|
@IsString({ message: i18n('validation.IsString', { path: 'general', property: 'user.lastName' }) })
|
|
@IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'user.lastName' }) })
|
|
@IsOptional()
|
|
lastName!: string;
|
|
|
|
@ApiPropertyOptional({ example: 'child@example.com' })
|
|
@IsEmail({}, { message: i18n('validation.IsEmail', { path: 'general', property: 'user.email' }) })
|
|
@IsOptional()
|
|
email!: string;
|
|
|
|
@ApiProperty({ example: '123e4567-e89b-12d3-a456-426614174000' })
|
|
@IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'user.profilePictureId' }) })
|
|
@IsOptional()
|
|
profilePictureId!: string;
|
|
|
|
@ApiPropertyOptional({ enum: Gender })
|
|
@IsEnum(Gender, { message: i18n('validation.IsEnum', { path: 'general', property: 'customer.gender' }) })
|
|
@IsOptional()
|
|
gender!: Gender;
|
|
|
|
@ApiPropertyOptional({ example: '2020-01-01' })
|
|
@IsDateString({}, { message: i18n('validation.IsDateString', { path: 'general', property: 'customer.dateOfBirth' }) })
|
|
@IsOptional()
|
|
dateOfBirth!: Date;
|
|
}
|