Files
petitspas/backend/src/modules/evenements-agenda/dto/evenements-agenda.dto.ts
T
jmartinandCursor 2114748d44 feat(#205): renommer absences_garde → evenements_agenda
Migration live + BDD.sql from-scratch, module Nest / API
/evenements-agenda, FK cartes id_evenement. Front stub path aligné.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 17:07:54 +02:00

120 lines
2.3 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import {
IsDateString,
IsEnum,
IsOptional,
IsString,
IsUUID,
MaxLength,
MinLength,
} from 'class-validator';
import {
StatutEvenementAgendaType,
TypeEvenementAgendaType,
} from 'src/entities/evenements_agenda.entity';
export class CreerEvenementAgendaDto {
@ApiProperty({ description: 'Placement AM↔enfant (couple)' })
@IsUUID()
id_placement: string;
@ApiProperty({ enum: TypeEvenementAgendaType })
@IsEnum(TypeEvenementAgendaType)
type: TypeEvenementAgendaType;
@ApiProperty({ example: '2026-10-01' })
@IsDateString()
date_debut: string;
@ApiProperty({ example: '2026-10-05' })
@IsDateString()
date_fin: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(2000)
motif?: string;
}
export class MajEvenementAgendaDto {
@ApiPropertyOptional({ example: '2026-10-02' })
@IsOptional()
@IsDateString()
date_debut?: string;
@ApiPropertyOptional({ example: '2026-10-06' })
@IsOptional()
@IsDateString()
date_fin?: string;
@ApiPropertyOptional({ enum: StatutEvenementAgendaType })
@IsOptional()
@IsEnum(StatutEvenementAgendaType)
statut?: StatutEvenementAgendaType;
@ApiPropertyOptional({
description: 'Motivation de refus (parent) ou motif créateur',
})
@IsOptional()
@IsString()
@MinLength(1)
@MaxLength(2000)
motif?: string;
}
export class EvenementAgendaDto {
@ApiProperty()
id: string;
@ApiProperty()
id_placement: string;
@ApiProperty({ enum: TypeEvenementAgendaType })
type: TypeEvenementAgendaType;
@ApiProperty()
date_debut: string;
@ApiProperty()
date_fin: string;
@ApiProperty({ enum: StatutEvenementAgendaType })
statut: StatutEvenementAgendaType;
@ApiProperty()
expire_at: string;
@ApiPropertyOptional()
cree_par?: string | null;
@ApiPropertyOptional()
motif?: string | null;
@ApiPropertyOptional()
id_enfant?: string | null;
@ApiPropertyOptional()
prenom_enfant?: string | null;
@ApiPropertyOptional()
id_am?: string | null;
@ApiPropertyOptional()
prenom_am?: string | null;
@ApiPropertyOptional()
nom_am?: string | null;
@ApiProperty()
cree_le: string;
@ApiProperty()
modifie_le: string;
}
export class ListeEvenementsAgendaDto {
@ApiProperty({ type: [EvenementAgendaDto] })
items: EvenementAgendaDto[];
}