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( const node = {
posMasters orgRootName: orgRoot.orgRootName,
.filter((posMaster) => posMaster.orgRootId === orgRoot.id) orgTreeName: orgRoot.orgRootName,
.map(async (posMaster) => { orgTreeShortName: orgRoot.orgRootShortName,
await Promise.all( posMasters: await Promise.all(
positions posMasters
.filter((position) => position.posMasterId === posMaster.id) .filter((posMaster) => posMaster.orgRootId === orgRoot.id)
.map(async (position) => { .map(async (posMaster) => {
const node = { return {
orgRootName: orgRoot.orgRootName, posMasterNoPrefix: posMaster.posMasterNoPrefix,
orgTreeName: orgRoot.orgRootName, posMasterNo: posMaster.posMasterNo,
orgTreeShortName: orgRoot.orgRootShortName, posMasterNoSuffix: posMaster.posMasterNoSuffix,
posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
positionName: position.positionName,
posType: position.posType == null ? null : position.posType.posTypeName,
posLevel: position.posLevel == null ? null : position.posLevel.posLevelName,
posExecutive:
position.posExecutive == null
? null
: position.posExecutive.posExecutiveName,
};
data.push(node);
}),
);
}),
),
await Promise.all(
orgChild1Data
.filter((orgChild1) => orgChild1.orgRootId === orgRoot.id)
.map(async (orgChild1) => {
const node = {
positions: await Promise.all( positions: await Promise.all(
posMasters positions
.filter((posMaster) => posMaster.orgChild1Id === orgChild1.id) .filter((position) => position.posMasterId === posMaster.id)
.map(async (posMaster) => { .map(async (position) => {
await Promise.all( return {
positionName: position.positionName,
posType: position.posType == null ? null : position.posType.posTypeName,
posLevel:
position.posLevel == null ? null : position.posLevel.posLevelName,
posExecutive:
position.posExecutive == null
? null
: position.posExecutive.posExecutiveName,
};
}),
),
};
}),
),
};
data.push(node);
await Promise.all(
orgChild1Data
.filter((orgChild1) => orgChild1.orgRootId === orgRoot.id)
.map(async (orgChild1) => {
const node = {
orgRootName: orgChild1.orgChild1Name,
orgTreeName: orgChild1.orgChild1Name,
orgTreeShortName: orgChild1.orgChild1ShortName,
posMasters: await Promise.all(
posMasters
.filter((posMaster) => posMaster.orgChild1Id === orgChild1.id)
.map(async (posMaster) => {
return {
posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
positions: await Promise.all(
positions positions
.filter((position) => position.posMasterId === posMaster.id) .filter((position) => position.posMasterId === posMaster.id)
.map(async (position) => { .map(async (position) => {
const node = { return {
orgRootName: orgRoot.orgRootName,
orgTreeName: orgChild1.orgChild1Name,
orgTreeShortName: orgChild1.orgChild1ShortName,
posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
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);
}), }),
); ),
}), };
), }),
}; ),
await Promise.all( };
orgChild2Data data.push(node);
.filter((orgChild2) => orgChild2.orgChild1Id === orgChild1.id) await Promise.all(
.map(async (orgChild2) => { orgChild2Data
const node = { .filter((orgChild2) => orgChild2.orgChild1Id === orgChild1.id)
positions: await Promise.all( .map(async (orgChild2) => {
posMasters const node = {
.filter((posMaster) => posMaster.orgChild2Id === orgChild2.id) orgRootName: orgChild2.orgChild2Name,
.map(async (posMaster) => { orgTreeName: orgChild2.orgChild2Name,
await Promise.all( orgTreeShortName: orgChild2.orgChild2ShortName,
posMasters: await Promise.all(
posMasters
.filter((posMaster) => posMaster.orgChild2Id === orgChild2.id)
.map(async (posMaster) => {
return {
posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
positions: await Promise.all(
positions positions
.filter((position) => position.posMasterId === posMaster.id) .filter((position) => position.posMasterId === posMaster.id)
.map(async (position) => { .map(async (position) => {
const node = { return {
orgRootName: orgRoot.orgRootName,
orgTreeName: orgChild2.orgChild2Name,
orgTreeShortName: orgChild2.orgChild2ShortName,
posMasterNoPrefix: posMaster.posMasterNoPrefix,
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
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);
}), }),
); ),
}), };
), }),
}; ),
await Promise.all( };
orgChild3Data data.push(node);
.filter((orgChild3) => orgChild3.orgChild2Id === orgChild2.id) await Promise.all(
.map(async (orgChild3) => { orgChild3Data
const node = { .filter((orgChild3) => orgChild3.orgChild2Id === orgChild2.id)
positions: await Promise.all( .map(async (orgChild3) => {
posMasters const node = {
.filter((posMaster) => posMaster.orgChild3Id === orgChild3.id) orgRootName: orgChild3.orgChild3Name,
.map(async (posMaster) => { orgTreeName: orgChild3.orgChild3Name,
await Promise.all( orgTreeShortName: orgChild3.orgChild3ShortName,
posMasters: await Promise.all(
posMasters
.filter((posMaster) => posMaster.orgChild3Id === orgChild3.id)
.map(async (posMaster) => {
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);
}), }),
); ),
}), };
), }),
}; ),
await Promise.all( };
orgChild4Data data.push(node);
.filter((orgChild4) => orgChild4.orgChild3Id === orgChild3.id) await Promise.all(
.map(async (orgChild4) => { orgChild4Data
const node = { .filter((orgChild4) => orgChild4.orgChild3Id === orgChild3.id)
positions: await Promise.all( .map(async (orgChild4) => {
posMasters const node = {
.filter( orgRootName: orgChild4.orgChild4Name,
(posMaster) => posMaster.orgChild4Id === orgChild4.id, orgTreeName: orgChild4.orgChild4Name,
) orgTreeShortName: orgChild4.orgChild4ShortName,
.map(async (posMaster) => { posMasters: await Promise.all(
await Promise.all( posMasters
.filter(
(posMaster) => posMaster.orgChild4Id === orgChild4.id,
)
.map(async (posMaster) => {
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,20 +383,21 @@ export class ReportController extends Controller {
? null ? null
: position.posExecutive.posExecutiveName, : position.posExecutive.posExecutiveName,
}; };
data.push(node);
}), }),
); ),
}), };
), }),
}; ),
}), };
); data.push(node);
}), }),
); );
}), }),
); );
}), }),
); );
}),
);
}), }),
); );