- Columna username (unique, nullable) en auth.users - Campo username en CreateUserDto y UpdateUserDto Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
58 lines
1.6 KiB
TypeScript
Executable File
58 lines
1.6 KiB
TypeScript
Executable File
import { IsEmail, IsString, MinLength, IsOptional, IsNumber, IsBoolean } from 'class-validator';
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
|
|
export class CreateUserDto {
|
|
@ApiProperty({ description: 'Email address', example: 'user@example.com' })
|
|
@IsEmail()
|
|
email: string;
|
|
|
|
@ApiProperty({ description: 'Password (minimum 8 characters)', example: 'SecurePass123!' })
|
|
@IsString()
|
|
@MinLength(8)
|
|
password: string;
|
|
|
|
@ApiProperty({ description: 'First name', example: 'John' })
|
|
@IsString()
|
|
firstName: string;
|
|
|
|
@ApiProperty({ description: 'Last name', example: 'Doe' })
|
|
@IsString()
|
|
lastName: string;
|
|
@ApiPropertyOptional({ description: 'Username', example: 'johndoe' }) @IsOptional() @IsString() username?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Phone number', example: '+1234567890' })
|
|
@IsOptional()
|
|
@IsString()
|
|
phone?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Country ID', example: 1 })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
countryId?: number;
|
|
|
|
@ApiPropertyOptional({ description: 'Role ID', example: 2 })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
roleId?: number;
|
|
|
|
@ApiPropertyOptional({ description: 'Preferred language', example: 'en' })
|
|
@IsOptional()
|
|
@IsString()
|
|
preferredLanguage?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Preferred currency', example: 'USD' })
|
|
@IsOptional()
|
|
@IsString()
|
|
preferredCurrency?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Is verified', example: false })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
isVerified?: boolean;
|
|
|
|
@ApiPropertyOptional({ description: 'Is active', example: true })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
isActive?: boolean;
|
|
}
|