add isCommission
This commit is contained in:
parent
b0d6e50cf1
commit
85ca3a9b0a
6 changed files with 116 additions and 0 deletions
|
|
@ -67,6 +67,7 @@ export class OrgChild1Controller {
|
|||
orgChild1Fax: orgChild1.orgChild1Fax,
|
||||
orgRevisionId: orgChild1.orgRevisionId,
|
||||
isOfficer: orgChild1.isOfficer,
|
||||
isInformation: orgChild1.isInformation,
|
||||
misId: orgChild1.misId,
|
||||
orgCode: orgChild1.orgRoot.orgRootCode + orgChild1.orgChild1Code,
|
||||
};
|
||||
|
|
@ -107,6 +108,23 @@ export class OrgChild1Controller {
|
|||
}
|
||||
}
|
||||
|
||||
if (requestBody.isInformation == true) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id: rootIdExits.orgRevisionId },
|
||||
relations: ["orgChild1s"],
|
||||
});
|
||||
if (orgRevision != null) {
|
||||
await Promise.all(
|
||||
orgRevision.orgChild1s
|
||||
.filter((x: OrgChild1) => x.isInformation == true)
|
||||
.map(async (item: OrgChild1) => {
|
||||
item.isInformation = false;
|
||||
await this.child1Repository.save(item);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const revisionIdExits = await this.orgRevisionRepository.findOne({
|
||||
where: { id: rootIdExits.orgRevisionId },
|
||||
});
|
||||
|
|
@ -224,6 +242,23 @@ export class OrgChild1Controller {
|
|||
}
|
||||
}
|
||||
|
||||
if (requestBody.isInformation == true) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id: rootIdExits.orgRevisionId },
|
||||
relations: ["orgChild1s"],
|
||||
});
|
||||
if (orgRevision != null) {
|
||||
await Promise.all(
|
||||
orgRevision.orgChild1s
|
||||
.filter((x: OrgChild1) => x.isInformation == true)
|
||||
.map(async (item: OrgChild1) => {
|
||||
item.isInformation = false;
|
||||
await this.child1Repository.save(item);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const revisionIdExits = await this.orgRevisionRepository.findOne({
|
||||
where: { id: rootIdExits.orgRevisionId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ export class OrgRootController extends Controller {
|
|||
orgRootFax: orgRoot.orgRootFax,
|
||||
orgRevisionId: orgRoot.orgRevisionId,
|
||||
isDeputy: orgRoot.isDeputy,
|
||||
isCommission: orgRoot.isCommission,
|
||||
misId: orgRoot.misId,
|
||||
orgCode: orgRoot.orgRootCode + "00",
|
||||
};
|
||||
|
|
@ -122,6 +123,23 @@ export class OrgRootController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
if (requestBody.isCommission == true) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id: requestBody.orgRevisionId },
|
||||
relations: ["orgRoots"],
|
||||
});
|
||||
if (orgRevision != null) {
|
||||
await Promise.all(
|
||||
orgRevision.orgRoots
|
||||
.filter((x: OrgRoot) => x.isCommission == true)
|
||||
.map(async (item: OrgRoot) => {
|
||||
item.isCommission = false;
|
||||
await this.orgRootRepository.save(item);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const validOrgRootRanks = ["DEPARTMENT", "OFFICE", "DIVISION", "SECTION"];
|
||||
if (!validOrgRootRanks.includes(requestBody.orgRootRank.toUpperCase())) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. orgRootRank");
|
||||
|
|
@ -230,6 +248,23 @@ export class OrgRootController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
if (requestBody.isCommission == true) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { id: requestBody.orgRevisionId },
|
||||
relations: ["orgRoots"],
|
||||
});
|
||||
if (orgRevision != null) {
|
||||
await Promise.all(
|
||||
orgRevision.orgRoots
|
||||
.filter((x: OrgRoot) => x.isCommission == true)
|
||||
.map(async (item: OrgRoot) => {
|
||||
item.isCommission = false;
|
||||
await this.orgRootRepository.save(item);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const revisionIdExits = await this.orgRevisionRepository.findOne({
|
||||
where: { id: requestBody.orgRevisionId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -783,6 +783,7 @@ export class OrganizationController extends Controller {
|
|||
.select([
|
||||
"orgRoot.id",
|
||||
"orgRoot.isDeputy",
|
||||
"orgRoot.isCommission",
|
||||
"orgRoot.orgRootName",
|
||||
"orgRoot.orgRootShortName",
|
||||
"orgRoot.orgRootCode",
|
||||
|
|
@ -816,6 +817,7 @@ export class OrganizationController extends Controller {
|
|||
.select([
|
||||
"orgChild1.id",
|
||||
"orgChild1.isOfficer",
|
||||
"orgChild1.isInformation",
|
||||
"orgChild1.orgChild1Name",
|
||||
"orgChild1.orgChild1ShortName",
|
||||
"orgChild1.orgChild1Code",
|
||||
|
|
@ -958,6 +960,7 @@ export class OrganizationController extends Controller {
|
|||
responsibility: orgRoot.responsibility,
|
||||
isOfficer: false,
|
||||
isDeputy: orgRoot.isDeputy,
|
||||
isCommission: orgRoot.isCommission,
|
||||
labelName:
|
||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
||||
totalPosition: await this.posMasterRepository.count({
|
||||
|
|
@ -1069,6 +1072,7 @@ export class OrganizationController extends Controller {
|
|||
orgRootName: orgRoot.orgRootName,
|
||||
responsibility: orgChild1.responsibility,
|
||||
isOfficer: orgChild1.isOfficer,
|
||||
isInformation: orgChild1.isInformation,
|
||||
labelName:
|
||||
orgChild1.orgChild1Name +
|
||||
" " +
|
||||
|
|
@ -1605,6 +1609,7 @@ export class OrganizationController extends Controller {
|
|||
.select([
|
||||
"orgRoot.id",
|
||||
"orgRoot.isDeputy",
|
||||
"orgRoot.isCommission",
|
||||
"orgRoot.orgRootName",
|
||||
"orgRoot.orgRootShortName",
|
||||
"orgRoot.orgRootCode",
|
||||
|
|
@ -1628,6 +1633,7 @@ export class OrganizationController extends Controller {
|
|||
.select([
|
||||
"orgChild1.id",
|
||||
"orgChild1.isOfficer",
|
||||
"orgChild1.isInformation",
|
||||
"orgChild1.orgChild1Name",
|
||||
"orgChild1.orgChild1ShortName",
|
||||
"orgChild1.orgChild1Code",
|
||||
|
|
@ -1739,6 +1745,7 @@ export class OrganizationController extends Controller {
|
|||
orgRevisionId: orgRoot.orgRevisionId,
|
||||
orgRootName: orgRoot.orgRootName,
|
||||
isDeputy: orgRoot.isDeputy,
|
||||
isCommission: orgRoot.isCommission,
|
||||
responsibility: orgRoot.responsibility,
|
||||
labelName:
|
||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
||||
|
|
@ -1851,6 +1858,7 @@ export class OrganizationController extends Controller {
|
|||
orgRootName: orgRoot.orgRootName,
|
||||
responsibility: orgChild1.responsibility,
|
||||
isOfficer: orgChild1.isOfficer,
|
||||
isInformation: orgChild1.isInformation,
|
||||
labelName:
|
||||
orgChild1.orgChild1Name +
|
||||
" " +
|
||||
|
|
@ -2383,6 +2391,7 @@ export class OrganizationController extends Controller {
|
|||
"orgRoot.id",
|
||||
"orgRoot.misId",
|
||||
"orgRoot.isDeputy",
|
||||
"orgRoot.isCommission",
|
||||
"orgRoot.orgRootName",
|
||||
"orgRoot.orgRootShortName",
|
||||
"orgRoot.orgRootCode",
|
||||
|
|
@ -2417,6 +2426,7 @@ export class OrganizationController extends Controller {
|
|||
"orgChild1.id",
|
||||
"orgChild1.misId",
|
||||
"orgChild1.isOfficer",
|
||||
"orgChild1.isInformation",
|
||||
"orgChild1.orgChild1Name",
|
||||
"orgChild1.orgChild1ShortName",
|
||||
"orgChild1.orgChild1Code",
|
||||
|
|
@ -2562,6 +2572,7 @@ export class OrganizationController extends Controller {
|
|||
orgRevisionId: orgRoot.orgRevisionId,
|
||||
orgRootName: orgRoot.orgRootName,
|
||||
isDeputy: orgRoot.isDeputy,
|
||||
isCommission: orgRoot.isCommission,
|
||||
responsibility: orgRoot.responsibility,
|
||||
labelName:
|
||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
||||
|
|
@ -2675,6 +2686,7 @@ export class OrganizationController extends Controller {
|
|||
orgRootName: orgRoot.orgRootName,
|
||||
responsibility: orgChild1.responsibility,
|
||||
isOfficer: orgChild1.isOfficer,
|
||||
isInformation: orgChild1.isInformation,
|
||||
labelName:
|
||||
orgChild1.orgChild1Name +
|
||||
" " +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue