feat(responsable): add anomaly and history tables
This commit is contained in:
@@ -24,7 +24,9 @@ import {
|
||||
parseStatutAnomalie,
|
||||
parseStatutMateriel,
|
||||
parseStatutEmprunt,
|
||||
parseTriAnomalie,
|
||||
parseTriEmprunt,
|
||||
parseTriHistorique,
|
||||
parseTriMateriel,
|
||||
} from '../services/responsable.service';
|
||||
import {
|
||||
@@ -53,6 +55,9 @@ function getHistoriqueFiltres(req: Request) {
|
||||
empruntId: parsePositiveIntQuery(req.query.empruntId, 'empruntId'),
|
||||
dateDebut: parseDateQuery(req.query.dateDebut, 'dateDebut'),
|
||||
dateFin: parseDateQuery(req.query.dateFin, 'dateFin'),
|
||||
recherche: typeof req.query.q === 'string' ? req.query.q : undefined,
|
||||
tri: parseTriHistorique(req.query.tri),
|
||||
ordre: parseOrdreTri(req.query.ordre),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -163,10 +168,16 @@ export async function getAnomalies(req: Request, res: Response): Promise<void> {
|
||||
|
||||
const statut = parseStatutAnomalie(req.query.statut);
|
||||
const type = typeof req.query.type === 'string' ? req.query.type : undefined;
|
||||
const recherche = typeof req.query.q === 'string' ? req.query.q : undefined;
|
||||
const tri = parseTriAnomalie(req.query.tri);
|
||||
const ordre = parseOrdreTri(req.query.ordre);
|
||||
|
||||
const anomalies = await listerAnomaliesResponsable(user.roleCode, user.campusId, {
|
||||
statut,
|
||||
type,
|
||||
recherche,
|
||||
tri,
|
||||
ordre,
|
||||
});
|
||||
res.json({ data: anomalies.map(toAnomalieResponsableResponse) });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user