correction for generic users

This commit is contained in:
sdraris 2025-09-08 09:50:30 +02:00
parent 846c5c1069
commit e999839bc5
2 changed files with 34 additions and 12 deletions

View File

@ -42,10 +42,10 @@ export class Users {
password_hash: string; password_hash: string;
@Column({ name: 'prenom', nullable: true }) @Column({ name: 'prenom', nullable: true })
first_name: string; first_name?: string;
@Column({ name: 'nom', nullable: true }) @Column({ name: 'nom', nullable: true })
last_name: string; last_name?: string;
@Column({ @Column({
type: 'enum', type: 'enum',
@ -91,6 +91,12 @@ export class Users {
@Column({ default: false, name: 'changement_mdp_obligatoire' }) @Column({ default: false, name: 'changement_mdp_obligatoire' })
must_change_password: boolean; must_change_password: boolean;
@Column({ nullable: true, name: 'ville' })
city?: string;
@Column({ nullable: true, name: 'code_postal' })
postal_code?: string;
@CreateDateColumn({ name: 'cree_le', type: 'timestamptz' }) @CreateDateColumn({ name: 'cree_le', type: 'timestamptz' })
created_at: Date; created_at: Date;
@ -106,4 +112,7 @@ export class Users {
@OneToMany(() => Message, m => m.sender) @OneToMany(() => Message, m => m.sender)
messages?: Message[]; messages?: Message[];
@OneToMany(() => Parents, parent => parent.co_parent)
co_parent_in?: Parents[];
} }

View File

@ -25,15 +25,15 @@ export class CreateUserDto {
@ApiProperty({ example: 'Julien' }) @ApiProperty({ example: 'Julien' })
@IsString() @IsString()
@IsNotEmpty() @IsOptional()
@MaxLength(100) @MaxLength(100)
first_name: string; first_name?: string;
@ApiProperty({ example: 'Dupont' }) @ApiProperty({ example: 'Dupont' })
@IsString() @IsString()
@IsNotEmpty() @IsOptional()
@MaxLength(100) @MaxLength(100)
last_name: string; last_name?: string;
@ApiProperty({ enum: GenreType, required: false, default: GenreType.AUTRE }) @ApiProperty({ enum: GenreType, required: false, default: GenreType.AUTRE })
@IsOptional() @IsOptional()
@ -51,14 +51,27 @@ export class CreateUserDto {
@ApiProperty({ example: '+33123456789' }) @ApiProperty({ example: '+33123456789' })
@IsString() @IsString()
@IsNotEmpty() @IsOptional()
@MaxLength(20) @MaxLength(20)
phone: string; phone?: string;
@ApiProperty({ example: 'Paris', required: false })
@IsOptional()
@IsString()
@MaxLength(150)
city?: string;
@ApiProperty({ example: '75000', required: false })
@IsOptional()
@IsString()
@MaxLength(10)
postal_code?: string;
@ApiProperty({ example: '10 rue de la paix, 75000 Paris' }) @ApiProperty({ example: '10 rue de la paix, 75000 Paris' })
@IsString() @IsString()
@IsNotEmpty() @IsOptional()
address: string; address?: string;
@ApiProperty({ example: 'https://example.com/photo.jpg', required: false }) @ApiProperty({ example: 'https://example.com/photo.jpg', required: false })
@IsOptional() @IsOptional()
@ -72,8 +85,8 @@ export class CreateUserDto {
@ApiProperty({ required: false }) @ApiProperty({ required: false })
@IsOptional() @IsOptional()
@IsDateString() @IsDateString({}, { message: 'consent_photo_at doit être une date ISO valide' })
consent_photo_at?: string; consent_photo_at?: string | null;
@ApiProperty({ default: false }) @ApiProperty({ default: false })
@IsOptional() @IsOptional()