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