แก้ error สร้าง node
This commit is contained in:
parent
634c82eb5c
commit
60b25c6620
6 changed files with 39 additions and 47 deletions
|
|
@ -128,18 +128,19 @@ export class OrgRootController extends Controller {
|
|||
"not found. orgRevisionIsDraft:true, orgRevisionIsCurrent:false",
|
||||
);
|
||||
}
|
||||
const order:any = await this.orgRootRepository.findOne({
|
||||
const order: any = await this.orgRootRepository.findOne({
|
||||
where: {
|
||||
orgRevisionId: requestBody.orgRevisionId
|
||||
orgRevisionId: requestBody.orgRevisionId,
|
||||
},
|
||||
order: { orgRootOrder: "DESC" }
|
||||
})
|
||||
order: { orgRootOrder: "DESC" },
|
||||
});
|
||||
try {
|
||||
orgRoot.createdUserId = request.user.sub;
|
||||
orgRoot.createdFullName = request.user.name;
|
||||
orgRoot.lastUpdateUserId = request.user.sub;
|
||||
orgRoot.lastUpdateFullName = request.user.name;
|
||||
orgRoot.orgRootOrder = order.orgRootOrder == null ? 1 : order.orgRootOrder+1;
|
||||
orgRoot.orgRootOrder =
|
||||
order == null || order.orgRootOrder == null ? 1 : order.orgRootOrder + 1;
|
||||
await this.orgRootRepository.save(orgRoot);
|
||||
|
||||
return new HttpSuccess();
|
||||
|
|
@ -263,7 +264,7 @@ export class OrgRootController extends Controller {
|
|||
}
|
||||
try {
|
||||
const posMasters = await this.posMasterRepository.find({
|
||||
where: { orgRootId: id}
|
||||
where: { orgRootId: id },
|
||||
});
|
||||
const positions = await this.positionRepository.find({
|
||||
where: [{ posMasterId: In(posMasters.map((x) => x.id)) }],
|
||||
|
|
@ -275,7 +276,7 @@ export class OrgRootController extends Controller {
|
|||
await this.orgChild3Repository.delete({ orgRootId: id });
|
||||
await this.orgChild2Repository.delete({ orgRootId: id });
|
||||
await this.orgChild1Repository.delete({ orgRootId: id });
|
||||
await this.orgRootRepository.delete({id});
|
||||
await this.orgRootRepository.delete({ id });
|
||||
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue