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