style(backend): apply Prettier formatting
This commit is contained in:
@@ -62,23 +62,23 @@ async function main(): Promise<void> {
|
||||
// Références (doivent exister via le seed).
|
||||
const roleEtudiant = required(
|
||||
await prisma.role.findUnique({ where: { code: 'ETUDIANT' } }),
|
||||
'Role ETUDIANT manquant — lance d\'abord `npm run seed`',
|
||||
"Role ETUDIANT manquant — lance d'abord `npm run seed`",
|
||||
);
|
||||
const roleResponsable = required(
|
||||
await prisma.role.findUnique({ where: { code: 'RESPONSABLE' } }),
|
||||
'Role RESPONSABLE manquant — lance d\'abord `npm run seed`',
|
||||
"Role RESPONSABLE manquant — lance d'abord `npm run seed`",
|
||||
);
|
||||
const campus = required(
|
||||
await prisma.campus.findFirst({ where: { nom: 'Campus Saint-Christophe' } }),
|
||||
'Campus manquant — lance d\'abord `npm run seed`',
|
||||
"Campus manquant — lance d'abord `npm run seed`",
|
||||
);
|
||||
const salle = required(
|
||||
await prisma.sallePret.findFirst({ where: { campusId: campus.id } }),
|
||||
'Salle de pret manquante — lance d\'abord `npm run seed`',
|
||||
"Salle de pret manquante — lance d'abord `npm run seed`",
|
||||
);
|
||||
const poste = required(
|
||||
await prisma.posteEmprunt.findFirst({ where: { sallePretId: salle.id } }),
|
||||
'Poste manquant — lance d\'abord `npm run seed`',
|
||||
"Poste manquant — lance d'abord `npm run seed`",
|
||||
);
|
||||
const catOrdi = required(
|
||||
await prisma.categorieMateriel.findFirst({ where: { nom: 'Ordinateur portable' } }),
|
||||
@@ -305,8 +305,20 @@ async function main(): Promise<void> {
|
||||
});
|
||||
await prisma.checklistElement.createMany({
|
||||
data: [
|
||||
{ checklistId: clDepart1.id, accessoireId: chargeur.id, nomElement: 'Chargeur', etat: 'PRESENT', quantiteConstatee: 1 },
|
||||
{ checklistId: clDepart1.id, accessoireId: souris.id, nomElement: 'Souris', etat: 'PRESENT', quantiteConstatee: 1 },
|
||||
{
|
||||
checklistId: clDepart1.id,
|
||||
accessoireId: chargeur.id,
|
||||
nomElement: 'Chargeur',
|
||||
etat: 'PRESENT',
|
||||
quantiteConstatee: 1,
|
||||
},
|
||||
{
|
||||
checklistId: clDepart1.id,
|
||||
accessoireId: souris.id,
|
||||
nomElement: 'Souris',
|
||||
etat: 'PRESENT',
|
||||
quantiteConstatee: 1,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -393,8 +405,20 @@ async function main(): Promise<void> {
|
||||
});
|
||||
await prisma.checklistElement.createMany({
|
||||
data: [
|
||||
{ checklistId: clDepart4.id, accessoireId: housse.id, nomElement: 'Housse', etat: 'PRESENT', quantiteConstatee: 1 },
|
||||
{ checklistId: clDepart4.id, accessoireId: chargeur.id, nomElement: 'Chargeur', etat: 'PRESENT', quantiteConstatee: 1 },
|
||||
{
|
||||
checklistId: clDepart4.id,
|
||||
accessoireId: housse.id,
|
||||
nomElement: 'Housse',
|
||||
etat: 'PRESENT',
|
||||
quantiteConstatee: 1,
|
||||
},
|
||||
{
|
||||
checklistId: clDepart4.id,
|
||||
accessoireId: chargeur.id,
|
||||
nomElement: 'Chargeur',
|
||||
etat: 'PRESENT',
|
||||
quantiteConstatee: 1,
|
||||
},
|
||||
],
|
||||
});
|
||||
const clRetour4 = await prisma.checklist.create({
|
||||
@@ -407,8 +431,21 @@ async function main(): Promise<void> {
|
||||
});
|
||||
await prisma.checklistElement.createMany({
|
||||
data: [
|
||||
{ checklistId: clRetour4.id, accessoireId: housse.id, nomElement: 'Housse', etat: 'ABSENT', quantiteConstatee: 0, commentaire: 'Manquante au retour' },
|
||||
{ checklistId: clRetour4.id, accessoireId: chargeur.id, nomElement: 'Chargeur', etat: 'PRESENT', quantiteConstatee: 1 },
|
||||
{
|
||||
checklistId: clRetour4.id,
|
||||
accessoireId: housse.id,
|
||||
nomElement: 'Housse',
|
||||
etat: 'ABSENT',
|
||||
quantiteConstatee: 0,
|
||||
commentaire: 'Manquante au retour',
|
||||
},
|
||||
{
|
||||
checklistId: clRetour4.id,
|
||||
accessoireId: chargeur.id,
|
||||
nomElement: 'Chargeur',
|
||||
etat: 'PRESENT',
|
||||
quantiteConstatee: 1,
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log('[fixtures] 4 emprunts + checklists crees');
|
||||
@@ -464,7 +501,7 @@ async function main(): Promise<void> {
|
||||
},
|
||||
],
|
||||
});
|
||||
console.log('[fixtures] 2 entrees d\'historique creees');
|
||||
console.log("[fixtures] 2 entrees d'historique creees");
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
@@ -5,7 +5,12 @@ import { logger } from '../utils/logger';
|
||||
|
||||
/* Le 4e argument est requis par Express pour identifier un gestionnaire d'erreurs,
|
||||
même s'il n'est pas utilisé. */
|
||||
export function errorHandler(err: unknown, _req: Request, res: Response, _next: NextFunction): void {
|
||||
export function errorHandler(
|
||||
err: unknown,
|
||||
_req: Request,
|
||||
res: Response,
|
||||
_next: NextFunction,
|
||||
): void {
|
||||
const isAppError = err instanceof AppError;
|
||||
const statusCode = isAppError ? err.statusCode : 500;
|
||||
const message = isAppError ? err.message : 'Erreur interne du serveur';
|
||||
|
||||
@@ -27,12 +27,7 @@ export const ETAT_CHECKLIST_ELEMENT = ['PRESENT', 'ABSENT', 'DETERIORE'] as cons
|
||||
|
||||
export type EtatChecklistElement = (typeof ETAT_CHECKLIST_ELEMENT)[number];
|
||||
|
||||
export const STATUT_ANOMALIE = [
|
||||
'DETECTEE',
|
||||
'EN_COURS_TRAITEMENT',
|
||||
'RESOLUE',
|
||||
'CLOTUREE',
|
||||
] as const;
|
||||
export const STATUT_ANOMALIE = ['DETECTEE', 'EN_COURS_TRAITEMENT', 'RESOLUE', 'CLOTUREE'] as const;
|
||||
|
||||
export type StatutAnomalie = (typeof STATUT_ANOMALIE)[number];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user