Assist_Design/apps/bff/src/auth/dto/signup.dto.ts

40 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-08-22 17:02:49 +09:00
import { IsEmail, IsString, MinLength, IsOptional, Matches } from "class-validator";
2025-08-21 15:24:40 +09:00
import { ApiProperty } from "@nestjs/swagger";
export class SignupDto {
2025-08-21 15:24:40 +09:00
@ApiProperty({ example: "user@example.com" })
@IsEmail()
email: string;
2025-08-21 15:24:40 +09:00
@ApiProperty({
example: "SecurePassword123!",
description:
"Password must be at least 8 characters and contain uppercase, lowercase, number, and special character",
})
@IsString()
2025-08-21 15:24:40 +09:00
@MinLength(8, { message: "Password must be at least 8 characters long" })
@Matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]/, {
message:
"Password must contain at least one uppercase letter, one lowercase letter, one number, and one special character",
})
password: string;
2025-08-21 15:24:40 +09:00
@ApiProperty({ example: "John" })
@IsString()
firstName: string;
2025-08-21 15:24:40 +09:00
@ApiProperty({ example: "Doe" })
@IsString()
lastName: string;
2025-08-21 15:24:40 +09:00
@ApiProperty({ example: "Acme Corp", required: false })
@IsOptional()
@IsString()
company?: string;
2025-08-21 15:24:40 +09:00
@ApiProperty({ example: "+1-555-123-4567", required: false })
@IsOptional()
@IsString()
phone?: string;
}