@7365admin1/core 3.24.0 → 3.25.0

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
@@ -9947,6 +9947,7 @@ var MVerification = class {
9947
9947
  }
9948
9948
  }
9949
9949
  this.metadata = { ...value.metadata };
9950
+ this.roleName = value.roleName;
9950
9951
  this.status = value.status ?? "pending";
9951
9952
  this.createdAt = value.createdAt ?? /* @__PURE__ */ new Date();
9952
9953
  this.updatedAt = value.updatedAt ?? null;
@@ -10099,6 +10100,16 @@ function useVerificationRepo() {
10099
10100
  { $sort: sort },
10100
10101
  { $skip: page * limit },
10101
10102
  { $limit: limit },
10103
+ {
10104
+ $lookup: {
10105
+ from: "roles",
10106
+ localField: "metadata.role",
10107
+ foreignField: "_id",
10108
+ as: "roles",
10109
+ pipeline: [{ $project: { name: 1 } }]
10110
+ }
10111
+ },
10112
+ { $unwind: { path: "$roles", preserveNullAndEmptyArrays: true } },
10102
10113
  {
10103
10114
  $project: {
10104
10115
  _id: 1,
@@ -10106,6 +10117,7 @@ function useVerificationRepo() {
10106
10117
  email: 1,
10107
10118
  type: 1,
10108
10119
  metadata: 1,
10120
+ roleName: "$roles.name",
10109
10121
  status: 1
10110
10122
  }
10111
10123
  }
@@ -21899,7 +21911,7 @@ function useVisitorTransactionRepo() {
21899
21911
  session,
21900
21912
  sort: { checkIn: -1 },
21901
21913
  returnDocument: "after",
21902
- projection: { _id: 1, site: 1 }
21914
+ projection: { _id: 1, site: 1, type: 1 }
21903
21915
  }
21904
21916
  );
21905
21917
  return result;
@@ -23507,7 +23519,7 @@ function useDahuaService() {
23507
23519
  try {
23508
23520
  const result = await _checkOutBySiteAndPlate(site, plateNumber2);
23509
23521
  console.log("checkOutBySiteAndPlate result", result);
23510
- if (onDetected2 && result?._id && result?.site) {
23522
+ if (onDetected2 && result?.type != "resident" && result?.site) {
23511
23523
  onDetected2({ reload: true, site: result?.site?.toString(), siteName: camera?.siteName, cameraDirection: camera?.direction, direction });
23512
23524
  }
23513
23525
  return result;
@@ -23581,7 +23593,7 @@ function useDahuaService() {
23581
23593
  loggerDahua.info(`${camera?.siteName}-${camera?.direction}] Unregistered vehicle with plate ${plateNumber2} and transaction ID ${insert?._id}`);
23582
23594
  }
23583
23595
  }
23584
- if (insert?._id && insert?.site && onDetected2) {
23596
+ if (insert?.status == "unregistered" /* UNREGISTERED */ && insert?.site && onDetected2) {
23585
23597
  onDetected2({ _id: insert?._id, site: insert?.site?.toString(), plateNumber: insert?.plateNumber, cameraDirection: camera?.direction, direction });
23586
23598
  }
23587
23599
  return insert;
@@ -48919,22 +48931,52 @@ function useAccessManagementSvc() {
48919
48931
  }
48920
48932
  };
48921
48933
  const liftAccessLevelsSvc = async (params) => {
48934
+ const { getCache: getCache2, setCache: setCache2 } = useCache48(namespace);
48935
+ const cacheKey = makeCacheKey46(namespace, {
48936
+ user: params.user,
48937
+ resource: "lift-levels"
48938
+ });
48939
+ const cachedData = await getCache2(cacheKey);
48940
+ if (cachedData) {
48941
+ logger125.info(`Cache hit for key: ${cacheKey}`);
48942
+ return cachedData;
48943
+ }
48922
48944
  try {
48923
48945
  const command = readTemplate("lift-levels");
48924
48946
  const response = await sendCommand(command, params.acm_url);
48925
48947
  const res = await parseStringPromise3(response, { explicitArray: false });
48926
48948
  const format2 = await formatLiftAccessLevels(res);
48949
+ setCache2(cacheKey, format2, 60).then(() => {
48950
+ logger125.info(`Cache set for key: ${cacheKey}`);
48951
+ }).catch((err) => {
48952
+ logger125.error(`Failed to set cache for key: ${cacheKey}`, err);
48953
+ });
48927
48954
  return format2;
48928
48955
  } catch (error) {
48929
48956
  throw new Error(error.message);
48930
48957
  }
48931
48958
  };
48932
48959
  const accessGroupsSvc = async (params) => {
48960
+ const { getCache: getCache2, setCache: setCache2 } = useCache48(namespace);
48961
+ const cacheKey = makeCacheKey46(namespace, {
48962
+ user: params.user,
48963
+ resource: "access-groups"
48964
+ });
48965
+ const cachedData = await getCache2(cacheKey);
48966
+ if (cachedData) {
48967
+ logger125.info(`Cache hit for key: ${cacheKey}`);
48968
+ return cachedData;
48969
+ }
48933
48970
  try {
48934
48971
  const command = readTemplate("access-group");
48935
48972
  const response = await sendCommand(command, params.acm_url);
48936
48973
  const res = await parseStringPromise3(response, { explicitArray: false });
48937
48974
  const format2 = await formatAccessGroup(res);
48975
+ setCache2(cacheKey, format2, 60).then(() => {
48976
+ logger125.info(`Cache set for key: ${cacheKey}`);
48977
+ }).catch((err) => {
48978
+ logger125.error(`Failed to set cache for key: ${cacheKey}`, err);
48979
+ });
48938
48980
  return format2;
48939
48981
  } catch (err) {
48940
48982
  throw new Error(err.message);
@@ -52774,6 +52816,7 @@ function useStatementOfAccountService() {
52774
52816
  unit_billings = unit_billings.map((unit) => {
52775
52817
  try {
52776
52818
  unit._id = unit._id.toString();
52819
+ unit.paidBy = unit.paidBy.toString();
52777
52820
  } catch {
52778
52821
  throw new BadRequestError156("Invalid unit id format/type");
52779
52822
  }
@@ -68433,6 +68476,7 @@ function useBidPrelovedService() {
68433
68476
  const { add: _addBid } = useBidPrelovedRepo();
68434
68477
  const { add: _addChannel, getByParticipants: _getByParticipants } = useChannelPrelovedRepo();
68435
68478
  const { add: _addChat } = useChatPrelovedRepo();
68479
+ const { updateStatus } = usePostPrelovedRepo();
68436
68480
  async function createBid(value) {
68437
68481
  const client = useAtlas129.getClient();
68438
68482
  if (!client)
@@ -68478,6 +68522,9 @@ function useBidPrelovedService() {
68478
68522
  },
68479
68523
  session
68480
68524
  );
68525
+ if (value.type === "reserve") {
68526
+ await updateStatus(postId, "reserved" /* RESERVED */, session);
68527
+ }
68481
68528
  await session.commitTransaction();
68482
68529
  return { bidId };
68483
68530
  } catch (error) {