แก้สิทธิ์ สกจ

This commit is contained in:
kittapath 2024-09-13 15:45:15 +07:00
parent ceaebeaafc
commit 376ab804db

View file

@ -105,8 +105,13 @@ export class OrgChild1Controller {
} }
if (requestBody.isOfficer == true) { if (requestBody.isOfficer == true) {
const orgRevision = await this.orgRevisionRepository.findOne({
where: { id: rootIdExits.orgRevisionId },
relations: ["orgChild1s"],
});
if (orgRevision != null) {
await Promise.all( await Promise.all(
rootIdExits.orgChild1s orgRevision.orgChild1s
.filter((x: OrgChild1) => x.isOfficer == true) .filter((x: OrgChild1) => x.isOfficer == true)
.map(async (item: OrgChild1) => { .map(async (item: OrgChild1) => {
item.isOfficer = false; item.isOfficer = false;
@ -114,6 +119,7 @@ export class OrgChild1Controller {
}), }),
); );
} }
}
const revisionIdExits = await this.orgRevisionRepository.findOne({ const revisionIdExits = await this.orgRevisionRepository.findOne({
where: { id: rootIdExits.orgRevisionId }, where: { id: rootIdExits.orgRevisionId },
@ -214,8 +220,13 @@ export class OrgChild1Controller {
} }
if (requestBody.isOfficer == true) { if (requestBody.isOfficer == true) {
const orgRevision = await this.orgRevisionRepository.findOne({
where: { id: rootIdExits.orgRevisionId },
relations: ["orgChild1s"],
});
if (orgRevision != null) {
await Promise.all( await Promise.all(
rootIdExits.orgChild1s orgRevision.orgChild1s
.filter((x: OrgChild1) => x.isOfficer == true) .filter((x: OrgChild1) => x.isOfficer == true)
.map(async (item: OrgChild1) => { .map(async (item: OrgChild1) => {
item.isOfficer = false; item.isOfficer = false;
@ -223,6 +234,7 @@ export class OrgChild1Controller {
}), }),
); );
} }
}
const revisionIdExits = await this.orgRevisionRepository.findOne({ const revisionIdExits = await this.orgRevisionRepository.findOne({
where: { id: rootIdExits.orgRevisionId }, where: { id: rootIdExits.orgRevisionId },