controller

This commit is contained in:
Julian Krauser 2025-06-02 13:14:09 +02:00
parent 9f2a08ccc9
commit 2609ecc1bf
17 changed files with 320 additions and 95 deletions

View file

@ -19,12 +19,10 @@ export async function getAllInspectionsForRelated(req: Request, res: Response):
let relationId = req.params.relatedId as string;
let offset = parseInt((req.query.offset as string) ?? "0");
let count = parseInt((req.query.count as string) ?? "25");
let search = (req.query.search as string) ?? "";
let noLimit = req.query.noLimit === "true";
let ids = ((req.query.ids ?? "") as string).split(",").filter((i) => i);
//{ offset, count, search, noLimit, ids }
let [inspections, total] = await InspectionService.getAllForRelated({ equipmentId: relationId });
let where = relation === "equipment" ? { equipmentId: relationId } : { vehicleId: relationId };
let [inspections, total] = await InspectionService.getAllForRelated(where, { offset, count, noLimit });
res.json({
inspections: inspections,