Files
EME_APP/eme-backend/src/controllers/responsable.controller.ts
T
2026-07-15 11:04:09 +02:00

15 lines
583 B
TypeScript

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