controller
This commit is contained in:
parent
9f2a08ccc9
commit
2609ecc1bf
17 changed files with 320 additions and 95 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue