@7365admin1/core 3.64.3-staging.283 → 3.64.3-staging.284

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.d.ts CHANGED
@@ -7577,6 +7577,7 @@ declare function UseAccessManagementRepo(): {
7577
7577
  userType: string;
7578
7578
  type: string;
7579
7579
  search: string;
7580
+ userId?: string | null;
7580
7581
  }) => Promise<bson.Document>;
7581
7582
  acknowlegdeCardRepo: (params: {
7582
7583
  userId: string[];
package/dist/index.js CHANGED
@@ -36675,9 +36675,10 @@ function useBuildingUnitRepo() {
36675
36675
  building_units_namespace_collection,
36676
36676
  cacheOptions
36677
36677
  );
36678
- const buildingCollection = await db2?.collection("buildings").findOne({ _id: (0, import_node_server_utils102.toObjectId)(block) });
36678
+ const blockObjectId = (0, import_node_server_utils102.toObjectId)(block);
36679
+ const buildingCollection = await db2?.collection("buildings").findOne({ _id: blockObjectId });
36679
36680
  const blockNumber = buildingCollection?.block;
36680
- query2.block = blockNumber !== void 0 ? blockNumber : block;
36681
+ query2.block = blockNumber !== void 0 ? { $in: [blockNumber, blockObjectId] } : blockObjectId;
36681
36682
  try {
36682
36683
  const data = await collection.aggregate([{ $match: query2 }, { $project: { name: 1 } }]).toArray();
36683
36684
  setCache(cacheKey, data, 15 * 60).then(() => {
@@ -55965,6 +55966,7 @@ function UseAccessManagementRepo() {
55965
55966
  const type = params.type;
55966
55967
  const search = params.search;
55967
55968
  const typeFilter = type.toLowerCase() === "all" ? [] : [{ $eq: ["$type", type] }];
55969
+ const userIdFilter = params.userId ? [{ $eq: ["$userId", new import_mongodb90.ObjectId(params.userId)] }] : [];
55968
55970
  const searchFilter = search ? [
55969
55971
  {
55970
55972
  $or: [
@@ -56038,7 +56040,8 @@ function UseAccessManagementRepo() {
56038
56040
  { $eq: ["$site", site] },
56039
56041
  { $eq: ["$isActivated", true] },
56040
56042
  { $eq: ["$userType", userType] },
56041
- ...typeFilter
56043
+ ...typeFilter,
56044
+ ...userIdFilter
56042
56045
  ]
56043
56046
  },
56044
56047
  ...searchFilter[0]
@@ -71097,21 +71100,24 @@ function useAccessManagementController() {
71097
71100
  unitId,
71098
71101
  userType,
71099
71102
  type,
71100
- search = ""
71103
+ search = "",
71104
+ userId = ""
71101
71105
  } = req.query;
71102
71106
  const schema2 = import_joi101.default.object({
71103
71107
  site: import_joi101.default.string().hex().required(),
71104
71108
  unitId: import_joi101.default.string().hex().required(),
71105
71109
  userType: import_joi101.default.string().required(),
71106
71110
  type: import_joi101.default.string().valid("all", ...Object.values(EAccessCardTypes)).required(),
71107
- search: import_joi101.default.string().optional().allow("", null)
71111
+ search: import_joi101.default.string().optional().allow("", null),
71112
+ userId: import_joi101.default.string().hex().optional().allow("", null)
71108
71113
  });
71109
71114
  const { error } = schema2.validate({
71110
71115
  site,
71111
71116
  unitId,
71112
71117
  userType,
71113
71118
  type,
71114
- search
71119
+ search,
71120
+ userId
71115
71121
  });
71116
71122
  if (error) {
71117
71123
  return res.status(400).json({ message: error.message });
@@ -71123,7 +71129,8 @@ function useAccessManagementController() {
71123
71129
  unitId,
71124
71130
  userType,
71125
71131
  type,
71126
- search
71132
+ search,
71133
+ userId
71127
71134
  });
71128
71135
  return res.status(200).json({ message: "Success", data: result });
71129
71136
  } catch (error) {