av6-core 1.4.9 → 1.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -10
- package/dist/index.mjs +20 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2517,15 +2517,15 @@ var getUsersFromRoleAndLevel1Level2 = async (args) => {
|
|
|
2517
2517
|
case "FIXUJI":
|
|
2518
2518
|
const users = await args.prisma.userAreaMapping.findMany({
|
|
2519
2519
|
where: {
|
|
2520
|
-
areaId: {
|
|
2520
|
+
areaId: args.level1Ids.length ? {
|
|
2521
2521
|
in: args.level1Ids
|
|
2522
|
-
},
|
|
2522
|
+
} : void 0,
|
|
2523
2523
|
isActive: true,
|
|
2524
2524
|
userAreaDeptMappings: {
|
|
2525
2525
|
some: {
|
|
2526
|
-
deptId: {
|
|
2526
|
+
deptId: args.level2Ids.length ? {
|
|
2527
2527
|
in: args.level2Ids
|
|
2528
|
-
},
|
|
2528
|
+
} : void 0,
|
|
2529
2529
|
isActive: true,
|
|
2530
2530
|
userRoleMappings: {
|
|
2531
2531
|
some: {
|
|
@@ -2573,13 +2573,17 @@ var getUsersFromRoleAndLevel1Level2 = async (args) => {
|
|
|
2573
2573
|
const users2 = await args.prisma.userLevel1Mapping.findMany({
|
|
2574
2574
|
where: {
|
|
2575
2575
|
level1Id: {
|
|
2576
|
-
in: args.level1Ids
|
|
2576
|
+
in: args.level1Ids.length ? {
|
|
2577
|
+
in: args.level1Ids
|
|
2578
|
+
} : void 0
|
|
2577
2579
|
},
|
|
2578
2580
|
isActive: true,
|
|
2579
2581
|
userLevel1Level2Mappings: {
|
|
2580
2582
|
some: {
|
|
2581
2583
|
level2Id: {
|
|
2582
|
-
in: args.level2Ids
|
|
2584
|
+
in: args.level2Ids.length ? {
|
|
2585
|
+
in: args.level2Ids
|
|
2586
|
+
} : void 0
|
|
2583
2587
|
},
|
|
2584
2588
|
isActive: true,
|
|
2585
2589
|
userRoleMappings: {
|
|
@@ -2626,7 +2630,8 @@ var getStaffInfoFromStaffIds = async (args) => {
|
|
|
2626
2630
|
},
|
|
2627
2631
|
select: {
|
|
2628
2632
|
phoneNumber: true,
|
|
2629
|
-
email: true
|
|
2633
|
+
email: true,
|
|
2634
|
+
id: true
|
|
2630
2635
|
}
|
|
2631
2636
|
});
|
|
2632
2637
|
staffById = new Map(
|
|
@@ -2644,7 +2649,8 @@ var getStaffInfoFromStaffIds = async (args) => {
|
|
|
2644
2649
|
},
|
|
2645
2650
|
select: {
|
|
2646
2651
|
phoneNumber: true,
|
|
2647
|
-
email: true
|
|
2652
|
+
email: true,
|
|
2653
|
+
id: true
|
|
2648
2654
|
}
|
|
2649
2655
|
});
|
|
2650
2656
|
staffById = new Map(
|
|
@@ -2663,6 +2669,8 @@ async function resolveAllRecipients(args) {
|
|
|
2663
2669
|
});
|
|
2664
2670
|
const staffIdsFromStaffRules = /* @__PURE__ */ new Set();
|
|
2665
2671
|
const roleIdsNeeded = /* @__PURE__ */ new Set();
|
|
2672
|
+
const level1IdsNeeded = /* @__PURE__ */ new Set();
|
|
2673
|
+
const level2IdsNeeded = /* @__PURE__ */ new Set();
|
|
2666
2674
|
const onlyActiveByRuleId = /* @__PURE__ */ new Map();
|
|
2667
2675
|
for (const r of rules) {
|
|
2668
2676
|
const cfg = r.config ?? {};
|
|
@@ -2673,6 +2681,8 @@ async function resolveAllRecipients(args) {
|
|
|
2673
2681
|
for (const id of toArray(cfg.roleIds)) roleIdsNeeded.add(Number(id));
|
|
2674
2682
|
onlyActiveByRuleId.set(r.id, cfg.onlyActive ?? true);
|
|
2675
2683
|
}
|
|
2684
|
+
for (const id of toArray(cfg.level1Ids)) level1IdsNeeded.add(Number(id));
|
|
2685
|
+
for (const id of toArray(cfg.level2Ids)) level2IdsNeeded.add(Number(id));
|
|
2676
2686
|
}
|
|
2677
2687
|
const staffIdsFromRoleRules = /* @__PURE__ */ new Set();
|
|
2678
2688
|
const serviceDomain = args.eventConfig.serviceEvent.serviceDomain;
|
|
@@ -2680,8 +2690,8 @@ async function resolveAllRecipients(args) {
|
|
|
2680
2690
|
const mappings = await getUsersFromRoleAndLevel1Level2({
|
|
2681
2691
|
prisma: args.prisma,
|
|
2682
2692
|
roles: Array.from(roleIdsNeeded),
|
|
2683
|
-
level1Ids:
|
|
2684
|
-
level2Ids:
|
|
2693
|
+
level1Ids: Array.from(level1IdsNeeded),
|
|
2694
|
+
level2Ids: Array.from(level2IdsNeeded),
|
|
2685
2695
|
serviceDomain
|
|
2686
2696
|
});
|
|
2687
2697
|
for (const id of mappings) {
|
package/dist/index.mjs
CHANGED
|
@@ -2467,15 +2467,15 @@ var getUsersFromRoleAndLevel1Level2 = async (args) => {
|
|
|
2467
2467
|
case "FIXUJI":
|
|
2468
2468
|
const users = await args.prisma.userAreaMapping.findMany({
|
|
2469
2469
|
where: {
|
|
2470
|
-
areaId: {
|
|
2470
|
+
areaId: args.level1Ids.length ? {
|
|
2471
2471
|
in: args.level1Ids
|
|
2472
|
-
},
|
|
2472
|
+
} : void 0,
|
|
2473
2473
|
isActive: true,
|
|
2474
2474
|
userAreaDeptMappings: {
|
|
2475
2475
|
some: {
|
|
2476
|
-
deptId: {
|
|
2476
|
+
deptId: args.level2Ids.length ? {
|
|
2477
2477
|
in: args.level2Ids
|
|
2478
|
-
},
|
|
2478
|
+
} : void 0,
|
|
2479
2479
|
isActive: true,
|
|
2480
2480
|
userRoleMappings: {
|
|
2481
2481
|
some: {
|
|
@@ -2523,13 +2523,17 @@ var getUsersFromRoleAndLevel1Level2 = async (args) => {
|
|
|
2523
2523
|
const users2 = await args.prisma.userLevel1Mapping.findMany({
|
|
2524
2524
|
where: {
|
|
2525
2525
|
level1Id: {
|
|
2526
|
-
in: args.level1Ids
|
|
2526
|
+
in: args.level1Ids.length ? {
|
|
2527
|
+
in: args.level1Ids
|
|
2528
|
+
} : void 0
|
|
2527
2529
|
},
|
|
2528
2530
|
isActive: true,
|
|
2529
2531
|
userLevel1Level2Mappings: {
|
|
2530
2532
|
some: {
|
|
2531
2533
|
level2Id: {
|
|
2532
|
-
in: args.level2Ids
|
|
2534
|
+
in: args.level2Ids.length ? {
|
|
2535
|
+
in: args.level2Ids
|
|
2536
|
+
} : void 0
|
|
2533
2537
|
},
|
|
2534
2538
|
isActive: true,
|
|
2535
2539
|
userRoleMappings: {
|
|
@@ -2576,7 +2580,8 @@ var getStaffInfoFromStaffIds = async (args) => {
|
|
|
2576
2580
|
},
|
|
2577
2581
|
select: {
|
|
2578
2582
|
phoneNumber: true,
|
|
2579
|
-
email: true
|
|
2583
|
+
email: true,
|
|
2584
|
+
id: true
|
|
2580
2585
|
}
|
|
2581
2586
|
});
|
|
2582
2587
|
staffById = new Map(
|
|
@@ -2594,7 +2599,8 @@ var getStaffInfoFromStaffIds = async (args) => {
|
|
|
2594
2599
|
},
|
|
2595
2600
|
select: {
|
|
2596
2601
|
phoneNumber: true,
|
|
2597
|
-
email: true
|
|
2602
|
+
email: true,
|
|
2603
|
+
id: true
|
|
2598
2604
|
}
|
|
2599
2605
|
});
|
|
2600
2606
|
staffById = new Map(
|
|
@@ -2613,6 +2619,8 @@ async function resolveAllRecipients(args) {
|
|
|
2613
2619
|
});
|
|
2614
2620
|
const staffIdsFromStaffRules = /* @__PURE__ */ new Set();
|
|
2615
2621
|
const roleIdsNeeded = /* @__PURE__ */ new Set();
|
|
2622
|
+
const level1IdsNeeded = /* @__PURE__ */ new Set();
|
|
2623
|
+
const level2IdsNeeded = /* @__PURE__ */ new Set();
|
|
2616
2624
|
const onlyActiveByRuleId = /* @__PURE__ */ new Map();
|
|
2617
2625
|
for (const r of rules) {
|
|
2618
2626
|
const cfg = r.config ?? {};
|
|
@@ -2623,6 +2631,8 @@ async function resolveAllRecipients(args) {
|
|
|
2623
2631
|
for (const id of toArray(cfg.roleIds)) roleIdsNeeded.add(Number(id));
|
|
2624
2632
|
onlyActiveByRuleId.set(r.id, cfg.onlyActive ?? true);
|
|
2625
2633
|
}
|
|
2634
|
+
for (const id of toArray(cfg.level1Ids)) level1IdsNeeded.add(Number(id));
|
|
2635
|
+
for (const id of toArray(cfg.level2Ids)) level2IdsNeeded.add(Number(id));
|
|
2626
2636
|
}
|
|
2627
2637
|
const staffIdsFromRoleRules = /* @__PURE__ */ new Set();
|
|
2628
2638
|
const serviceDomain = args.eventConfig.serviceEvent.serviceDomain;
|
|
@@ -2630,8 +2640,8 @@ async function resolveAllRecipients(args) {
|
|
|
2630
2640
|
const mappings = await getUsersFromRoleAndLevel1Level2({
|
|
2631
2641
|
prisma: args.prisma,
|
|
2632
2642
|
roles: Array.from(roleIdsNeeded),
|
|
2633
|
-
level1Ids:
|
|
2634
|
-
level2Ids:
|
|
2643
|
+
level1Ids: Array.from(level1IdsNeeded),
|
|
2644
|
+
level2Ids: Array.from(level2IdsNeeded),
|
|
2635
2645
|
serviceDomain
|
|
2636
2646
|
});
|
|
2637
2647
|
for (const id of mappings) {
|