feat(backend): add responsable dashboard endpoint

This commit is contained in:
SaidSoighiri94
2026-07-15 11:04:09 +02:00
parent e2165b9826
commit a3795b41a0
7 changed files with 230 additions and 1 deletions
@@ -0,0 +1,14 @@
import { Request, Response } from 'express';
import { AppError } from '../errors/app-error';
import { getDashboardResponsable } from '../services/responsable.service';
import { toDashboardResponsableResponse } from '../dtos/responsable.dto';
export async function getDashboard(req: Request, res: Response): Promise<void> {
const user = req.user;
if (!user) {
throw new AppError(401, 'Authentification requise');
}
const dashboard = await getDashboardResponsable(user.id, user.roleCode, user.campusId);
res.json({ data: toDashboardResponsableResponse(dashboard) });
}