feat(backend): add GET /api/mes-emprunts endpoint
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
Reference in New Issue
Block a user