command Handlers and schema update
This commit is contained in:
parent
0f6401953f
commit
7883bb7d7f
42 changed files with 1076 additions and 159 deletions
|
@ -0,0 +1,28 @@
|
|||
import { dataSource } from "../../../data-source";
|
||||
import { inspectionVersionedPlan } from "../../../entity/unit/inspection/inspectionVersionedPlan";
|
||||
import DatabaseActionException from "../../../exceptions/databaseActionException";
|
||||
import { CreateInspectionVersionedPlanCommand } from "./inspectionVersionedPlanCommand";
|
||||
|
||||
export default abstract class InspectionVersionedPlanCommandHandler {
|
||||
/**
|
||||
* @description create inspectionVersionedPlan
|
||||
* @param {CreateInspectionVersionedPlanCommand} createInspectionVersionedPlan
|
||||
* @returns {Promise<number>}
|
||||
*/
|
||||
static async create(createInspectionVersionedPlan: CreateInspectionVersionedPlanCommand): Promise<number> {
|
||||
return await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(inspectionVersionedPlan)
|
||||
.values({
|
||||
inspectionPlanId: createInspectionVersionedPlan.inspectionPlanId,
|
||||
})
|
||||
.execute()
|
||||
.then((result) => {
|
||||
return result.identifiers[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new DatabaseActionException("CREATE", "inspectionVersionedPlan", err);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue