forked from Ynov/ptitspas-ynov-back
create user dto added
This commit is contained in:
parent
e17c8f7616
commit
d937fb323b
85
src/routes/user/dto/create_user.dto.ts
Normal file
85
src/routes/user/dto/create_user.dto.ts
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
import {
|
||||||
|
IsBoolean,
|
||||||
|
IsDateString,
|
||||||
|
IsEmail,
|
||||||
|
IsEnum,
|
||||||
|
IsNotEmpty,
|
||||||
|
IsOptional,
|
||||||
|
IsString,
|
||||||
|
MinLength,
|
||||||
|
MaxLength
|
||||||
|
} from 'class-validator';
|
||||||
|
import { RoleType, GenreType, StatutUtilisateurType } from 'src/entities/users.entity';
|
||||||
|
|
||||||
|
export class CreateUserDto {
|
||||||
|
@ApiProperty({ example: 'sosso.test@example.com' })
|
||||||
|
@IsEmail()
|
||||||
|
@IsNotEmpty()
|
||||||
|
email: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
minLength: 6,
|
||||||
|
description: 'Mot de passe en clair (hashé côté serveur)'
|
||||||
|
})
|
||||||
|
@IsString()
|
||||||
|
@MinLength(6)
|
||||||
|
password: string;
|
||||||
|
|
||||||
|
@ApiProperty({ example: 'Julien' })
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
@MaxLength(100)
|
||||||
|
first_name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ example: 'Dupont' })
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
@MaxLength(100)
|
||||||
|
last_name: string;
|
||||||
|
|
||||||
|
@ApiProperty({ enum: GenreType, required: false, default: GenreType.AUTRE })
|
||||||
|
@IsOptional()
|
||||||
|
@IsEnum(GenreType)
|
||||||
|
gender?: GenreType = GenreType.AUTRE;
|
||||||
|
|
||||||
|
@ApiProperty({ enum: RoleType, default: RoleType.PARENT })
|
||||||
|
@IsEnum(RoleType)
|
||||||
|
role: RoleType = RoleType.PARENT;
|
||||||
|
|
||||||
|
@ApiProperty({ enum: StatutUtilisateurType, required: false, default: StatutUtilisateurType.EN_ATTENTE })
|
||||||
|
@IsOptional()
|
||||||
|
@IsEnum(StatutUtilisateurType)
|
||||||
|
status?: StatutUtilisateurType = StatutUtilisateurType.EN_ATTENTE;
|
||||||
|
|
||||||
|
@ApiProperty({ example: '+33123456789' })
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
@MaxLength(20)
|
||||||
|
phone: string;
|
||||||
|
|
||||||
|
@ApiProperty({ example: '10 rue de la paix, 75000 Paris' })
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
|
address: string;
|
||||||
|
|
||||||
|
@ApiProperty({ example: 'https://example.com/photo.jpg', required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
photo_url?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ default: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsBoolean()
|
||||||
|
consent_photo?: boolean = false;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsDateString()
|
||||||
|
consent_photo_at?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ default: false })
|
||||||
|
@IsOptional()
|
||||||
|
@IsBoolean()
|
||||||
|
must_change_password?: boolean = false;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user