test เผยแพร่

This commit is contained in:
kittapath 2025-03-11 22:58:17 +07:00
parent f4c4804915
commit ce5a595bc6
4 changed files with 630 additions and 50 deletions

View file

@ -208,8 +208,10 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
item.lastUpdatedAt = lastUpdatedAt;
await repoPosmaster.save(item).catch((e) => console.log(e));
}
console.log(orgRevisionPublish);
console.log("zzzzzzzzzzzzzzzz");
if (orgRevisionPublish != null) {
console.log("cccccccccccccccccccccc");
//new main revision
const before = null;
@ -242,12 +244,14 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
where: { orgRevisionId: orgRevisionPublish.id },
});
console.log("xxxxxxxxxxxxxxxxxxx");
//หา dna posmaster ถ้าไม่มีให้เอาตัวเองเป็น dna
const orgemployeePosMaster = await repoEmployeePosmaster.find({
where: { orgRevisionId: orgRevisionPublish.id },
relations: ["positions"],
});
console.log("vvvvvvvvvvvvvvvvvvv");
let _orgemployeePosMaster: EmployeePosMaster[];
// if (
// requestBody.typeDraft.toUpperCase() == "ORG_POSITION" ||
@ -262,7 +266,9 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
? x.id
: x.ancestorDNA,
}));
console.log("aaaaaaaaaaaaaaaaaa");
await repoEmployeePosmaster.save(_orgemployeePosMaster);
console.log("sssssssssssssss");
// }
//หา dna posmaster ถ้าไม่มีให้เอาตัวเองเป็น dna
const orgemployeeTempPosMaster = await repoEmployeeTempPosmaster.find({
@ -270,6 +276,7 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
relations: ["positions"],
});
console.log("ddddddddddddddddf");
let _orgemployeeTempPosMaster: EmployeeTempPosMaster[];
// if (
// requestBody.typeDraft.toUpperCase() == "ORG_POSITION" ||
@ -284,11 +291,14 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
? x.id
: x.ancestorDNA,
}));
console.log("ffffffffffffffffff");
await repoEmployeeTempPosmaster.save(_orgemployeeTempPosMaster);
console.log("gggggggggggggggggg");
// }
//create org
orgRoot.forEach(async (x: any) => {
console.log("qqqqqqqqqqqqqqqqq");
var dataId = x.id;
// if (
// requestBody.typeDraft.toUpperCase() == "ORG_POSITION" ||
@ -301,6 +311,7 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
_orgemployeePosMaster
.filter((x: EmployeePosMaster) => x.orgRootId == dataId && x.orgChild1Id == null)
.map(async (item: any) => {
console.log("ttttttttttttttttttttt");
delete item.id;
const employeePosMaster = Object.assign(new EmployeePosMaster(), item);
employeePosMaster.positions = [];