@7365admin1/core 3.64.0 → 3.64.2

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.mjs CHANGED
@@ -13478,7 +13478,6 @@ function useCustomerSiteRepo() {
13478
13478
  cacheOptions.siteScope = scoped.length ? [...scoped].sort().join(",") : "no-site";
13479
13479
  }
13480
13480
  if (search) {
13481
- query2.$or = [{ name: { $regex: search, $options: "i" } }];
13482
13481
  cacheOptions.search = search;
13483
13482
  }
13484
13483
  const cacheKey = makeCacheKey10(namespace_collection2, cacheOptions);
@@ -13491,8 +13490,20 @@ function useCustomerSiteRepo() {
13491
13490
  const distinctPipeline = [
13492
13491
  { $match: query2 },
13493
13492
  { $sort: sort },
13494
- { $group: { _id: { name: "$name", site: "$site" }, doc: { $first: "$$ROOT" } } },
13493
+ { $group: { _id: "$site", doc: { $first: "$$ROOT" } } },
13495
13494
  { $replaceRoot: { newRoot: "$doc" } },
13495
+ {
13496
+ $lookup: {
13497
+ from: "sites",
13498
+ localField: "site",
13499
+ foreignField: "_id",
13500
+ as: "_liveSite"
13501
+ }
13502
+ },
13503
+ { $unwind: { path: "$_liveSite", preserveNullAndEmptyArrays: true } },
13504
+ { $set: { name: { $ifNull: ["$_liveSite.name", "$name"] } } },
13505
+ { $unset: "_liveSite" },
13506
+ ...search ? [{ $match: { name: { $regex: search, $options: "i" } } }] : [],
13496
13507
  { $sort: sort }
13497
13508
  ];
13498
13509
  const items = await collection.aggregate(
@@ -13503,14 +13514,7 @@ function useCustomerSiteRepo() {
13503
13514
  ],
13504
13515
  { session }
13505
13516
  ).toArray();
13506
- const countResult = await collection.aggregate(
13507
- [
13508
- { $match: query2 },
13509
- { $group: { _id: { name: "$name", site: "$site" } } },
13510
- { $count: "total" }
13511
- ],
13512
- { session }
13513
- ).toArray();
13517
+ const countResult = await collection.aggregate([...distinctPipeline, { $count: "total" }], { session }).toArray();
13514
13518
  const length = countResult[0]?.total ?? 0;
13515
13519
  const data = paginate10(items, page, limit, length);
13516
13520
  setCache(cacheKey, data, 15 * 60).then(() => {
@@ -88531,6 +88535,10 @@ function useRoleControllerV2() {
88531
88535
  if (value.org) {
88532
88536
  await requireOrgReach(req, value.org);
88533
88537
  }
88538
+ requireNoPlatformGrant(
88539
+ { type: value.type, org: value.org, permissions: [] },
88540
+ value.permissions
88541
+ );
88534
88542
  requireWithinModules(
88535
88543
  await moduleCeiling(value.org, value.site),
88536
88544
  value.permissions