feat(#194): module Cartes SYSTEM
Closes #194 Co-authored-by: Julien Martin <julien.martin@ptits-pas.fr>
This commit was merged in pull request #203.
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import {
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsUUID,
|
||||
MaxLength,
|
||||
MinLength,
|
||||
ValidateIf,
|
||||
} from 'class-validator';
|
||||
import { CardInstanceStatutType, CardOperationType } from 'src/entities/card_instances.entity';
|
||||
import { CardResponseActionType } from 'src/entities/card_responses.entity';
|
||||
|
||||
export class CreerCarteDto {
|
||||
@ApiProperty({
|
||||
description: 'absence_enfant | absence_enfant_modif | conge_am | arret_maladie_am',
|
||||
})
|
||||
@IsString()
|
||||
type_code: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsUUID()
|
||||
id_placement: string;
|
||||
|
||||
@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;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: 'Requis pour operation=update (même id absences_garde)',
|
||||
})
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
id_absence?: string;
|
||||
|
||||
@ApiPropertyOptional({ enum: CardOperationType, default: CardOperationType.CREATE })
|
||||
@IsOptional()
|
||||
@IsEnum(CardOperationType)
|
||||
operation?: CardOperationType;
|
||||
}
|
||||
|
||||
export class RepondreCarteDto {
|
||||
@ApiProperty({ enum: CardResponseActionType })
|
||||
@IsEnum(CardResponseActionType)
|
||||
action: CardResponseActionType;
|
||||
|
||||
@ApiPropertyOptional({ description: 'Obligatoire si action=refuse' })
|
||||
@ValidateIf((o) => o.action === CardResponseActionType.REFUSE)
|
||||
@IsString()
|
||||
@MinLength(1)
|
||||
@MaxLength(2000)
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
export class MajCarteDto {
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
date_debut?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
date_fin?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(2000)
|
||||
motif?: string;
|
||||
}
|
||||
|
||||
export class CarteDto {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
|
||||
@ApiProperty()
|
||||
type_code: string;
|
||||
|
||||
@ApiProperty()
|
||||
titre: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
couleur?: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
id_placement: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
id_absence?: string | null;
|
||||
|
||||
@ApiProperty({ enum: CardOperationType })
|
||||
operation: CardOperationType;
|
||||
|
||||
@ApiProperty({ enum: CardInstanceStatutType })
|
||||
statut: CardInstanceStatutType;
|
||||
|
||||
@ApiProperty()
|
||||
payload: Record<string, unknown>;
|
||||
|
||||
@ApiProperty()
|
||||
purge_at: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
cree_par?: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
is_creator: boolean;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
response_mode?: string;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
last_refuse_comment?: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
cree_le: string;
|
||||
|
||||
@ApiProperty()
|
||||
modifie_le: string;
|
||||
}
|
||||
|
||||
export class ListeCartesDto {
|
||||
@ApiProperty({ type: [CarteDto] })
|
||||
items: CarteDto[];
|
||||
}
|
||||
Reference in New Issue
Block a user