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