inspection finish and print

This commit is contained in:
Julian Krauser 2025-07-11 14:02:36 +02:00
parent 0f3e4488f4
commit 9ef82adef7
12 changed files with 358 additions and 76 deletions

View file

@ -20,6 +20,18 @@ export default abstract class InspectionService {
.leftJoinAndSelect("inspection.vehicle", "vehicle")
.leftJoinAndSelect("inspection.wearable", "wearable");
private static minifiedQuery = () =>
dataSource
.getRepository(inspection)
.createQueryBuilder("inspection")
.leftJoinAndSelect("inspection.inspectionPlan", "inspectionPlan")
.leftJoinAndSelect("inspectionPlan.equipmentType", "equipmentType")
.leftJoinAndSelect("inspectionPlan.vehicleType", "vehicleType")
.leftJoinAndSelect("inspectionPlan.wearableType", "wearableType")
.leftJoinAndSelect("inspection.equipment", "equipment")
.leftJoinAndSelect("inspection.vehicle", "vehicle")
.leftJoinAndSelect("inspection.wearable", "wearable");
/**
* @description get all inspections sorted by next inspection not having newer
* @returns {Promise<Array<inspection>>}
@ -63,7 +75,7 @@ export default abstract class InspectionService {
count?: number;
noLimit?: boolean;
}): Promise<[Array<inspection>, number]> {
let query = this.query().where({ finishedAt: IsNull() });
let query = this.minifiedQuery().where({ finishedAt: IsNull() });
if (!noLimit) {
query = query.offset(offset).limit(count);
@ -96,7 +108,7 @@ export default abstract class InspectionService {
noLimit?: boolean;
}
): Promise<[Array<inspection>, number]> {
let query = this.query().where(where);
let query = this.minifiedQuery().where(where);
if (!noLimit) {
query = query.offset(offset).limit(count);