feat: Intégration du backend NestJS depuis YNOV

- Framework: NestJS avec TypeORM
- Authentification: JWT (access + refresh tokens)
- Gestion utilisateurs: CRUD complet avec validation
- Routes: auth, users, parents, assistantes maternelles
- Dockerfile pour conteneurisation
This commit is contained in:
2025-11-24 15:44:07 +01:00
parent 49f0684ad3
commit 33d6e7b0c3
108 changed files with 13872 additions and 1908 deletions
@@ -0,0 +1,4 @@
import { OmitType } from "@nestjs/swagger";
import { CreateUserDto } from "./create_user.dto";
export class CreateAdminDto extends OmitType(CreateUserDto, ['role'] as const) {}
@@ -0,0 +1,56 @@
import { OmitType } from "@nestjs/swagger";
import { IsBoolean, IsDateString, IsInt, IsNotEmpty, IsOptional, IsString, IsUUID, Length, Matches, Max, Min } from "class-validator";
import { CreateUserDto } from "./create_user.dto";
export class CreateAssistanteDto extends OmitType(CreateUserDto, ['role', 'photo_url', 'consentement_photo'] as const) {
@IsUUID()
@IsNotEmpty()
user_id?: string;
@IsString()
@IsNotEmpty()
@Length(1, 50)
approval_number: string;
@Matches(/^\d{15}$/)
@IsNotEmpty()
nir: string;
@IsInt()
@Min(1)
@Max(10)
@IsNotEmpty()
max_children: number;
@IsString()
@IsNotEmpty()
photo_url: string;
@IsBoolean()
@IsNotEmpty()
consentement_photo: boolean;
@IsDateString()
@IsNotEmpty()
agreement_date: string;
@IsString()
@IsNotEmpty()
@Length(1, 100)
residence_city: string;
@IsOptional()
biography?: string;
@IsOptional()
available?: boolean;
@IsOptional()
years_experience?: number;
@IsOptional()
specialty?: string;
@IsOptional()
places_available?: number;
}
@@ -0,0 +1,4 @@
import { OmitType } from "@nestjs/swagger";
import { CreateUserDto } from "./create_user.dto";
export class CreateGestionnaireDto extends OmitType(CreateUserDto, ['role'] as const) {}
@@ -0,0 +1,17 @@
import { OmitType } from "@nestjs/swagger";
import { CreateUserDto } from "./create_user.dto";
import { IsNotEmpty, IsOptional, IsString, IsUUID } from "class-validator";
export class CreateParentDto extends OmitType(CreateUserDto, ['role', 'photo_url'] as const) {
@IsUUID()
@IsNotEmpty()
user_id: string;
@IsOptional()
@IsUUID()
co_parent_id?: string;
@IsString()
@IsNotEmpty()
photo_url: string;
}
@@ -0,0 +1,105 @@
import { ApiProperty } from '@nestjs/swagger';
import {
IsBoolean,
IsDateString,
IsEmail,
IsEnum,
IsNotEmpty,
IsOptional,
IsString,
MinLength,
MaxLength,
} from 'class-validator';
import { RoleType, GenreType, StatutUtilisateurType, SituationFamilialeType } from 'src/entities/users.entity';
export class CreateUserDto {
@ApiProperty({ example: 'sosso.test@example.com' })
@IsEmail()
@IsNotEmpty()
email: string;
@ApiProperty({ minLength: 6, example: 'Mon_motdepasse_fort_1234?' })
@IsString()
@IsNotEmpty()
@MinLength(6)
password: string;
@ApiProperty({ example: 'Julien' })
@IsString()
@IsNotEmpty()
@MaxLength(100)
prenom: string;
@ApiProperty({ example: 'Dupont' })
@IsString()
@IsNotEmpty()
@MaxLength(100)
nom: string;
@ApiProperty({ enum: GenreType, required: false, default: GenreType.AUTRE })
@IsOptional()
@IsEnum(GenreType)
genre?: GenreType = GenreType.AUTRE;
@ApiProperty({ enum: RoleType })
@IsEnum(RoleType)
role: RoleType;
@ApiProperty({ enum: StatutUtilisateurType, required: false, default: StatutUtilisateurType.EN_ATTENTE })
@IsOptional()
@IsEnum(StatutUtilisateurType)
statut?: StatutUtilisateurType = StatutUtilisateurType.EN_ATTENTE;
@ApiProperty({ example: SituationFamilialeType.MARIE, required: false, enum: SituationFamilialeType, default: SituationFamilialeType.MARIE})
@IsOptional()
@IsEnum(SituationFamilialeType)
situation_familiale?: SituationFamilialeType;
@ApiProperty({ example: '+33123456789' })
@IsString()
@IsNotEmpty()
@MaxLength(20)
telephone: string;
@ApiProperty({ example: 'Paris', required: false })
@IsOptional()
@IsString()
@MaxLength(150)
ville?: string;
@ApiProperty({ example: '75000', required: false })
@IsOptional()
@IsString()
@MaxLength(10)
code_postal?: string;
@ApiProperty({ example: '10 rue de la paix, 75000 Paris' })
@IsString()
@IsNotEmpty()
adresse: string;
@ApiProperty({ example: 'https://example.com/photo.jpg', required: false })
@IsOptional()
@IsString()
photo_url?: string;
@ApiProperty({ default: false })
@IsOptional()
@IsBoolean()
consentement_photo?: boolean = false;
@ApiProperty({ required: false })
@IsOptional()
@IsDateString({}, { message: 'date_consentement_photo doit être une date ISO valide' })
date_consentement_photo?: string | null;
@ApiProperty({ default: false })
@IsOptional()
@IsBoolean()
changement_mdp_obligatoire?: boolean = false;
@ApiProperty({ example: true })
@IsBoolean()
@IsNotEmpty()
cguAccepted: boolean;
}
@@ -0,0 +1,4 @@
import { PartialType } from "@nestjs/swagger";
import { CreateAdminDto } from "./create_admin.dto";
export class UpdateAdminDto extends PartialType(CreateAdminDto) {}
@@ -0,0 +1,4 @@
import { PartialType } from "@nestjs/swagger";
import { CreateAssistanteDto } from "./create_assistante.dto";
export class UpdateAssistanteDto extends PartialType(CreateAssistanteDto) {}
@@ -0,0 +1,4 @@
import { PartialType } from "@nestjs/swagger";
import { CreateGestionnaireDto } from "./create_gestionnaire.dto";
export class UpdateGestionnaireDto extends PartialType(CreateGestionnaireDto) {}
@@ -0,0 +1,4 @@
import { PartialType } from "@nestjs/swagger";
import { CreateParentDto } from "./create_parent.dto";
export class UpdateParentsDto extends PartialType(CreateParentDto) {}
@@ -0,0 +1,4 @@
import { PartialType } from "@nestjs/swagger";
import { CreateUserDto } from "./create_user.dto";
export class UpdateUserDto extends PartialType(CreateUserDto) {}