unit/#102-base-management #121

Merged
jkeffects merged 35 commits from unit/#102-base-management into milestone/ff-admin-unit 2025-07-14 13:36:35 +00:00
Showing only changes of commit aeb1ccbc42 - Show all commits

View file

@ -1,7 +1,6 @@
import { Like, In } from "typeorm";
import { dataSource } from "../../../data-source";
import { inspectionPlan } from "../../../entity/unit/inspection/inspectionPlan";
import { DB_TYPE } from "../../../env.defaults";
import DatabaseActionException from "../../../exceptions/databaseActionException";
export default abstract class InspectionPlanService {
@ -13,9 +12,7 @@ export default abstract class InspectionPlanService {
"inspectionPlan.latestVersionedPlan",
"inspectionPlan.versionedPlans",
"latestVersionedPlan",
DB_TYPE == "postgres"
? 'latestVersionedPlan.inspectionPlanId = inspectionPlan.id AND latestVersionedPlan.version = (SELECT MAX("ivp"."createdAt") FROM "inspection_versioned_plan" "ivp" WHERE "ivp"."inspectionPlanId" = "inspectionPlan"."id")'
: "latestVersionedPlan.inspectionPlanId = inspectionPlan.id AND latestVersionedPlan.version = (SELECT MAX(ivp.createdAt) FROM inspection_versioned_plan ivp WHERE ivp.inspectionPlanId = inspectionPlan.id)"
'latestVersionedPlan.inspectionPlanId = inspectionPlan.id AND latestVersionedPlan.version = (SELECT MAX("ivp"."createdAt") FROM "inspection_versioned_plan" "ivp" WHERE "ivp"."inspectionPlanId" = "inspectionPlan"."id")'
)
.leftJoinAndSelect("latestVersionedPlan.inspectionPoints", "inspectionPoints")
.leftJoinAndSelect("inspectionPlan.equipmentType", "equipmentType")