/** * Fixtures domain partagees par les tests routes. */ import { Decimal } from 'decimal.js'; import { Attribution } from '../../src/domain/attribution.js'; import { Bloc } from '../../src/domain/bloc.js'; import { Formation } from '../../src/domain/formation.js'; import { Intervention } from '../../src/domain/intervention.js'; import { Module } from '../../src/domain/module.js'; import { Personne } from '../../src/domain/personne.js'; import { Projet } from '../../src/domain/projet.js'; import { Tache } from '../../src/domain/tache.js'; import type { Role } from '../../src/domain/types.js'; export function makePersonne(over: Partial<{ id: number; roles: Role[] }> = {}): Personne { return new Personne({ id: over.id ?? 1, nom: 'Dupont', prenom: 'Pierre', email: 'pierre@acadenice.fr', capaciteAnnuelle: new Decimal(1000), splitFormationPct: new Decimal(60), splitAgencePct: new Decimal(40), roles: new Set(over.roles ?? ['formateur']), statut: 'actif', }); } export function makeFormation(id = 10): Formation { return new Formation({ id, nom: 'Dev Fullstack', heuresTotales: new Decimal(500), statut: 'actif', }); } export function makeBloc(id = 100, formationId = 10): Bloc { return new Bloc({ id, formationId, nom: 'Bloc JS', heuresPrevues: new Decimal(100), ordre: 1, }); } export function makeModule(id = 200, blocId = 100): Module { return new Module({ id, blocId, nom: 'JS Fondamentaux', heuresPrevues: new Decimal(30), }); } export function makeAttribution( over: Partial<{ id: number; moduleId: number; personneId: number }> = {}, ): Attribution { return new Attribution({ id: over.id ?? 500, moduleId: over.moduleId ?? 200, personneId: over.personneId ?? 1, heuresAttribuees: new Decimal(10), statut: 'planifie', }); } export function makeProjet(id = 300, clientId = 50): Projet { return new Projet({ id, clientId, nom: 'Site Acme', chargeHeures: new Decimal(80), statut: 'en_cours', }); } export function makeTache(id = 400, projetId = 300): Tache { return new Tache({ id, projetId, titre: 'Setup repo', chargeHeures: new Decimal(8), statut: 'todo', }); } export function makeIntervention( over: Partial<{ id: number; tacheId: number; personneId: number }> = {}, ): Intervention { return new Intervention({ id: over.id ?? 600, tacheId: over.tacheId ?? 400, personneId: over.personneId ?? 2, heures: new Decimal(2), date: new Date('2026-05-01'), statut: 'realise', }); }