orgTreeOrder เพิ่มหน่วยงาน

This commit is contained in:
Bright 2024-02-12 17:31:02 +07:00
parent 145e64b655
commit 019ded1aa3
5 changed files with 35 additions and 0 deletions

View file

@ -128,11 +128,18 @@ export class OrgRootController extends Controller {
"not found. orgRevisionIsDraft:true, orgRevisionIsCurrent:false",
);
}
const order:any = await this.orgRootRepository.findOne({
where: {
orgRevisionId: requestBody.orgRevisionId
},
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;
await this.orgRootRepository.save(orgRoot);
return new HttpSuccess();