validate draft and publish
This commit is contained in:
parent
cc7c5c26ae
commit
6f57be2fe9
5 changed files with 80 additions and 63 deletions
|
|
@ -622,14 +622,28 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
// requestBody.typeDraft.toUpperCase() == "ORG_POSITION_ROLE" ||
|
||||
// requestBody.typeDraft.toUpperCase() == "ORG_POSITION_PERSON_ROLE"
|
||||
// ) {
|
||||
// _orgemployeePosMaster = orgemployeePosMaster.map((x) => ({
|
||||
// ...x,
|
||||
// ancestorDNA:
|
||||
// x.ancestorDNA == null || x.ancestorDNA == "00000000-0000-0000-0000-000000000000"
|
||||
// ? x.id
|
||||
// : x.ancestorDNA,
|
||||
// }));
|
||||
// await repoEmployeePosmaster.save(_orgemployeePosMaster);
|
||||
const validProfileIds = new Set(
|
||||
(await repoProfileEmployee.find({ select: ["id"] })).map(p => p.id)
|
||||
);
|
||||
|
||||
_orgemployeePosMaster = orgemployeePosMaster.map((x) => ({
|
||||
...x,
|
||||
current_holderId: x.current_holderId && validProfileIds.has(x.current_holderId)
|
||||
? x.current_holderId
|
||||
: null,
|
||||
ancestorDNA:
|
||||
x.ancestorDNA == null || x.ancestorDNA == "00000000-0000-0000-0000-000000000000"
|
||||
!x.ancestorDNA || x.ancestorDNA === "00000000-0000-0000-0000-000000000000"
|
||||
? x.id
|
||||
: x.ancestorDNA,
|
||||
}));
|
||||
// await repoEmployeePosmaster.save(_orgemployeePosMaster);
|
||||
await repoEmployeePosmaster
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue