next and running inspections
This commit is contained in:
parent
8747baaf2e
commit
705297ba50
6 changed files with 142 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Not } from "typeorm";
|
||||
import { IsNull, Not } from "typeorm";
|
||||
import { dataSource } from "../../../data-source";
|
||||
import { inspection } from "../../../entity/unit/inspection/inspection";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
|
@ -25,6 +25,12 @@ export default abstract class InspectionCommandHandler {
|
|||
.set({
|
||||
hasNewer: true,
|
||||
})
|
||||
.where({
|
||||
inspectionPlanId: createInspection.inspectionPlanId,
|
||||
equipmentId: createInspection.assigned == "equipment" ? createInspection.relatedId : IsNull(),
|
||||
vehicleId: createInspection.assigned == "vehicle" ? createInspection.relatedId : IsNull(),
|
||||
wearableId: createInspection.assigned == "wearable" ? createInspection.relatedId : IsNull(),
|
||||
})
|
||||
.execute();
|
||||
|
||||
await manager
|
||||
|
@ -38,6 +44,7 @@ export default abstract class InspectionCommandHandler {
|
|||
inspectionVersionedPlanId: latestVersionedPlan.id,
|
||||
equipmentId: createInspection.assigned == "equipment" ? createInspection.relatedId : null,
|
||||
vehicleId: createInspection.assigned == "vehicle" ? createInspection.relatedId : null,
|
||||
wearableId: createInspection.assigned == "wearable" ? createInspection.relatedId : null,
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue