update or create inspection versioned plan
This commit is contained in:
parent
95b6cec66d
commit
db3004fa04
13 changed files with 229 additions and 11 deletions
|
@ -125,4 +125,22 @@ export default abstract class InspectionService {
|
|||
throw new DatabaseActionException("SELECT", "inspection", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description uses versionedPlan
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
static async usesVersionedInspectionPlan(inspectionVersionedPlanId: string): Promise<boolean> {
|
||||
return await dataSource
|
||||
.getRepository(inspection)
|
||||
.createQueryBuilder("inspection")
|
||||
.where({ inspectionVersionedPlanId })
|
||||
.getExists()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "used inspection", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,4 +62,22 @@ export default abstract class InspectionVersionedPlanService {
|
|||
throw new DatabaseActionException("SELECT", "inspectionVersionedPlan", err);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description count for plan id
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async countForPlanId(planId: string): Promise<number> {
|
||||
return await dataSource
|
||||
.getRepository(inspectionVersionedPlan)
|
||||
.createQueryBuilder("inspectionVersionedPlan")
|
||||
.where({ inspectionPlanId: planId })
|
||||
.getCount()
|
||||
.then((res) => {
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("SELECT", "inspectionVersionedPlan", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue