@7365admin1/core 3.64.3-staging.289 → 3.64.3-staging.290

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
@@ -7576,7 +7576,6 @@ declare function UseAccessManagementRepo(): {
7576
7576
  userType: string;
7577
7577
  type: string;
7578
7578
  search: string;
7579
- userId?: string | null;
7580
7579
  }) => Promise<bson.Document>;
7581
7580
  acknowlegdeCardRepo: (params: {
7582
7581
  userId: string[];
package/dist/index.js CHANGED
@@ -56283,7 +56283,6 @@ function UseAccessManagementRepo() {
56283
56283
  const type = params.type;
56284
56284
  const search = params.search;
56285
56285
  const typeFilter = type.toLowerCase() === "all" ? [] : [{ $eq: ["$type", type] }];
56286
- const userIdFilter = params.userId ? [{ $eq: ["$userId", new import_mongodb90.ObjectId(params.userId)] }] : [];
56287
56286
  const searchFilter = search ? [
56288
56287
  {
56289
56288
  $or: [
@@ -56358,7 +56357,9 @@ function UseAccessManagementRepo() {
56358
56357
  { $eq: ["$isActivated", true] },
56359
56358
  { $eq: ["$userType", userType] },
56360
56359
  ...typeFilter,
56361
- ...userIdFilter
56360
+ // Cards actually held by a user only - a card sitting
56361
+ // unassigned on the unit (`userId: null`) is left out.
56362
+ { $ne: ["$userId", null] }
56362
56363
  ]
56363
56364
  },
56364
56365
  ...searchFilter[0]
@@ -71417,24 +71418,21 @@ function useAccessManagementController() {
71417
71418
  unitId,
71418
71419
  userType,
71419
71420
  type,
71420
- search = "",
71421
- userId = ""
71421
+ search = ""
71422
71422
  } = req.query;
71423
71423
  const schema2 = import_joi101.default.object({
71424
71424
  site: import_joi101.default.string().hex().required(),
71425
71425
  unitId: import_joi101.default.string().hex().required(),
71426
71426
  userType: import_joi101.default.string().required(),
71427
71427
  type: import_joi101.default.string().valid("all", ...Object.values(EAccessCardTypes)).required(),
71428
- search: import_joi101.default.string().optional().allow("", null),
71429
- userId: import_joi101.default.string().hex().optional().allow("", null)
71428
+ search: import_joi101.default.string().optional().allow("", null)
71430
71429
  });
71431
71430
  const { error } = schema2.validate({
71432
71431
  site,
71433
71432
  unitId,
71434
71433
  userType,
71435
71434
  type,
71436
- search,
71437
- userId
71435
+ search
71438
71436
  });
71439
71437
  if (error) {
71440
71438
  return res.status(400).json({ message: error.message });
@@ -71446,8 +71444,7 @@ function useAccessManagementController() {
71446
71444
  unitId,
71447
71445
  userType,
71448
71446
  type,
71449
- search,
71450
- userId
71447
+ search
71451
71448
  });
71452
71449
  return res.status(200).json({ message: "Success", data: result });
71453
71450
  } catch (error) {