API staff pour foyer mono-parent : compte actif, liens + enfants, mail création MDP. Mini-specs front/back dans docs/tmp. Co-authored-by: Cursor <cursoragent@cursor.com>
70 lines
1.5 KiB
TypeScript
70 lines
1.5 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||
import {
|
||
IsBoolean,
|
||
IsEmail,
|
||
IsNotEmpty,
|
||
IsOptional,
|
||
IsString,
|
||
Matches,
|
||
MaxLength,
|
||
MinLength,
|
||
} from 'class-validator';
|
||
|
||
/**
|
||
* Ajout d’un co-parent sur un foyer existant (staff) — ticket #135.
|
||
* Corps sans préfixe `co_parent_*` (l’URL cible déjà le pivot).
|
||
*/
|
||
export class StaffAddCoParentDto {
|
||
@ApiProperty({ example: 'thomas.martin@ptits-pas.fr' })
|
||
@IsEmail({}, { message: 'Email invalide' })
|
||
@IsNotEmpty({ message: "L'email est requis" })
|
||
email: string;
|
||
|
||
@ApiProperty({ example: 'Thomas' })
|
||
@IsString()
|
||
@IsNotEmpty({ message: 'Le prénom est requis' })
|
||
@MinLength(2)
|
||
@MaxLength(100)
|
||
prenom: string;
|
||
|
||
@ApiProperty({ example: 'MARTIN' })
|
||
@IsString()
|
||
@IsNotEmpty({ message: 'Le nom est requis' })
|
||
@MinLength(2)
|
||
@MaxLength(100)
|
||
nom: string;
|
||
|
||
@ApiProperty({ example: '0678456789' })
|
||
@IsString()
|
||
@IsNotEmpty({ message: 'Le téléphone est requis' })
|
||
@Matches(/^(\+33|0)[1-9](\d{2}){4}$/, {
|
||
message: 'Le numéro de téléphone doit être valide (ex: 0689567890 ou +33689567890)',
|
||
})
|
||
telephone: string;
|
||
|
||
@ApiPropertyOptional({
|
||
example: true,
|
||
description: 'Si true, copie l’adresse du parent pivot',
|
||
})
|
||
@IsOptional()
|
||
@IsBoolean()
|
||
meme_adresse?: boolean;
|
||
|
||
@ApiPropertyOptional()
|
||
@IsOptional()
|
||
@IsString()
|
||
adresse?: string;
|
||
|
||
@ApiPropertyOptional()
|
||
@IsOptional()
|
||
@IsString()
|
||
@MaxLength(10)
|
||
code_postal?: string;
|
||
|
||
@ApiPropertyOptional()
|
||
@IsOptional()
|
||
@IsString()
|
||
@MaxLength(150)
|
||
ville?: string;
|
||
}
|