test(3) #2160
This commit is contained in:
parent
65789c6ac6
commit
804ee8a639
1 changed files with 25 additions and 25 deletions
|
|
@ -578,33 +578,33 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
}
|
||||
assignMap.get(dna)!.push(posmasterAssign);
|
||||
}
|
||||
// ดึง permissionProfiles ของ revision เดิม
|
||||
const oldPermissionProfiles = await permissionProfilesRepository.find({
|
||||
relations: ["orgRootTree"],
|
||||
where: {
|
||||
orgRootTree: {
|
||||
orgRevisionId: orgRevisionPublish?.id,
|
||||
}
|
||||
}
|
||||
});
|
||||
// สร้าง Map: ancestorDNA → permissionProfiles[]
|
||||
const permissionMap = new Map<string, PermissionProfile[]>();
|
||||
for (const permissionProfile of oldPermissionProfiles) {
|
||||
const dna = permissionProfile.orgRootTree.ancestorDNA;
|
||||
if (!permissionMap.has(dna)) {
|
||||
permissionMap.set(dna, []);
|
||||
}
|
||||
permissionMap.get(dna)!.push(permissionProfile);
|
||||
}
|
||||
const newRoots = await orgRootRepository.find({
|
||||
where: { orgRevisionId: orgRevisionDraft?.id },
|
||||
});
|
||||
const newRootMap = new Map(
|
||||
newRoots.map(r => [r.ancestorDNA, r.id])
|
||||
);
|
||||
// // ดึง permissionProfiles ของ revision เดิม
|
||||
// const oldPermissionProfiles = await permissionProfilesRepository.find({
|
||||
// relations: ["orgRootTree"],
|
||||
// where: {
|
||||
// orgRootTree: {
|
||||
// orgRevisionId: orgRevisionPublish?.id,
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// // สร้าง Map: ancestorDNA → permissionProfiles[]
|
||||
// const permissionMap = new Map<string, PermissionProfile[]>();
|
||||
// for (const permissionProfile of oldPermissionProfiles) {
|
||||
// const dna = permissionProfile.orgRootTree.ancestorDNA;
|
||||
// if (!permissionMap.has(dna)) {
|
||||
// permissionMap.set(dna, []);
|
||||
// }
|
||||
// permissionMap.get(dna)!.push(permissionProfile);
|
||||
// }
|
||||
// const newRoots = await orgRootRepository.find({
|
||||
// where: { orgRevisionId: orgRevisionDraft?.id },
|
||||
// });
|
||||
// const newRootMap = new Map(
|
||||
// newRoots.map(r => [r.ancestorDNA, r.id])
|
||||
// );
|
||||
const _null: any = null;
|
||||
for (const item of posMaster) {
|
||||
|
||||
|
||||
// Clone posMasterAssign xxx
|
||||
const assigns = assignMap.get(item.ancestorDNA);
|
||||
if (assigns && assigns.length > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue