feat(backend): add GET /api/mes-emprunts endpoint

This commit is contained in:
SaidSoighiri94
2026-06-19 11:38:40 +02:00
parent bee21b9fd8
commit 20490a05c5
6 changed files with 55 additions and 1 deletions
@@ -0,0 +1,13 @@
import { Request, Response } from 'express';
import { AppError } from '../errors/app-error';
import { listerMesEmpruntsEnCours } from '../services/emprunt.service';
export async function getMesEmprunts(req: Request, res: Response): Promise<void> {
const user = req.user;
if (!user) {
throw new AppError(401, 'Authentification requise');
}
const emprunts = await listerMesEmpruntsEnCours(user.id);
res.json({ data: emprunts });
}