Files
EME_APP/eme-backend/src/controllers/emprunt.controller.ts
T
2026-06-19 11:38:40 +02:00

14 lines
445 B
TypeScript

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 });
}