no message

This commit is contained in:
Kittapath 2024-02-05 12:49:22 +07:00
parent 0acdee9bbc
commit de86b18959

View file

@ -183,54 +183,61 @@ export class ReportController extends Controller {
let data = new Array(); let data = new Array();
await Promise.all( await Promise.all(
orgRootData.map(async (orgRoot) => { orgRootData.map(async (orgRoot) => {
await Promise.all(
posMasters
.filter((posMaster) => posMaster.orgRootId === orgRoot.id)
.map(async (posMaster) => {
await Promise.all(
positions
.filter((position) => position.posMasterId === posMaster.id)
.map(async (position) => {
const node = { const node = {
orgRootName: orgRoot.orgRootName, orgRootName: orgRoot.orgRootName,
orgTreeName: orgRoot.orgRootName, orgTreeName: orgRoot.orgRootName,
orgTreeShortName: orgRoot.orgRootShortName, orgTreeShortName: orgRoot.orgRootShortName,
posMasters: await Promise.all(
posMasters
.filter((posMaster) => posMaster.orgRootId === orgRoot.id)
.map(async (posMaster) => {
return {
posMasterNoPrefix: posMaster.posMasterNoPrefix, posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo, posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix, posMasterNoSuffix: posMaster.posMasterNoSuffix,
positions: await Promise.all(
positions
.filter((position) => position.posMasterId === posMaster.id)
.map(async (position) => {
return {
positionName: position.positionName, positionName: position.positionName,
posType: position.posType == null ? null : position.posType.posTypeName, posType: position.posType == null ? null : position.posType.posTypeName,
posLevel: position.posLevel == null ? null : position.posLevel.posLevelName, posLevel:
position.posLevel == null ? null : position.posLevel.posLevelName,
posExecutive: posExecutive:
position.posExecutive == null position.posExecutive == null
? null ? null
: position.posExecutive.posExecutiveName, : position.posExecutive.posExecutiveName,
}; };
data.push(node);
}),
);
}), }),
), ),
};
}),
),
};
data.push(node);
await Promise.all( await Promise.all(
orgChild1Data orgChild1Data
.filter((orgChild1) => orgChild1.orgRootId === orgRoot.id) .filter((orgChild1) => orgChild1.orgRootId === orgRoot.id)
.map(async (orgChild1) => { .map(async (orgChild1) => {
const node = { const node = {
positions: await Promise.all( orgRootName: orgChild1.orgChild1Name,
orgTreeName: orgChild1.orgChild1Name,
orgTreeShortName: orgChild1.orgChild1ShortName,
posMasters: await Promise.all(
posMasters posMasters
.filter((posMaster) => posMaster.orgChild1Id === orgChild1.id) .filter((posMaster) => posMaster.orgChild1Id === orgChild1.id)
.map(async (posMaster) => { .map(async (posMaster) => {
await Promise.all( return {
positions
.filter((position) => position.posMasterId === posMaster.id)
.map(async (position) => {
const node = {
orgRootName: orgRoot.orgRootName,
orgTreeName: orgChild1.orgChild1Name,
orgTreeShortName: orgChild1.orgChild1ShortName,
posMasterNoPrefix: posMaster.posMasterNoPrefix, posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo, posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix, posMasterNoSuffix: posMaster.posMasterNoSuffix,
positions: await Promise.all(
positions
.filter((position) => position.posMasterId === posMaster.id)
.map(async (position) => {
return {
positionName: position.positionName, positionName: position.positionName,
posType: posType:
position.posType == null ? null : position.posType.posTypeName, position.posType == null ? null : position.posType.posTypeName,
@ -243,32 +250,34 @@ export class ReportController extends Controller {
? null ? null
: position.posExecutive.posExecutiveName, : position.posExecutive.posExecutiveName,
}; };
data.push(node);
}),
);
}), }),
), ),
}; };
}),
),
};
data.push(node);
await Promise.all( await Promise.all(
orgChild2Data orgChild2Data
.filter((orgChild2) => orgChild2.orgChild1Id === orgChild1.id) .filter((orgChild2) => orgChild2.orgChild1Id === orgChild1.id)
.map(async (orgChild2) => { .map(async (orgChild2) => {
const node = { const node = {
positions: await Promise.all( orgRootName: orgChild2.orgChild2Name,
orgTreeName: orgChild2.orgChild2Name,
orgTreeShortName: orgChild2.orgChild2ShortName,
posMasters: await Promise.all(
posMasters posMasters
.filter((posMaster) => posMaster.orgChild2Id === orgChild2.id) .filter((posMaster) => posMaster.orgChild2Id === orgChild2.id)
.map(async (posMaster) => { .map(async (posMaster) => {
await Promise.all( return {
positions
.filter((position) => position.posMasterId === posMaster.id)
.map(async (position) => {
const node = {
orgRootName: orgRoot.orgRootName,
orgTreeName: orgChild2.orgChild2Name,
orgTreeShortName: orgChild2.orgChild2ShortName,
posMasterNoPrefix: posMaster.posMasterNoPrefix, posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo, posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix, posMasterNoSuffix: posMaster.posMasterNoSuffix,
positions: await Promise.all(
positions
.filter((position) => position.posMasterId === posMaster.id)
.map(async (position) => {
return {
positionName: position.positionName, positionName: position.positionName,
posType: posType:
position.posType == null position.posType == null
@ -283,34 +292,36 @@ export class ReportController extends Controller {
? null ? null
: position.posExecutive.posExecutiveName, : position.posExecutive.posExecutiveName,
}; };
data.push(node);
}),
);
}), }),
), ),
}; };
}),
),
};
data.push(node);
await Promise.all( await Promise.all(
orgChild3Data orgChild3Data
.filter((orgChild3) => orgChild3.orgChild2Id === orgChild2.id) .filter((orgChild3) => orgChild3.orgChild2Id === orgChild2.id)
.map(async (orgChild3) => { .map(async (orgChild3) => {
const node = { const node = {
positions: await Promise.all( orgRootName: orgChild3.orgChild3Name,
orgTreeName: orgChild3.orgChild3Name,
orgTreeShortName: orgChild3.orgChild3ShortName,
posMasters: await Promise.all(
posMasters posMasters
.filter((posMaster) => posMaster.orgChild3Id === orgChild3.id) .filter((posMaster) => posMaster.orgChild3Id === orgChild3.id)
.map(async (posMaster) => { .map(async (posMaster) => {
await Promise.all( return {
posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
positions: await Promise.all(
positions positions
.filter( .filter(
(position) => position.posMasterId === posMaster.id, (position) => position.posMasterId === posMaster.id,
) )
.map(async (position) => { .map(async (position) => {
const node = { return {
orgRootName: orgRoot.orgRootName,
orgTreeName: orgChild3.orgChild3Name,
orgTreeShortName: orgChild3.orgChild3ShortName,
posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
positionName: position.positionName, positionName: position.positionName,
posType: posType:
position.posType == null position.posType == null
@ -325,37 +336,39 @@ export class ReportController extends Controller {
? null ? null
: position.posExecutive.posExecutiveName, : position.posExecutive.posExecutiveName,
}; };
data.push(node);
}),
);
}), }),
), ),
}; };
}),
),
};
data.push(node);
await Promise.all( await Promise.all(
orgChild4Data orgChild4Data
.filter((orgChild4) => orgChild4.orgChild3Id === orgChild3.id) .filter((orgChild4) => orgChild4.orgChild3Id === orgChild3.id)
.map(async (orgChild4) => { .map(async (orgChild4) => {
const node = { const node = {
positions: await Promise.all( orgRootName: orgChild4.orgChild4Name,
orgTreeName: orgChild4.orgChild4Name,
orgTreeShortName: orgChild4.orgChild4ShortName,
posMasters: await Promise.all(
posMasters posMasters
.filter( .filter(
(posMaster) => posMaster.orgChild4Id === orgChild4.id, (posMaster) => posMaster.orgChild4Id === orgChild4.id,
) )
.map(async (posMaster) => { .map(async (posMaster) => {
await Promise.all( return {
posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
positions: await Promise.all(
positions positions
.filter( .filter(
(position) => (position) =>
position.posMasterId === posMaster.id, position.posMasterId === posMaster.id,
) )
.map(async (position) => { .map(async (position) => {
const node = { return {
orgRootName: orgRoot.orgRootName,
orgTreeName: orgChild4.orgChild4Name,
orgTreeShortName: orgChild4.orgChild4ShortName,
posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
positionName: position.positionName, positionName: position.positionName,
posType: posType:
position.posType == null position.posType == null
@ -370,13 +383,14 @@ export class ReportController extends Controller {
? null ? null
: position.posExecutive.posExecutiveName, : position.posExecutive.posExecutiveName,
}; };
data.push(node);
}),
);
}), }),
), ),
}; };
}), }),
),
};
data.push(node);
}),
); );
}), }),
); );