refactor(backend): add output DTOs for existing endpoints

This commit is contained in:
SaidSoighiri94
2026-06-22 10:46:50 +02:00
parent b5a7577e8d
commit 101e52236f
7 changed files with 110 additions and 6 deletions
+22
View File
@@ -0,0 +1,22 @@
import { EmpruntAvecMateriel } from '../repositories/emprunt.repository';
import { MaterielDto, toMaterielDto } from './materiel.dto';
export interface EmpruntDto {
id: number;
dateEmprunt: Date;
dateRetourPrevue: Date;
dateRetourReelle: Date | null;
statut: string;
materiel: MaterielDto;
}
export function toEmpruntDto(emprunt: EmpruntAvecMateriel): EmpruntDto {
return {
id: emprunt.id,
dateEmprunt: emprunt.dateEmprunt,
dateRetourPrevue: emprunt.dateRetourPrevue,
dateRetourReelle: emprunt.dateRetourReelle,
statut: emprunt.statut,
materiel: toMaterielDto(emprunt.materiel),
};
}