import { Transform, Type } from 'class-transformer'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { IsEmail, IsNotEmpty, IsOptional, MinLength } from 'class-validator'; import { lowerCaseTransformer } from 'src/utils/transformers/lower-case.transformer'; import { RoleDto } from 'src/roles/dto/role.dto'; import { StatusDto } from 'src/statuses/dto/status.dto'; import { FileDto } from 'src/files/dto/file.dto'; export class CreateUserDto { @ApiProperty({ example: 'test1@example.com' }) @Transform(lowerCaseTransformer) @IsNotEmpty() @IsEmail() email: string | null; @ApiProperty() @MinLength(6) password?: string; provider?: string; socialId?: string | null; @ApiProperty({ example: 'John' }) @IsNotEmpty() firstName: string | null; @ApiProperty({ example: 'Doe' }) @IsNotEmpty() lastName: string | null; @ApiPropertyOptional({ type: () => FileDto }) @IsOptional() photo?: FileDto | null; @ApiPropertyOptional({ type: RoleDto }) @IsOptional() @Type(() => RoleDto) role?: RoleDto | null; @ApiPropertyOptional({ type: StatusDto }) @IsOptional() @Type(() => StatusDto) status?: StatusDto; hash?: string | null; }