@7365admin1/core 2.33.0 → 2.34.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.js CHANGED
@@ -175,6 +175,7 @@ __export(src_exports, {
175
175
  remarksSchema: () => remarksSchema,
176
176
  robotSchema: () => robotSchema,
177
177
  schema: () => schema,
178
+ schemaApprovedBy: () => schemaApprovedBy,
178
179
  schemaBilling: () => schemaBilling,
179
180
  schemaBillingConfiguration: () => schemaBillingConfiguration,
180
181
  schemaBillingItem: () => schemaBillingItem,
@@ -5866,6 +5867,7 @@ function useRoleRepo() {
5866
5867
  }).catch((err) => {
5867
5868
  import_node_server_utils22.logger.error(`Failed to clear cache for namespace: dashboard`, err);
5868
5869
  });
5870
+ return "Successfully deleted role permission.";
5869
5871
  } catch (error) {
5870
5872
  throw new import_node_server_utils22.InternalServerError("Failed to delete role.");
5871
5873
  }
@@ -19418,16 +19420,30 @@ function useCustomerSiteRepo() {
19418
19420
  return cachedData;
19419
19421
  }
19420
19422
  try {
19423
+ const distinctPipeline = [
19424
+ { $match: query },
19425
+ { $sort: sort },
19426
+ { $group: { _id: { name: "$name", site: "$site" }, doc: { $first: "$$ROOT" } } },
19427
+ { $replaceRoot: { newRoot: "$doc" } },
19428
+ { $sort: sort }
19429
+ ];
19421
19430
  const items = await collection.aggregate(
19422
19431
  [
19423
- { $match: query },
19424
- { $sort: sort },
19432
+ ...distinctPipeline,
19425
19433
  { $skip: page * limit },
19426
19434
  { $limit: limit }
19427
19435
  ],
19428
19436
  { session }
19429
19437
  ).toArray();
19430
- const length = await collection.countDocuments(query, { session });
19438
+ const countResult = await collection.aggregate(
19439
+ [
19440
+ { $match: query },
19441
+ { $group: { _id: { name: "$name", site: "$site" } } },
19442
+ { $count: "total" }
19443
+ ],
19444
+ { session }
19445
+ ).toArray();
19446
+ const length = countResult[0]?.total ?? 0;
19431
19447
  const data = (0, import_node_server_utils89.paginate)(items, page, limit, length);
19432
19448
  setCache(cacheKey, data, 15 * 60).then(() => {
19433
19449
  import_node_server_utils89.logger.info(`Cache set for key: ${cacheKey}`);
@@ -21512,7 +21528,8 @@ var KeyRepo = class {
21512
21528
  location: 1,
21513
21529
  prefix: 1,
21514
21530
  keyNo: 1,
21515
- parentId: 1
21531
+ parentId: 1,
21532
+ status: 1
21516
21533
  }
21517
21534
  }
21518
21535
  ]).toArray();
@@ -21755,7 +21772,8 @@ function useVisitorTransactionService() {
21755
21772
  add: _add,
21756
21773
  updateById: _updateVisitorTansactionById,
21757
21774
  getExpiredCheckedOutTransactionsBySite: _getExpiredCheckedOutTransactionsBySite,
21758
- updateManyDahuaSyncStatus: _updateManyDahuaSyncStatus
21775
+ updateManyDahuaSyncStatus: _updateManyDahuaSyncStatus,
21776
+ getVisitorTransactionById: _getVisitorTransactionById
21759
21777
  } = useVisitorTransactionRepo();
21760
21778
  const { getById } = useBuildingUnitRepo();
21761
21779
  const {
@@ -21774,6 +21792,70 @@ function useVisitorTransactionService() {
21774
21792
  const { getAllSites: _getAllSites } = useSiteRepo();
21775
21793
  const { getByUserId: _getByUserId } = usePersonRepo();
21776
21794
  const { add: addVehicle } = useVehicleRepo();
21795
+ function extractKeyId(item) {
21796
+ if (!item)
21797
+ return null;
21798
+ if (typeof item === "string") {
21799
+ return import_mongodb58.ObjectId.isValid(item) ? item : null;
21800
+ }
21801
+ if (typeof item === "object" && item !== null) {
21802
+ if ("keyId" in item) {
21803
+ const keyId = String(item.keyId);
21804
+ return import_mongodb58.ObjectId.isValid(keyId) ? keyId : null;
21805
+ }
21806
+ const value = String(item);
21807
+ return import_mongodb58.ObjectId.isValid(value) ? value : null;
21808
+ }
21809
+ return null;
21810
+ }
21811
+ function normalizeKeyRefs(items) {
21812
+ if (!Array.isArray(items))
21813
+ return [];
21814
+ const seen = /* @__PURE__ */ new Set();
21815
+ const normalized = [];
21816
+ for (const item of items) {
21817
+ const keyId = extractKeyId(item);
21818
+ if (!keyId || seen.has(keyId))
21819
+ continue;
21820
+ seen.add(keyId);
21821
+ normalized.push({ keyId: new import_mongodb58.ObjectId(keyId) });
21822
+ }
21823
+ return normalized;
21824
+ }
21825
+ async function syncTransactionKeys({
21826
+ current,
21827
+ incoming,
21828
+ site,
21829
+ session
21830
+ }) {
21831
+ const currentIds = current.map((item) => item.keyId.toString());
21832
+ const incomingIds = incoming.map((item) => item.keyId.toString());
21833
+ const currentSet = new Set(currentIds);
21834
+ const incomingSet = new Set(incomingIds);
21835
+ const removedIds = currentIds.filter((id) => !incomingSet.has(id));
21836
+ const addedIds = incomingIds.filter((id) => !currentSet.has(id));
21837
+ for (const keyId of removedIds) {
21838
+ const existingKey = await KeyRepo.getById(keyId);
21839
+ if (!existingKey)
21840
+ continue;
21841
+ if (existingKey.status === "In Use" /* IN_USE */) {
21842
+ await KeyRepo.updateKeyById(
21843
+ keyId,
21844
+ { status: "Available" /* AVAILABLE */ },
21845
+ site,
21846
+ session
21847
+ );
21848
+ }
21849
+ }
21850
+ for (const keyId of addedIds) {
21851
+ await KeyRepo.updateKeyById(
21852
+ keyId,
21853
+ { status: "In Use" /* IN_USE */ },
21854
+ site,
21855
+ session
21856
+ );
21857
+ }
21858
+ }
21777
21859
  async function add(value) {
21778
21860
  const session = import_node_server_utils101.useAtlas.getClient()?.startSession();
21779
21861
  const allowedPersonTypes = [
@@ -22018,7 +22100,7 @@ function useVisitorTransactionService() {
22018
22100
  session?.endSession();
22019
22101
  }
22020
22102
  }
22021
- async function updateById(id, value) {
22103
+ async function updateVisitorTransactionById(id, value) {
22022
22104
  const session = import_node_server_utils101.useAtlas.getClient()?.startSession();
22023
22105
  session?.startTransaction();
22024
22106
  try {
@@ -22194,18 +22276,70 @@ function useVisitorTransactionService() {
22194
22276
  await session?.commitTransaction();
22195
22277
  return result;
22196
22278
  } catch (error) {
22197
- import_node_server_utils101.logger.error("Error in people service invite visitor:", error);
22279
+ import_node_server_utils101.logger.error("Error in visitor transaction invite visitor:", error);
22198
22280
  await session.abortTransaction();
22199
22281
  throw error;
22200
22282
  } finally {
22201
22283
  session?.endSession();
22202
22284
  }
22203
22285
  }
22286
+ async function changeVisitorTransactionKeysById(id, visitorPass, passKeys) {
22287
+ const session = import_node_server_utils101.useAtlas.getClient()?.startSession();
22288
+ if (!session) {
22289
+ throw new Error(
22290
+ "Unable to start session for visitor transaction service."
22291
+ );
22292
+ }
22293
+ try {
22294
+ session.startTransaction();
22295
+ const visitorTransaction = await _getVisitorTransactionById(id);
22296
+ if (!visitorTransaction) {
22297
+ throw new Error("Visitor transaction not found.");
22298
+ }
22299
+ const updatePayload = {};
22300
+ if (visitorPass !== void 0) {
22301
+ const currentVisitorPass = normalizeKeyRefs(
22302
+ visitorTransaction.visitorPass
22303
+ );
22304
+ const incomingVisitorPass = normalizeKeyRefs(visitorPass);
22305
+ await syncTransactionKeys({
22306
+ current: currentVisitorPass,
22307
+ incoming: incomingVisitorPass,
22308
+ site: visitorTransaction.site,
22309
+ session
22310
+ });
22311
+ updatePayload.visitorPass = incomingVisitorPass;
22312
+ }
22313
+ if (passKeys !== void 0) {
22314
+ const currentPassKeys = normalizeKeyRefs(visitorTransaction.passKeys);
22315
+ const incomingPassKeys = normalizeKeyRefs(passKeys);
22316
+ await syncTransactionKeys({
22317
+ current: currentPassKeys,
22318
+ incoming: incomingPassKeys,
22319
+ site: visitorTransaction.site,
22320
+ session
22321
+ });
22322
+ updatePayload.passKeys = incomingPassKeys;
22323
+ }
22324
+ if (Object.keys(updatePayload).length > 0) {
22325
+ await _updateVisitorTansactionById(id, updatePayload, session);
22326
+ }
22327
+ await session.commitTransaction();
22328
+ return "Successfully changed visitor transaction keys.";
22329
+ } catch (error) {
22330
+ await session.abortTransaction();
22331
+ import_node_server_utils101.logger.error("Error in visitor transaction change keys by id:", error);
22332
+ throw error;
22333
+ } finally {
22334
+ session.endSession();
22335
+ }
22336
+ }
22204
22337
  return {
22205
22338
  add,
22206
- updateById,
22339
+ updateVisitorTransactionById,
22207
22340
  processTransactionDahuaStatus,
22208
- inviteVisitor
22341
+ inviteVisitor,
22342
+ changeVisitorTransactionKeysById
22209
22343
  };
22210
22344
  }
22211
22345
 
@@ -22215,8 +22349,9 @@ var import_node_server_utils102 = require("@7365admin1/node-server-utils");
22215
22349
  function useVisitorTransactionController() {
22216
22350
  const {
22217
22351
  add: _add,
22218
- updateById: _updateVisitorTansactionById,
22219
- inviteVisitor: _inviteVisitor
22352
+ updateVisitorTransactionById: _updateVisitorTransactionById,
22353
+ inviteVisitor: _inviteVisitor,
22354
+ changeVisitorTransactionKeysById: _changeVisitorTransactionKeysById
22220
22355
  } = useVisitorTransactionService();
22221
22356
  const {
22222
22357
  getAll: _getAll,
@@ -22358,7 +22493,7 @@ function useVisitorTransactionController() {
22358
22493
  return;
22359
22494
  }
22360
22495
  try {
22361
- await _updateVisitorTansactionById(_id, req.body);
22496
+ await _updateVisitorTransactionById(_id, req.body);
22362
22497
  res.status(200).json({ message: "Successfully updated visitor transaction." });
22363
22498
  return;
22364
22499
  } catch (error2) {
@@ -22412,8 +22547,31 @@ function useVisitorTransactionController() {
22412
22547
  next(new import_node_server_utils102.BadRequestError(messages));
22413
22548
  return;
22414
22549
  }
22415
- const { expectedCheckIn, arrivalTime, duration, name, contact, email, plateNumber, isOvernightParking, numberOfPassengers, purpose, inviterUserId } = value;
22416
- const rest = { expectedCheckIn, arrivalTime, duration, name, contact, email, plateNumber, isOvernightParking, numberOfPassengers, purpose };
22550
+ const {
22551
+ expectedCheckIn,
22552
+ arrivalTime,
22553
+ duration,
22554
+ name,
22555
+ contact,
22556
+ email,
22557
+ plateNumber,
22558
+ isOvernightParking,
22559
+ numberOfPassengers,
22560
+ purpose,
22561
+ inviterUserId
22562
+ } = value;
22563
+ const rest = {
22564
+ expectedCheckIn,
22565
+ arrivalTime,
22566
+ duration,
22567
+ name,
22568
+ contact,
22569
+ email,
22570
+ plateNumber,
22571
+ isOvernightParking,
22572
+ numberOfPassengers,
22573
+ purpose
22574
+ };
22417
22575
  try {
22418
22576
  const result = await _inviteVisitor(rest, inviterUserId);
22419
22577
  res.status(200).json({ insertedId: result });
@@ -22424,13 +22582,61 @@ function useVisitorTransactionController() {
22424
22582
  return;
22425
22583
  }
22426
22584
  }
22585
+ async function changeVisitorTransactionKeysById(req, res, next) {
22586
+ const idValidation = import_joi55.default.string().hex().length(24).required();
22587
+ const bodyValidation = import_joi55.default.object({
22588
+ visitorPass: import_joi55.default.array().items(
22589
+ import_joi55.default.object({
22590
+ keyId: import_joi55.default.string().hex().length(24).required()
22591
+ })
22592
+ ).optional(),
22593
+ passKeys: import_joi55.default.array().items(
22594
+ import_joi55.default.object({
22595
+ keyId: import_joi55.default.string().hex().length(24).required()
22596
+ })
22597
+ ).optional()
22598
+ }).or("visitorPass", "passKeys");
22599
+ const _id = req.params.id;
22600
+ const { error: idError } = idValidation.validate(_id);
22601
+ if (idError) {
22602
+ import_node_server_utils102.logger.log({ level: "error", message: idError.message });
22603
+ next(new import_node_server_utils102.BadRequestError(idError.message));
22604
+ return;
22605
+ }
22606
+ const { error, value } = bodyValidation.validate(req.body, {
22607
+ abortEarly: false
22608
+ });
22609
+ if (error) {
22610
+ const message = error.details.map((d) => d.message).join(", ");
22611
+ import_node_server_utils102.logger.log({ level: "error", message });
22612
+ next(new import_node_server_utils102.BadRequestError(message));
22613
+ return;
22614
+ }
22615
+ try {
22616
+ const { visitorPass, passKeys } = value;
22617
+ const result = await _changeVisitorTransactionKeysById(
22618
+ _id,
22619
+ visitorPass,
22620
+ passKeys
22621
+ );
22622
+ res.status(200).json({
22623
+ message: result || "Successfully changed visitor transaction keys."
22624
+ });
22625
+ return;
22626
+ } catch (error2) {
22627
+ import_node_server_utils102.logger.log({ level: "error", message: error2.message });
22628
+ next(error2);
22629
+ return;
22630
+ }
22631
+ }
22427
22632
  return {
22428
22633
  add,
22429
22634
  getAll,
22430
22635
  updateVisitorTansactionById,
22431
22636
  deleteVisitorTransaction,
22432
22637
  inviteVisitor,
22433
- getVisitorTransactionById
22638
+ getVisitorTransactionById,
22639
+ changeVisitorTransactionKeysById
22434
22640
  };
22435
22641
  }
22436
22642
 
@@ -36444,6 +36650,10 @@ var schemaSOABillingItem = import_joi92.default.object({
36444
36650
  taxPercentage: import_joi92.default.number().optional().allow(null),
36445
36651
  taxAmount: import_joi92.default.number().optional().allow(null)
36446
36652
  });
36653
+ var schemaApprovedBy = import_joi92.default.object({
36654
+ _id: import_joi92.default.string().hex().optional().allow(null, ""),
36655
+ name: import_joi92.default.string().optional().allow(null, "")
36656
+ });
36447
36657
  var schemaStatementOfAccount = import_joi92.default.object({
36448
36658
  _id: import_joi92.default.string().hex().optional(),
36449
36659
  site: import_joi92.default.string().hex().required(),
@@ -36457,6 +36667,7 @@ var schemaStatementOfAccount = import_joi92.default.object({
36457
36667
  category: import_joi92.default.string().optional().allow(null, ""),
36458
36668
  status: import_joi92.default.string().valid("pending", "approved", "rejected", "deleted").optional().allow(null, ""),
36459
36669
  billing: import_joi92.default.array().items(schemaSOABillingItem).optional().allow(null, ""),
36670
+ approvedBy: schemaApprovedBy.optional().allow(null, ""),
36460
36671
  createdBy: import_joi92.default.string().hex().required(),
36461
36672
  createdByName: import_joi92.default.string().optional().allow(null, ""),
36462
36673
  createdAt: import_joi92.default.date().optional(),
@@ -36476,6 +36687,7 @@ var schemaUpdateStatementOfAccount = import_joi92.default.object({
36476
36687
  category: import_joi92.default.string().optional().allow(null, ""),
36477
36688
  status: import_joi92.default.string().valid("pending", "approved", "rejected", "deleted").optional().allow(null, ""),
36478
36689
  billing: import_joi92.default.array().items(schemaSOABillingItem).optional().allow(null, ""),
36690
+ approvedBy: schemaApprovedBy.optional().allow(null, ""),
36479
36691
  createdBy: import_joi92.default.string().optional().allow(null, ""),
36480
36692
  createdByName: import_joi92.default.string().optional().allow(null, "")
36481
36693
  });
@@ -36540,6 +36752,7 @@ function MStatementOfAccount(value) {
36540
36752
  status: value.status ?? "pending",
36541
36753
  createdBy: value.createdBy,
36542
36754
  createdByName: value.createdByName ?? "",
36755
+ approvedBy: value.approvedBy,
36543
36756
  createdAt: value.createdAt ?? /* @__PURE__ */ new Date(),
36544
36757
  updatedAt: value.updatedAt ?? "",
36545
36758
  deletedAt: value.deletedAt ?? ""
@@ -36869,6 +37082,35 @@ function useStatementOfAccountRepo() {
36869
37082
  });
36870
37083
  });
36871
37084
  }
37085
+ async function reviewSOA(_id, value, session) {
37086
+ value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
37087
+ try {
37088
+ _id = new import_mongodb97.ObjectId(_id);
37089
+ } catch (error) {
37090
+ throw new import_node_server_utils164.BadRequestError("Invalid ID format.");
37091
+ }
37092
+ try {
37093
+ const res = await collection.updateOne(
37094
+ { _id },
37095
+ { $set: value },
37096
+ { session }
37097
+ );
37098
+ if (res.modifiedCount === 0) {
37099
+ throw new import_node_server_utils164.InternalServerError(`Unable to ${value.status} soa.`);
37100
+ }
37101
+ delNamespace().then(() => {
37102
+ import_node_server_utils164.logger.info(`Cache cleared for namespace: ${namespace_collection}`);
37103
+ }).catch((err) => {
37104
+ import_node_server_utils164.logger.error(
37105
+ `Failed to clear cache for namespace: ${namespace_collection}`,
37106
+ err
37107
+ );
37108
+ });
37109
+ return res;
37110
+ } catch (error) {
37111
+ throw error;
37112
+ }
37113
+ }
36872
37114
  return {
36873
37115
  createTextIndex,
36874
37116
  add,
@@ -36877,7 +37119,8 @@ function useStatementOfAccountRepo() {
36877
37119
  updateById,
36878
37120
  deleteById,
36879
37121
  updateStatusById,
36880
- getResidentUserSoa
37122
+ getResidentUserSoa,
37123
+ reviewSOA
36881
37124
  };
36882
37125
  }
36883
37126
 
@@ -36886,9 +37129,10 @@ var import_node_server_utils166 = require("@7365admin1/node-server-utils");
36886
37129
 
36887
37130
  // src/services/site-soa.service.ts
36888
37131
  var import_node_server_utils165 = require("@7365admin1/node-server-utils");
37132
+ var import_mongodb98 = require("mongodb");
36889
37133
  var import_puppeteer = require("puppeteer");
36890
37134
  function useStatementOfAccountService() {
36891
- const { add: _add } = useStatementOfAccountRepo();
37135
+ const { add: _add, reviewSOA: _reviewSOA } = useStatementOfAccountRepo();
36892
37136
  const { getUnitBillingBySite } = useSiteUnitBillingRepo();
36893
37137
  const { getUserById } = useUserRepo();
36894
37138
  async function add(value, dateFrom, dateTo) {
@@ -37016,9 +37260,31 @@ function useStatementOfAccountService() {
37016
37260
  throw error;
37017
37261
  }
37018
37262
  }
37263
+ async function reviewSOA(id, value) {
37264
+ const session = import_node_server_utils165.useAtlas.getClient()?.startSession();
37265
+ session?.startTransaction();
37266
+ try {
37267
+ if (value?.approvedBy?._id) {
37268
+ const approvedBy = await getUserById(value?.approvedBy?._id);
37269
+ if (!approvedBy || !approvedBy.name)
37270
+ throw new import_node_server_utils165.BadRequestError("Created by not found.");
37271
+ value.approvedBy.name = approvedBy.name;
37272
+ value.approvedBy._id = new import_mongodb98.ObjectId(approvedBy._id);
37273
+ }
37274
+ await _reviewSOA(id, value, session);
37275
+ await session?.commitTransaction();
37276
+ return `Successfully ${value.status} soa.`;
37277
+ } catch (error) {
37278
+ await session?.abortTransaction();
37279
+ throw error;
37280
+ } finally {
37281
+ session?.endSession();
37282
+ }
37283
+ }
37019
37284
  return {
37020
37285
  add,
37021
- generatePDF
37286
+ generatePDF,
37287
+ reviewSOA
37022
37288
  };
37023
37289
  }
37024
37290
 
@@ -37033,7 +37299,11 @@ function useStatementOfAccountController() {
37033
37299
  updateStatusById: _updateStatusById,
37034
37300
  getResidentUserSoa: _getResidentUserSoa
37035
37301
  } = useStatementOfAccountRepo();
37036
- const { add: _add, generatePDF: _generatePDF } = useStatementOfAccountService();
37302
+ const {
37303
+ add: _add,
37304
+ generatePDF: _generatePDF,
37305
+ reviewSOA: _reviewSOA
37306
+ } = useStatementOfAccountService();
37037
37307
  async function add(req, res, next) {
37038
37308
  const cookies = req.headers.cookie?.split(";").map((cookie) => cookie.trim().split("=")).reduce(
37039
37309
  (acc, [key, value]) => ({ ...acc, [key]: value }),
@@ -37333,6 +37603,40 @@ function useStatementOfAccountController() {
37333
37603
  return;
37334
37604
  }
37335
37605
  }
37606
+ async function reviewSOA(req, res, next) {
37607
+ const cookies = req.headers.cookie?.split(";").map((cookie) => cookie.trim().split("=")).reduce(
37608
+ (acc, [key, value]) => ({ ...acc, [key]: value }),
37609
+ {}
37610
+ );
37611
+ req.body.approvedBy = {
37612
+ _id: "",
37613
+ name: ""
37614
+ };
37615
+ req.body.approvedBy._id = cookies?.["user"] ? cookies["user"].toString() : req.body.approvedBy._id;
37616
+ const _id = req.params.id;
37617
+ const payload = { _id, ...req.body };
37618
+ const schema2 = import_joi93.default.object({
37619
+ _id: import_joi93.default.string().hex().required(),
37620
+ status: import_joi93.default.string().valid("approved", "rejected").required(),
37621
+ approvedBy: schemaApprovedBy
37622
+ });
37623
+ const { error } = schema2.validate(payload);
37624
+ if (error) {
37625
+ const messages = error.details.map((d) => d.message).join(", ");
37626
+ import_node_server_utils166.logger.log({ level: "error", message: messages });
37627
+ next(new import_node_server_utils166.BadRequestError(messages));
37628
+ return;
37629
+ }
37630
+ try {
37631
+ const result = await _reviewSOA(_id, req.body);
37632
+ res.status(200).json({ message: result });
37633
+ return;
37634
+ } catch (error2) {
37635
+ import_node_server_utils166.logger.log({ level: "error", message: error2.message });
37636
+ next(error2);
37637
+ return;
37638
+ }
37639
+ }
37336
37640
  return {
37337
37641
  add,
37338
37642
  getAll,
@@ -37341,13 +37645,14 @@ function useStatementOfAccountController() {
37341
37645
  deleteById,
37342
37646
  generatePDF,
37343
37647
  updateStatusById,
37344
- getResidentUserSoa
37648
+ getResidentUserSoa,
37649
+ reviewSOA
37345
37650
  };
37346
37651
  }
37347
37652
 
37348
37653
  // src/models/site-entrypass-settings.model.ts
37349
37654
  var import_node_server_utils167 = require("@7365admin1/node-server-utils");
37350
- var import_mongodb98 = require("mongodb");
37655
+ var import_mongodb99 = require("mongodb");
37351
37656
  var import_joi94 = __toESM(require("joi"));
37352
37657
  var schemaEntryPassSettings = import_joi94.default.object({
37353
37658
  _id: import_joi94.default.string().hex().optional().allow("", null),
@@ -37395,21 +37700,21 @@ function MEntryPassSettings(value) {
37395
37700
  }
37396
37701
  if (value._id && typeof value._id === "string") {
37397
37702
  try {
37398
- value._id = new import_mongodb98.ObjectId(value._id);
37703
+ value._id = new import_mongodb99.ObjectId(value._id);
37399
37704
  } catch {
37400
37705
  throw new import_node_server_utils167.BadRequestError("Invalid _id format");
37401
37706
  }
37402
37707
  }
37403
37708
  if (value.site && typeof value.site === "string") {
37404
37709
  try {
37405
- value.site = new import_mongodb98.ObjectId(value.site);
37710
+ value.site = new import_mongodb99.ObjectId(value.site);
37406
37711
  } catch {
37407
37712
  throw new import_node_server_utils167.BadRequestError("Invalid site format");
37408
37713
  }
37409
37714
  }
37410
37715
  if (value.org && typeof value.org === "string") {
37411
37716
  try {
37412
- value.org = new import_mongodb98.ObjectId(value.org);
37717
+ value.org = new import_mongodb99.ObjectId(value.org);
37413
37718
  } catch {
37414
37719
  throw new import_node_server_utils167.BadRequestError("Invalid org format");
37415
37720
  }
@@ -37439,7 +37744,7 @@ function MEntryPassSettings(value) {
37439
37744
 
37440
37745
  // src/repositories/site-entrypass-settings.repo.ts
37441
37746
  var import_node_server_utils168 = require("@7365admin1/node-server-utils");
37442
- var import_mongodb99 = require("mongodb");
37747
+ var import_mongodb100 = require("mongodb");
37443
37748
  function useEntryPassSettingsRepo() {
37444
37749
  const db = import_node_server_utils168.useAtlas.getDb();
37445
37750
  if (!db) {
@@ -37549,7 +37854,7 @@ function useEntryPassSettingsRepo() {
37549
37854
  }
37550
37855
  async function getEntryPassSettingsById(_id) {
37551
37856
  try {
37552
- _id = new import_mongodb99.ObjectId(_id);
37857
+ _id = new import_mongodb100.ObjectId(_id);
37553
37858
  } catch (error) {
37554
37859
  throw new import_node_server_utils168.BadRequestError("Invalid entry pass settings ID format.");
37555
37860
  }
@@ -37616,7 +37921,7 @@ function useEntryPassSettingsRepo() {
37616
37921
  }
37617
37922
  async function updateEntryPassSettingsById(_id, value) {
37618
37923
  try {
37619
- _id = new import_mongodb99.ObjectId(_id);
37924
+ _id = new import_mongodb100.ObjectId(_id);
37620
37925
  } catch (error) {
37621
37926
  throw new import_node_server_utils168.BadRequestError("Invalid entry pass settings ID format.");
37622
37927
  }
@@ -37644,7 +37949,7 @@ function useEntryPassSettingsRepo() {
37644
37949
  }
37645
37950
  async function deleteEntryPassSettingsById(_id, session) {
37646
37951
  try {
37647
- _id = new import_mongodb99.ObjectId(_id);
37952
+ _id = new import_mongodb100.ObjectId(_id);
37648
37953
  } catch (error) {
37649
37954
  throw new import_node_server_utils168.BadRequestError("Invalid card ID format.");
37650
37955
  }
@@ -37677,7 +37982,7 @@ function useEntryPassSettingsRepo() {
37677
37982
  }
37678
37983
  async function getEntryPassSettingsBySiteId(site) {
37679
37984
  try {
37680
- site = new import_mongodb99.ObjectId(site);
37985
+ site = new import_mongodb100.ObjectId(site);
37681
37986
  } catch (error) {
37682
37987
  throw new import_node_server_utils168.BadRequestError("Invalid entry pass settings ID format.");
37683
37988
  }
@@ -37744,7 +38049,7 @@ function useEntryPassSettingsRepo() {
37744
38049
  }
37745
38050
  async function updateEntryPassSettingsBySiteId(site, value) {
37746
38051
  try {
37747
- site = new import_mongodb99.ObjectId(site);
38052
+ site = new import_mongodb100.ObjectId(site);
37748
38053
  } catch (error) {
37749
38054
  throw new import_node_server_utils168.BadRequestError("Invalid entry pass settings ID format.");
37750
38055
  }
@@ -38103,7 +38408,7 @@ function useDashboardController() {
38103
38408
  }
38104
38409
 
38105
38410
  // src/models/nfc-patrol-route.model.ts
38106
- var import_mongodb100 = require("mongodb");
38411
+ var import_mongodb101 = require("mongodb");
38107
38412
  var import_joi97 = __toESM(require("joi"));
38108
38413
  var import_node_server_utils172 = require("@7365admin1/node-server-utils");
38109
38414
  var schemaNfcPatrolRoute = import_joi97.default.object({
@@ -38139,23 +38444,23 @@ function MNfcPatrolRoute(value) {
38139
38444
  }
38140
38445
  if (value._id && typeof value._id === "string") {
38141
38446
  try {
38142
- value._id = new import_mongodb100.ObjectId(value._id);
38447
+ value._id = new import_mongodb101.ObjectId(value._id);
38143
38448
  } catch (error2) {
38144
38449
  throw new import_node_server_utils172.BadRequestError("Invalid _id format");
38145
38450
  }
38146
38451
  }
38147
38452
  try {
38148
- value.site = new import_mongodb100.ObjectId(value.site);
38453
+ value.site = new import_mongodb101.ObjectId(value.site);
38149
38454
  } catch (error2) {
38150
38455
  throw new import_node_server_utils172.BadRequestError("Invalid site format");
38151
38456
  }
38152
38457
  try {
38153
- value.createdBy = new import_mongodb100.ObjectId(value.createdBy);
38458
+ value.createdBy = new import_mongodb101.ObjectId(value.createdBy);
38154
38459
  } catch (error2) {
38155
38460
  throw new import_node_server_utils172.BadRequestError("Invalid createdBy format");
38156
38461
  }
38157
38462
  return {
38158
- _id: value._id ?? new import_mongodb100.ObjectId(),
38463
+ _id: value._id ?? new import_mongodb101.ObjectId(),
38159
38464
  site: value.site,
38160
38465
  name: value.name,
38161
38466
  checkPointNumber: value.checkPointNumber,
@@ -38171,7 +38476,7 @@ function MNfcPatrolRoute(value) {
38171
38476
 
38172
38477
  // src/repositories/nfc-patrol-route.repository.ts
38173
38478
  var import_node_server_utils173 = require("@7365admin1/node-server-utils");
38174
- var import_mongodb101 = require("mongodb");
38479
+ var import_mongodb102 = require("mongodb");
38175
38480
  function useNfcPatrolRouteRepo() {
38176
38481
  const db = import_node_server_utils173.useAtlas.getDb();
38177
38482
  if (!db) {
@@ -38215,7 +38520,7 @@ function useNfcPatrolRouteRepo() {
38215
38520
  }, session) {
38216
38521
  page = page > 0 ? page - 1 : 0;
38217
38522
  try {
38218
- site = new import_mongodb101.ObjectId(site);
38523
+ site = new import_mongodb102.ObjectId(site);
38219
38524
  } catch (error) {
38220
38525
  throw new import_node_server_utils173.BadRequestError("Invalid site ID format.");
38221
38526
  }
@@ -38286,7 +38591,7 @@ function useNfcPatrolRouteRepo() {
38286
38591
  }
38287
38592
  async function getById(_id, isStart) {
38288
38593
  try {
38289
- _id = new import_mongodb101.ObjectId(_id);
38594
+ _id = new import_mongodb102.ObjectId(_id);
38290
38595
  } catch (error) {
38291
38596
  throw new import_node_server_utils173.BadRequestError("Invalid ID.");
38292
38597
  }
@@ -38396,18 +38701,18 @@ function useNfcPatrolRouteRepo() {
38396
38701
  throw new import_node_server_utils173.BadRequestError(error.message);
38397
38702
  }
38398
38703
  try {
38399
- _id = new import_mongodb101.ObjectId(_id);
38704
+ _id = new import_mongodb102.ObjectId(_id);
38400
38705
  } catch (error2) {
38401
38706
  throw new import_node_server_utils173.BadRequestError("Invalid ID.");
38402
38707
  }
38403
38708
  try {
38404
- value.site = new import_mongodb101.ObjectId(value.site);
38709
+ value.site = new import_mongodb102.ObjectId(value.site);
38405
38710
  } catch (error2) {
38406
38711
  throw new import_node_server_utils173.BadRequestError("Invalid site format");
38407
38712
  }
38408
38713
  if (value.updatedBy) {
38409
38714
  try {
38410
- value.updatedBy = new import_mongodb101.ObjectId(value.updatedBy);
38715
+ value.updatedBy = new import_mongodb102.ObjectId(value.updatedBy);
38411
38716
  } catch (error2) {
38412
38717
  throw new import_node_server_utils173.BadRequestError("Invalid createdBy format");
38413
38718
  }
@@ -38632,7 +38937,7 @@ function useNfcPatrolRouteController() {
38632
38937
  }
38633
38938
 
38634
38939
  // src/models/incident-report.model.ts
38635
- var import_mongodb102 = require("mongodb");
38940
+ var import_mongodb103 = require("mongodb");
38636
38941
  var import_joi99 = __toESM(require("joi"));
38637
38942
  var residentSchema = import_joi99.default.object({
38638
38943
  _id: import_joi99.default.string().hex().optional().allow(null, ""),
@@ -38836,28 +39141,28 @@ var schemaUpdateIncidentReport = import_joi99.default.object({
38836
39141
  function MIncidentReport(value) {
38837
39142
  if (value._id && typeof value._id === "string") {
38838
39143
  try {
38839
- value._id = new import_mongodb102.ObjectId(value._id);
39144
+ value._id = new import_mongodb103.ObjectId(value._id);
38840
39145
  } catch {
38841
39146
  throw new Error("Invalid incident report ID.");
38842
39147
  }
38843
39148
  }
38844
39149
  if (value.organization && typeof value.organization === "string") {
38845
39150
  try {
38846
- value.organization = new import_mongodb102.ObjectId(value.organization);
39151
+ value.organization = new import_mongodb103.ObjectId(value.organization);
38847
39152
  } catch {
38848
39153
  throw new Error("Invalid organization ID.");
38849
39154
  }
38850
39155
  }
38851
39156
  if (value.site && typeof value.site === "string") {
38852
39157
  try {
38853
- value.site = new import_mongodb102.ObjectId(value.site);
39158
+ value.site = new import_mongodb103.ObjectId(value.site);
38854
39159
  } catch {
38855
39160
  throw new Error("Invalid site ID.");
38856
39161
  }
38857
39162
  }
38858
39163
  if (value.approvedBy && typeof value.approvedBy === "string") {
38859
39164
  try {
38860
- value.approvedBy = new import_mongodb102.ObjectId(value.approvedBy);
39165
+ value.approvedBy = new import_mongodb103.ObjectId(value.approvedBy);
38861
39166
  } catch {
38862
39167
  throw new Error("Invalid approvedBy ID.");
38863
39168
  }
@@ -38865,7 +39170,7 @@ function MIncidentReport(value) {
38865
39170
  const { incidentInformation } = value;
38866
39171
  if (incidentInformation?.siteInfo?.site && typeof incidentInformation.siteInfo.site === "string") {
38867
39172
  try {
38868
- incidentInformation.siteInfo.site = new import_mongodb102.ObjectId(
39173
+ incidentInformation.siteInfo.site = new import_mongodb103.ObjectId(
38869
39174
  incidentInformation.siteInfo.site
38870
39175
  );
38871
39176
  } catch {
@@ -38879,7 +39184,7 @@ function MIncidentReport(value) {
38879
39184
  incidentInformation.submissionForm.dateOfReport = incidentInformation.submissionForm.dateOfReport.toISOString();
38880
39185
  }
38881
39186
  return {
38882
- _id: value._id ?? new import_mongodb102.ObjectId(),
39187
+ _id: value._id ?? new import_mongodb103.ObjectId(),
38883
39188
  reportId: value.reportId,
38884
39189
  incidentInformation: value.incidentInformation,
38885
39190
  affectedEntities: value.affectedEntities,
@@ -38903,7 +39208,7 @@ var import_node_server_utils177 = require("@7365admin1/node-server-utils");
38903
39208
 
38904
39209
  // src/repositories/incident-report.repo.ts
38905
39210
  var import_node_server_utils176 = require("@7365admin1/node-server-utils");
38906
- var import_mongodb103 = require("mongodb");
39211
+ var import_mongodb104 = require("mongodb");
38907
39212
  var incidents_namespace_collection = "incident-reports";
38908
39213
  function useIncidentReportRepo() {
38909
39214
  const db = import_node_server_utils176.useAtlas.getDb();
@@ -38970,7 +39275,7 @@ function useIncidentReportRepo() {
38970
39275
  page = page > 0 ? page - 1 : 0;
38971
39276
  let dateExpr = {};
38972
39277
  try {
38973
- site = new import_mongodb103.ObjectId(site);
39278
+ site = new import_mongodb104.ObjectId(site);
38974
39279
  } catch (error) {
38975
39280
  throw new import_node_server_utils176.BadRequestError("Invalid site ID format.");
38976
39281
  }
@@ -39071,7 +39376,7 @@ function useIncidentReportRepo() {
39071
39376
  page = page > 0 ? page - 1 : 0;
39072
39377
  let dateExpr = {};
39073
39378
  try {
39074
- site = new import_mongodb103.ObjectId(site);
39379
+ site = new import_mongodb104.ObjectId(site);
39075
39380
  } catch (error) {
39076
39381
  throw new import_node_server_utils176.BadRequestError("Invalid site ID format.");
39077
39382
  }
@@ -39140,7 +39445,7 @@ function useIncidentReportRepo() {
39140
39445
  }
39141
39446
  async function getIncidentReportById(_id, session) {
39142
39447
  try {
39143
- _id = new import_mongodb103.ObjectId(_id);
39448
+ _id = new import_mongodb104.ObjectId(_id);
39144
39449
  } catch (error) {
39145
39450
  throw new import_node_server_utils176.BadRequestError("Invalid incident report ID format.");
39146
39451
  }
@@ -39171,27 +39476,27 @@ function useIncidentReportRepo() {
39171
39476
  async function updateIncidentReportById(_id, value, session) {
39172
39477
  value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
39173
39478
  try {
39174
- _id = new import_mongodb103.ObjectId(_id);
39479
+ _id = new import_mongodb104.ObjectId(_id);
39175
39480
  } catch (error) {
39176
39481
  throw new import_node_server_utils176.BadRequestError("Invalid ID format.");
39177
39482
  }
39178
39483
  if (value.organization && typeof value.organization === "string") {
39179
39484
  try {
39180
- value.organization = new import_mongodb103.ObjectId(value.organization);
39485
+ value.organization = new import_mongodb104.ObjectId(value.organization);
39181
39486
  } catch {
39182
39487
  throw new Error("Invalid organization ID.");
39183
39488
  }
39184
39489
  }
39185
39490
  if (value.site && typeof value.site === "string") {
39186
39491
  try {
39187
- value.site = new import_mongodb103.ObjectId(value.site);
39492
+ value.site = new import_mongodb104.ObjectId(value.site);
39188
39493
  } catch {
39189
39494
  throw new Error("Invalid site ID.");
39190
39495
  }
39191
39496
  }
39192
39497
  if (value.approvedBy && typeof value.approvedBy === "string") {
39193
39498
  try {
39194
- value.approvedBy = new import_mongodb103.ObjectId(value.approvedBy);
39499
+ value.approvedBy = new import_mongodb104.ObjectId(value.approvedBy);
39195
39500
  } catch {
39196
39501
  throw new Error("Invalid approvedBy ID.");
39197
39502
  }
@@ -39199,7 +39504,7 @@ function useIncidentReportRepo() {
39199
39504
  const { incidentInformation } = value;
39200
39505
  if (incidentInformation?.siteInfo?.site && typeof incidentInformation.siteInfo.site === "string") {
39201
39506
  try {
39202
- incidentInformation.siteInfo.site = new import_mongodb103.ObjectId(
39507
+ incidentInformation.siteInfo.site = new import_mongodb104.ObjectId(
39203
39508
  incidentInformation.siteInfo.site
39204
39509
  );
39205
39510
  } catch {
@@ -39234,7 +39539,7 @@ function useIncidentReportRepo() {
39234
39539
  }
39235
39540
  async function deleteIncidentReportById(_id) {
39236
39541
  try {
39237
- _id = new import_mongodb103.ObjectId(_id);
39542
+ _id = new import_mongodb104.ObjectId(_id);
39238
39543
  } catch (error) {
39239
39544
  throw new import_node_server_utils176.BadRequestError("Invalid occurrence subject ID format.");
39240
39545
  }
@@ -39266,7 +39571,7 @@ function useIncidentReportRepo() {
39266
39571
  async function reviewIncidentReport(_id, value, session) {
39267
39572
  value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
39268
39573
  try {
39269
- _id = new import_mongodb103.ObjectId(_id);
39574
+ _id = new import_mongodb104.ObjectId(_id);
39270
39575
  } catch (error) {
39271
39576
  throw new import_node_server_utils176.BadRequestError("Invalid ID format.");
39272
39577
  }
@@ -39758,7 +40063,7 @@ function useIncidentReportController() {
39758
40063
  }
39759
40064
 
39760
40065
  // src/models/nfc-patrol-settings.model.ts
39761
- var import_mongodb104 = require("mongodb");
40066
+ var import_mongodb105 = require("mongodb");
39762
40067
  var import_joi101 = __toESM(require("joi"));
39763
40068
  var import_node_server_utils179 = require("@7365admin1/node-server-utils");
39764
40069
  var objectId = import_joi101.default.string().hex().length(24);
@@ -39784,7 +40089,7 @@ function MNfcPatrolSettings(value) {
39784
40089
  }
39785
40090
  if (value.site) {
39786
40091
  try {
39787
- value.site = new import_mongodb104.ObjectId(value.site);
40092
+ value.site = new import_mongodb105.ObjectId(value.site);
39788
40093
  } catch (error2) {
39789
40094
  throw new import_node_server_utils179.BadRequestError("Invalid site ID format.");
39790
40095
  }
@@ -39804,7 +40109,7 @@ function MNfcPatrolSettingsUpdate(value) {
39804
40109
  }
39805
40110
  if (value.updatedBy) {
39806
40111
  try {
39807
- value.updatedBy = new import_mongodb104.ObjectId(value.updatedBy);
40112
+ value.updatedBy = new import_mongodb105.ObjectId(value.updatedBy);
39808
40113
  } catch (error2) {
39809
40114
  throw new import_node_server_utils179.BadRequestError("Invalid updatedBy ID format.");
39810
40115
  }
@@ -39818,7 +40123,7 @@ function MNfcPatrolSettingsUpdate(value) {
39818
40123
 
39819
40124
  // src/repositories/nfc-patrol-settings.repository.ts
39820
40125
  var import_node_server_utils180 = require("@7365admin1/node-server-utils");
39821
- var import_mongodb105 = require("mongodb");
40126
+ var import_mongodb106 = require("mongodb");
39822
40127
  function useNfcPatrolSettingsRepository() {
39823
40128
  const db = import_node_server_utils180.useAtlas.getDb();
39824
40129
  if (!db) {
@@ -39848,7 +40153,7 @@ function useNfcPatrolSettingsRepository() {
39848
40153
  }
39849
40154
  async function getNfcPatrolSettingsBySite(site, session) {
39850
40155
  try {
39851
- site = new import_mongodb105.ObjectId(site);
40156
+ site = new import_mongodb106.ObjectId(site);
39852
40157
  } catch (error) {
39853
40158
  throw new import_node_server_utils180.BadRequestError("Invalid nfc patrol settings site ID format.");
39854
40159
  }
@@ -39892,7 +40197,7 @@ function useNfcPatrolSettingsRepository() {
39892
40197
  }
39893
40198
  async function updateNfcPatrolSettings(site, value, session) {
39894
40199
  try {
39895
- site = new import_mongodb105.ObjectId(site);
40200
+ site = new import_mongodb106.ObjectId(site);
39896
40201
  } catch (error) {
39897
40202
  throw new import_node_server_utils180.BadRequestError("Invalid attendance settings ID format.");
39898
40203
  }
@@ -40057,13 +40362,13 @@ function useNfcPatrolSettingsController() {
40057
40362
 
40058
40363
  // src/services/occurrence-entry.service.ts
40059
40364
  var import_node_server_utils184 = require("@7365admin1/node-server-utils");
40060
- var import_mongodb108 = require("mongodb");
40365
+ var import_mongodb109 = require("mongodb");
40061
40366
 
40062
40367
  // src/repositories/occurrence-subject.repo.ts
40063
40368
  var import_node_server_utils183 = require("@7365admin1/node-server-utils");
40064
40369
 
40065
40370
  // src/models/occurrence-subject.model.ts
40066
- var import_mongodb106 = require("mongodb");
40371
+ var import_mongodb107 = require("mongodb");
40067
40372
  var import_joi103 = __toESM(require("joi"));
40068
40373
  var schemaOccurrenceSubject = import_joi103.default.object({
40069
40374
  site: import_joi103.default.string().hex().required(),
@@ -40077,27 +40382,27 @@ var schemaUpdateOccurrenceSubject = import_joi103.default.object({
40077
40382
  function MOccurrenceSubject(value) {
40078
40383
  if (value._id && typeof value._id === "string") {
40079
40384
  try {
40080
- value._id = new import_mongodb106.ObjectId(value._id);
40385
+ value._id = new import_mongodb107.ObjectId(value._id);
40081
40386
  } catch {
40082
40387
  throw new Error("Invalid ID.");
40083
40388
  }
40084
40389
  }
40085
40390
  if (value.site && typeof value.site === "string") {
40086
40391
  try {
40087
- value.site = new import_mongodb106.ObjectId(value.site);
40392
+ value.site = new import_mongodb107.ObjectId(value.site);
40088
40393
  } catch {
40089
40394
  throw new Error("Invalid site ID.");
40090
40395
  }
40091
40396
  }
40092
40397
  if (value.addedBy && typeof value.addedBy === "string") {
40093
40398
  try {
40094
- value.addedBy = new import_mongodb106.ObjectId(value.addedBy);
40399
+ value.addedBy = new import_mongodb107.ObjectId(value.addedBy);
40095
40400
  } catch {
40096
40401
  throw new Error("Invalid addedBy ID.");
40097
40402
  }
40098
40403
  }
40099
40404
  return {
40100
- _id: value._id ?? new import_mongodb106.ObjectId(),
40405
+ _id: value._id ?? new import_mongodb107.ObjectId(),
40101
40406
  site: value.site,
40102
40407
  subject: value.subject,
40103
40408
  addedBy: value.addedBy ?? "",
@@ -40108,7 +40413,7 @@ function MOccurrenceSubject(value) {
40108
40413
  }
40109
40414
 
40110
40415
  // src/repositories/occurrence-subject.repo.ts
40111
- var import_mongodb107 = require("mongodb");
40416
+ var import_mongodb108 = require("mongodb");
40112
40417
  function useOccurrenceSubjectRepo() {
40113
40418
  const db = import_node_server_utils183.useAtlas.getDb();
40114
40419
  if (!db) {
@@ -40167,7 +40472,7 @@ function useOccurrenceSubjectRepo() {
40167
40472
  }, session) {
40168
40473
  page = page > 0 ? page - 1 : 0;
40169
40474
  try {
40170
- site = new import_mongodb107.ObjectId(site);
40475
+ site = new import_mongodb108.ObjectId(site);
40171
40476
  } catch (error) {
40172
40477
  throw new import_node_server_utils183.BadRequestError("Invalid site ID format.");
40173
40478
  }
@@ -40262,7 +40567,7 @@ function useOccurrenceSubjectRepo() {
40262
40567
  }
40263
40568
  async function getOccurrenceSubjectById(_id, session) {
40264
40569
  try {
40265
- _id = new import_mongodb107.ObjectId(_id);
40570
+ _id = new import_mongodb108.ObjectId(_id);
40266
40571
  } catch (error) {
40267
40572
  throw new import_node_server_utils183.BadRequestError("Invalid occurrence subject ID format.");
40268
40573
  }
@@ -40279,7 +40584,7 @@ function useOccurrenceSubjectRepo() {
40279
40584
  async function updateOccurrenceSubjectById(_id, value, session) {
40280
40585
  value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
40281
40586
  try {
40282
- _id = new import_mongodb107.ObjectId(_id);
40587
+ _id = new import_mongodb108.ObjectId(_id);
40283
40588
  } catch (error) {
40284
40589
  throw new import_node_server_utils183.BadRequestError("Invalid ID format.");
40285
40590
  }
@@ -40309,7 +40614,7 @@ function useOccurrenceSubjectRepo() {
40309
40614
  }
40310
40615
  async function deleteOccurrenceSubjectById(_id) {
40311
40616
  try {
40312
- _id = new import_mongodb107.ObjectId(_id);
40617
+ _id = new import_mongodb108.ObjectId(_id);
40313
40618
  } catch (error) {
40314
40619
  throw new import_node_server_utils183.BadRequestError("Invalid occurrence subject ID format.");
40315
40620
  }
@@ -40421,8 +40726,8 @@ function useOccurrenceEntryService() {
40421
40726
  value.dailyOccurrenceBookId = occurrenceEntry.dailyOccurrenceBookId;
40422
40727
  value.bookEntryCount = value.bookEntryCount ? value.bookEntryCount : occurrenceEntry.bookEntryCount;
40423
40728
  value.occurrence = value.occurrence ? value.occurrence : occurrenceEntry.occurrence;
40424
- value.signature = value.signature ? new import_mongodb108.ObjectId(value.signature) : occurrenceEntry.signature._id;
40425
- value.eSignature = value.eSignature ? new import_mongodb108.ObjectId(value.eSignature) : occurrenceEntry.eSignature;
40729
+ value.signature = value.signature ? new import_mongodb109.ObjectId(value.signature) : occurrenceEntry.signature._id;
40730
+ value.eSignature = value.eSignature ? new import_mongodb109.ObjectId(value.eSignature) : occurrenceEntry.eSignature;
40426
40731
  value.createdAt = /* @__PURE__ */ new Date();
40427
40732
  value.date = value.date ? value.date : occurrenceEntry.date;
40428
40733
  value.userName = value.userName ? value.userName : occurrenceEntry.signature.name;
@@ -40622,7 +40927,7 @@ function useOccurrenceEntryController() {
40622
40927
 
40623
40928
  // src/models/online-form.model.ts
40624
40929
  var import_joi105 = __toESM(require("joi"));
40625
- var import_mongodb109 = require("mongodb");
40930
+ var import_mongodb110 = require("mongodb");
40626
40931
  var schemaOnlineForm = import_joi105.default.object({
40627
40932
  _id: import_joi105.default.string().hex().optional().allow("", null),
40628
40933
  name: import_joi105.default.string().required(),
@@ -40670,21 +40975,21 @@ function MOnlineForm(value) {
40670
40975
  }
40671
40976
  if (value._id && typeof value._id === "string") {
40672
40977
  try {
40673
- value._id = new import_mongodb109.ObjectId(value._id);
40978
+ value._id = new import_mongodb110.ObjectId(value._id);
40674
40979
  } catch (error2) {
40675
40980
  throw new Error("Invalid ID.");
40676
40981
  }
40677
40982
  }
40678
40983
  if (value.org && typeof value.org === "string") {
40679
40984
  try {
40680
- value.org = new import_mongodb109.ObjectId(value.org);
40985
+ value.org = new import_mongodb110.ObjectId(value.org);
40681
40986
  } catch (error2) {
40682
40987
  throw new Error("Invalid org ID.");
40683
40988
  }
40684
40989
  }
40685
40990
  if (value.site && typeof value.site === "string") {
40686
40991
  try {
40687
- value.site = new import_mongodb109.ObjectId(value.site);
40992
+ value.site = new import_mongodb110.ObjectId(value.site);
40688
40993
  } catch (error2) {
40689
40994
  throw new Error("Invalid site ID.");
40690
40995
  }
@@ -40707,7 +41012,7 @@ function MOnlineForm(value) {
40707
41012
 
40708
41013
  // src/repositories/online-form.repo.ts
40709
41014
  var import_node_server_utils186 = require("@7365admin1/node-server-utils");
40710
- var import_mongodb110 = require("mongodb");
41015
+ var import_mongodb111 = require("mongodb");
40711
41016
  function useOnlineFormRepo() {
40712
41017
  const db = import_node_server_utils186.useAtlas.getDb();
40713
41018
  if (!db) {
@@ -40759,7 +41064,7 @@ function useOnlineFormRepo() {
40759
41064
  }) {
40760
41065
  page = page > 0 ? page - 1 : 0;
40761
41066
  try {
40762
- site = new import_mongodb110.ObjectId(site);
41067
+ site = new import_mongodb111.ObjectId(site);
40763
41068
  } catch (error) {
40764
41069
  throw new import_node_server_utils186.BadRequestError("Invalid site ID format.");
40765
41070
  }
@@ -40819,7 +41124,7 @@ function useOnlineFormRepo() {
40819
41124
  }
40820
41125
  async function getOnlineFormById(_id) {
40821
41126
  try {
40822
- _id = new import_mongodb110.ObjectId(_id);
41127
+ _id = new import_mongodb111.ObjectId(_id);
40823
41128
  } catch (error) {
40824
41129
  throw new import_node_server_utils186.BadRequestError("Invalid online form ID format.");
40825
41130
  }
@@ -40862,7 +41167,7 @@ function useOnlineFormRepo() {
40862
41167
  }
40863
41168
  async function updateOnlineFormById(_id, value) {
40864
41169
  try {
40865
- _id = new import_mongodb110.ObjectId(_id);
41170
+ _id = new import_mongodb111.ObjectId(_id);
40866
41171
  } catch (error) {
40867
41172
  throw new import_node_server_utils186.BadRequestError("Invalid online form ID format.");
40868
41173
  }
@@ -40890,7 +41195,7 @@ function useOnlineFormRepo() {
40890
41195
  }
40891
41196
  async function deleteOnlineFormById(_id, session) {
40892
41197
  try {
40893
- _id = new import_mongodb110.ObjectId(_id);
41198
+ _id = new import_mongodb111.ObjectId(_id);
40894
41199
  } catch (error) {
40895
41200
  throw new import_node_server_utils186.BadRequestError("Invalid online form ID format.");
40896
41201
  }
@@ -40923,7 +41228,7 @@ function useOnlineFormRepo() {
40923
41228
  }
40924
41229
  async function getOnlineFormsBySiteId(site, { search = "", page = 1, limit = 10, status = "active" }) {
40925
41230
  try {
40926
- site = new import_mongodb110.ObjectId(site);
41231
+ site = new import_mongodb111.ObjectId(site);
40927
41232
  } catch (error) {
40928
41233
  throw new import_node_server_utils186.BadRequestError(
40929
41234
  "Invalid online form configuration site ID format."
@@ -41364,7 +41669,7 @@ function useOccurrenceSubjectController() {
41364
41669
  }
41365
41670
 
41366
41671
  // src/models/nfc-patrol-log.model.ts
41367
- var import_mongodb111 = require("mongodb");
41672
+ var import_mongodb112 = require("mongodb");
41368
41673
  var import_joi108 = __toESM(require("joi"));
41369
41674
  var import_node_server_utils190 = require("@7365admin1/node-server-utils");
41370
41675
  var schemaNfcPatrolLog = import_joi108.default.object({
@@ -41416,32 +41721,32 @@ function MNfcPatrolLog(valueArg) {
41416
41721
  }
41417
41722
  if (value._id && typeof value._id === "string") {
41418
41723
  try {
41419
- value._id = new import_mongodb111.ObjectId(value._id);
41724
+ value._id = new import_mongodb112.ObjectId(value._id);
41420
41725
  } catch (error2) {
41421
41726
  throw new import_node_server_utils190.BadRequestError("Invalid _id format");
41422
41727
  }
41423
41728
  }
41424
41729
  try {
41425
- value.site = new import_mongodb111.ObjectId(value.site);
41730
+ value.site = new import_mongodb112.ObjectId(value.site);
41426
41731
  } catch (error2) {
41427
41732
  throw new import_node_server_utils190.BadRequestError("Invalid site format");
41428
41733
  }
41429
41734
  if (value?.createdBy) {
41430
41735
  try {
41431
- value.createdBy = new import_mongodb111.ObjectId(value.createdBy);
41736
+ value.createdBy = new import_mongodb112.ObjectId(value.createdBy);
41432
41737
  } catch (error2) {
41433
41738
  throw new import_node_server_utils190.BadRequestError("Invalid createdBy format");
41434
41739
  }
41435
41740
  }
41436
41741
  if (value?.route?._id) {
41437
41742
  try {
41438
- value.route._id = new import_mongodb111.ObjectId(value.route._id);
41743
+ value.route._id = new import_mongodb112.ObjectId(value.route._id);
41439
41744
  } catch (error2) {
41440
41745
  throw new import_node_server_utils190.BadRequestError("Invalid route _id format");
41441
41746
  }
41442
41747
  }
41443
41748
  return {
41444
- _id: value._id ?? new import_mongodb111.ObjectId(),
41749
+ _id: value._id ?? new import_mongodb112.ObjectId(),
41445
41750
  site: value.site,
41446
41751
  route: value.route,
41447
41752
  date: value.date,
@@ -41455,7 +41760,7 @@ function MNfcPatrolLog(valueArg) {
41455
41760
 
41456
41761
  // src/repositories/nfc-patrol-log.repository.ts
41457
41762
  var import_node_server_utils191 = require("@7365admin1/node-server-utils");
41458
- var import_mongodb112 = require("mongodb");
41763
+ var import_mongodb113 = require("mongodb");
41459
41764
  function useNfcPatrolLogRepo() {
41460
41765
  const db = import_node_server_utils191.useAtlas.getDb();
41461
41766
  if (!db) {
@@ -41508,7 +41813,7 @@ function useNfcPatrolLogRepo() {
41508
41813
  const pageIndex = page > 0 ? page - 1 : 0;
41509
41814
  let siteId;
41510
41815
  try {
41511
- siteId = typeof site === "string" ? new import_mongodb112.ObjectId(site) : site;
41816
+ siteId = typeof site === "string" ? new import_mongodb113.ObjectId(site) : site;
41512
41817
  } catch {
41513
41818
  throw new import_node_server_utils191.BadRequestError("Invalid site ID format.");
41514
41819
  }
@@ -41519,7 +41824,7 @@ function useNfcPatrolLogRepo() {
41519
41824
  query.date = date;
41520
41825
  }
41521
41826
  if (route?._id) {
41522
- query["route._id"] = typeof route._id === "string" ? new import_mongodb112.ObjectId(route._id) : route._id;
41827
+ query["route._id"] = typeof route._id === "string" ? new import_mongodb113.ObjectId(route._id) : route._id;
41523
41828
  }
41524
41829
  if (route?.startTime) {
41525
41830
  query["route.startTime"] = route.startTime;
@@ -42378,7 +42683,7 @@ function useNewDashboardController() {
42378
42683
 
42379
42684
  // src/models/manpower-monitoring.model.ts
42380
42685
  var import_joi111 = __toESM(require("joi"));
42381
- var import_mongodb113 = require("mongodb");
42686
+ var import_mongodb114 = require("mongodb");
42382
42687
  var shiftSchema = import_joi111.default.object({
42383
42688
  name: import_joi111.default.string().required(),
42384
42689
  checkIn: import_joi111.default.string().optional().allow("", null),
@@ -42403,7 +42708,7 @@ var manpowerMonitoringSchema = import_joi111.default.object({
42403
42708
  });
42404
42709
  var MManpowerMonitoring = class {
42405
42710
  constructor(data) {
42406
- this._id = new import_mongodb113.ObjectId();
42711
+ this._id = new import_mongodb114.ObjectId();
42407
42712
  this.serviceProviderId = data.serviceProviderId || "";
42408
42713
  this.siteId = data.siteId || "";
42409
42714
  this.siteName = data.siteName;
@@ -42869,7 +43174,7 @@ var hrmlabs_attendance_util_default = {
42869
43174
  };
42870
43175
 
42871
43176
  // src/repositories/manpower-monitoring.repo.ts
42872
- var import_mongodb114 = require("mongodb");
43177
+ var import_mongodb115 = require("mongodb");
42873
43178
  var { hrmLabsAuthentication: hrmLabsAuthentication2, fetchSites: fetchSites2 } = hrmlabs_attendance_util_default;
42874
43179
  function useManpowerMonitoringRepo() {
42875
43180
  const db = import_node_server_utils196.useAtlas.getDb();
@@ -42883,11 +43188,11 @@ function useManpowerMonitoringRepo() {
42883
43188
  try {
42884
43189
  value = new MManpowerMonitoring(value);
42885
43190
  if (value.createdBy)
42886
- value.createdBy = new import_mongodb114.ObjectId(value.createdBy);
43191
+ value.createdBy = new import_mongodb115.ObjectId(value.createdBy);
42887
43192
  if (value.siteId)
42888
- value.siteId = new import_mongodb114.ObjectId(value.siteId);
43193
+ value.siteId = new import_mongodb115.ObjectId(value.siteId);
42889
43194
  if (value.serviceProviderId)
42890
- value.serviceProviderId = new import_mongodb114.ObjectId(value.serviceProviderId);
43195
+ value.serviceProviderId = new import_mongodb115.ObjectId(value.serviceProviderId);
42891
43196
  const result = await collection.insertOne(value, { session });
42892
43197
  return result;
42893
43198
  } catch (error) {
@@ -42928,8 +43233,8 @@ function useManpowerMonitoringRepo() {
42928
43233
  }
42929
43234
  async function getManpowerSettingsBySiteId(_id, serviceProviderId) {
42930
43235
  try {
42931
- _id = new import_mongodb114.ObjectId(_id);
42932
- serviceProviderId = new import_mongodb114.ObjectId(serviceProviderId);
43236
+ _id = new import_mongodb115.ObjectId(_id);
43237
+ serviceProviderId = new import_mongodb115.ObjectId(serviceProviderId);
42933
43238
  } catch (error) {
42934
43239
  throw new Error("Invalid Site ID format.");
42935
43240
  }
@@ -42945,7 +43250,7 @@ function useManpowerMonitoringRepo() {
42945
43250
  }
42946
43251
  async function updateManpowerMonitoringSettings(_id, value) {
42947
43252
  try {
42948
- _id = new import_mongodb114.ObjectId(_id);
43253
+ _id = new import_mongodb115.ObjectId(_id);
42949
43254
  } catch (error) {
42950
43255
  throw new import_node_server_utils196.BadRequestError("Invalid ID format.");
42951
43256
  }
@@ -42972,7 +43277,7 @@ function useManpowerMonitoringRepo() {
42972
43277
  for (let item of value) {
42973
43278
  item = new MManpowerMonitoring(item);
42974
43279
  const data = await collection.findOne({
42975
- siteId: new import_mongodb114.ObjectId(item.siteId)
43280
+ siteId: new import_mongodb115.ObjectId(item.siteId)
42976
43281
  });
42977
43282
  if (data) {
42978
43283
  let updateValue;
@@ -42997,11 +43302,11 @@ function useManpowerMonitoringRepo() {
42997
43302
  }
42998
43303
  } else {
42999
43304
  if (item.createdBy)
43000
- item.createdBy = new import_mongodb114.ObjectId(item.createdBy);
43305
+ item.createdBy = new import_mongodb115.ObjectId(item.createdBy);
43001
43306
  if (item.siteId)
43002
- item.siteId = new import_mongodb114.ObjectId(item.siteId);
43307
+ item.siteId = new import_mongodb115.ObjectId(item.siteId);
43003
43308
  if (item.serviceProviderId)
43004
- item.serviceProviderId = new import_mongodb114.ObjectId(item.serviceProviderId);
43309
+ item.serviceProviderId = new import_mongodb115.ObjectId(item.serviceProviderId);
43005
43310
  const result = await collection.insertOne(item);
43006
43311
  if (result.insertedId) {
43007
43312
  results.inserted++;
@@ -43025,7 +43330,7 @@ function useManpowerMonitoringRepo() {
43025
43330
  const siteUrl = process.env.HRMLABS_SITE_URL;
43026
43331
  try {
43027
43332
  const serviceProvider = await serviceProviderCollection.findOne({
43028
- _id: new import_mongodb114.ObjectId(serviceProviderId)
43333
+ _id: new import_mongodb115.ObjectId(serviceProviderId)
43029
43334
  });
43030
43335
  if (!serviceProvider) {
43031
43336
  throw new Error("Service Provider not found.");
@@ -43067,7 +43372,7 @@ var import_node_server_utils197 = require("@7365admin1/node-server-utils");
43067
43372
 
43068
43373
  // src/models/manpower-remarks.model.ts
43069
43374
  var import_joi112 = __toESM(require("joi"));
43070
- var import_mongodb115 = require("mongodb");
43375
+ var import_mongodb116 = require("mongodb");
43071
43376
  var remarksSchema = import_joi112.default.object({
43072
43377
  name: import_joi112.default.string().required(),
43073
43378
  remark: import_joi112.default.object({
@@ -43091,7 +43396,7 @@ var manpowerRemarksSchema = import_joi112.default.object({
43091
43396
  });
43092
43397
  var MManpowerRemarks = class {
43093
43398
  constructor(data) {
43094
- this._id = new import_mongodb115.ObjectId();
43399
+ this._id = new import_mongodb116.ObjectId();
43095
43400
  this.serviceProviderId = data.serviceProviderId || "";
43096
43401
  this.siteId = data.siteId || "";
43097
43402
  this.siteName = data.siteName || "";
@@ -43109,7 +43414,7 @@ var MManpowerRemarks = class {
43109
43414
  };
43110
43415
 
43111
43416
  // src/repositories/manpower-remarks.repo.ts
43112
- var import_mongodb116 = require("mongodb");
43417
+ var import_mongodb117 = require("mongodb");
43113
43418
  var import_moment_timezone2 = __toESM(require("moment-timezone"));
43114
43419
  function useManpowerRemarksRepo() {
43115
43420
  const db = import_node_server_utils197.useAtlas.getDb();
@@ -43122,9 +43427,9 @@ function useManpowerRemarksRepo() {
43122
43427
  try {
43123
43428
  value = new MManpowerRemarks(value);
43124
43429
  if (value.siteId)
43125
- value.siteId = new import_mongodb116.ObjectId(value.siteId);
43430
+ value.siteId = new import_mongodb117.ObjectId(value.siteId);
43126
43431
  if (value.serviceProviderId)
43127
- value.serviceProviderId = new import_mongodb116.ObjectId(value.serviceProviderId);
43432
+ value.serviceProviderId = new import_mongodb117.ObjectId(value.serviceProviderId);
43128
43433
  const result = await collection.insertOne(value, { session });
43129
43434
  return result;
43130
43435
  } catch (error) {
@@ -43144,7 +43449,7 @@ function useManpowerRemarksRepo() {
43144
43449
  limit = limit || 10;
43145
43450
  const searchQuery = {};
43146
43451
  const nowSGT = (0, import_moment_timezone2.default)().tz("Asia/Singapore");
43147
- searchQuery.serviceProviderId = new import_mongodb116.ObjectId(serviceProviderId);
43452
+ searchQuery.serviceProviderId = new import_mongodb117.ObjectId(serviceProviderId);
43148
43453
  if (search != "") {
43149
43454
  searchQuery.siteName = { $regex: search, $options: "i" };
43150
43455
  }
@@ -43176,8 +43481,8 @@ function useManpowerRemarksRepo() {
43176
43481
  }
43177
43482
  async function getManpowerRemarksBySiteId(_id, date, serviceProviderId) {
43178
43483
  try {
43179
- _id = new import_mongodb116.ObjectId(_id);
43180
- serviceProviderId = new import_mongodb116.ObjectId(serviceProviderId);
43484
+ _id = new import_mongodb117.ObjectId(_id);
43485
+ serviceProviderId = new import_mongodb117.ObjectId(serviceProviderId);
43181
43486
  } catch (error) {
43182
43487
  throw new Error("Invalid Site ID format.");
43183
43488
  }
@@ -43194,13 +43499,13 @@ function useManpowerRemarksRepo() {
43194
43499
  }
43195
43500
  async function updateManpowerRemarks(_id, value) {
43196
43501
  try {
43197
- _id = new import_mongodb116.ObjectId(_id);
43502
+ _id = new import_mongodb117.ObjectId(_id);
43198
43503
  } catch (error) {
43199
43504
  throw new import_node_server_utils197.BadRequestError("Invalid ID format.");
43200
43505
  }
43201
43506
  try {
43202
43507
  if (value.createdBy) {
43203
- value.createdBy = new import_mongodb116.ObjectId(value.createdBy);
43508
+ value.createdBy = new import_mongodb117.ObjectId(value.createdBy);
43204
43509
  }
43205
43510
  const updateValue = {
43206
43511
  ...value,
@@ -43217,7 +43522,7 @@ function useManpowerRemarksRepo() {
43217
43522
  }
43218
43523
  async function updateRemarksStatus(_id, value) {
43219
43524
  try {
43220
- _id = new import_mongodb116.ObjectId(_id);
43525
+ _id = new import_mongodb117.ObjectId(_id);
43221
43526
  } catch (error) {
43222
43527
  throw new import_node_server_utils197.BadRequestError("Invalid ID format.");
43223
43528
  }
@@ -43489,7 +43794,7 @@ function useManpowerMonitoringCtrl() {
43489
43794
 
43490
43795
  // src/models/manpower-designations.model.ts
43491
43796
  var import_joi114 = __toESM(require("joi"));
43492
- var import_mongodb117 = require("mongodb");
43797
+ var import_mongodb118 = require("mongodb");
43493
43798
  var designationsSchema = import_joi114.default.object({
43494
43799
  title: import_joi114.default.string().required(),
43495
43800
  shifts: import_joi114.default.object({
@@ -43508,7 +43813,7 @@ var manpowerDesignationsSchema = import_joi114.default.object({
43508
43813
  });
43509
43814
  var MManpowerDesignations = class {
43510
43815
  constructor(data) {
43511
- this._id = new import_mongodb117.ObjectId();
43816
+ this._id = new import_mongodb118.ObjectId();
43512
43817
  this.siteId = data.siteId || "";
43513
43818
  this.siteName = data.siteName || "";
43514
43819
  this.serviceProviderId = data.serviceProviderId || "";
@@ -43522,7 +43827,7 @@ var MManpowerDesignations = class {
43522
43827
 
43523
43828
  // src/repositories/manpower-designations.repo.ts
43524
43829
  var import_node_server_utils200 = require("@7365admin1/node-server-utils");
43525
- var import_mongodb118 = require("mongodb");
43830
+ var import_mongodb119 = require("mongodb");
43526
43831
  function useManpowerDesignationRepo() {
43527
43832
  const db = import_node_server_utils200.useAtlas.getDb();
43528
43833
  if (!db) {
@@ -43534,11 +43839,11 @@ function useManpowerDesignationRepo() {
43534
43839
  try {
43535
43840
  value = new MManpowerDesignations(value);
43536
43841
  if (value.createdBy)
43537
- value.createdBy = new import_mongodb118.ObjectId(value.createdBy);
43842
+ value.createdBy = new import_mongodb119.ObjectId(value.createdBy);
43538
43843
  if (value.siteId)
43539
- value.siteId = new import_mongodb118.ObjectId(value.siteId);
43844
+ value.siteId = new import_mongodb119.ObjectId(value.siteId);
43540
43845
  if (value.serviceProviderId)
43541
- value.serviceProviderId = new import_mongodb118.ObjectId(value.serviceProviderId);
43846
+ value.serviceProviderId = new import_mongodb119.ObjectId(value.serviceProviderId);
43542
43847
  const result = await collection.insertOne(value);
43543
43848
  return result;
43544
43849
  } catch (error) {
@@ -43547,8 +43852,8 @@ function useManpowerDesignationRepo() {
43547
43852
  }
43548
43853
  async function getManpowerDesignationsBySiteId(_id, serviceProviderId) {
43549
43854
  try {
43550
- _id = new import_mongodb118.ObjectId(_id);
43551
- serviceProviderId = new import_mongodb118.ObjectId(serviceProviderId);
43855
+ _id = new import_mongodb119.ObjectId(_id);
43856
+ serviceProviderId = new import_mongodb119.ObjectId(serviceProviderId);
43552
43857
  } catch (error) {
43553
43858
  throw new Error("Invalid Site ID format.");
43554
43859
  }
@@ -43564,7 +43869,7 @@ function useManpowerDesignationRepo() {
43564
43869
  }
43565
43870
  async function updateManpowerDesignations(_id, value) {
43566
43871
  try {
43567
- _id = new import_mongodb118.ObjectId(_id);
43872
+ _id = new import_mongodb119.ObjectId(_id);
43568
43873
  } catch (error) {
43569
43874
  throw new Error("Invalid ID format.");
43570
43875
  }
@@ -43667,7 +43972,7 @@ function useManpowerDesignationCtrl() {
43667
43972
 
43668
43973
  // src/models/overnight-parking.model.ts
43669
43974
  var import_joi116 = __toESM(require("joi"));
43670
- var import_mongodb119 = require("mongodb");
43975
+ var import_mongodb120 = require("mongodb");
43671
43976
  var dayScheduleSchema = import_joi116.default.object({
43672
43977
  isEnabled: import_joi116.default.boolean().required(),
43673
43978
  startTime: import_joi116.default.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().allow(null, "").messages({
@@ -43709,7 +44014,7 @@ function MOvernightParkingApprovalHours(value) {
43709
44014
  }
43710
44015
  if (value.site && typeof value.site === "string") {
43711
44016
  try {
43712
- value.site = new import_mongodb119.ObjectId(value.site);
44017
+ value.site = new import_mongodb120.ObjectId(value.site);
43713
44018
  } catch {
43714
44019
  throw new Error("Invalid site ID.");
43715
44020
  }
@@ -45314,7 +45619,7 @@ function useManpowerRemarkCtrl() {
45314
45619
 
45315
45620
  // src/models/manpower-sites.model.ts
45316
45621
  var import_joi122 = __toESM(require("joi"));
45317
- var import_mongodb120 = require("mongodb");
45622
+ var import_mongodb121 = require("mongodb");
45318
45623
  var manpowerSitesSchema = import_joi122.default.object({
45319
45624
  id: import_joi122.default.string().hex().required(),
45320
45625
  text: import_joi122.default.string().hex().optional().allow("", null),
@@ -45325,7 +45630,7 @@ var manpowerSitesSchema = import_joi122.default.object({
45325
45630
  });
45326
45631
  var MManpowerSites = class {
45327
45632
  constructor(data) {
45328
- this._id = new import_mongodb120.ObjectId();
45633
+ this._id = new import_mongodb121.ObjectId();
45329
45634
  this.id = data.id || "";
45330
45635
  this.text = data.text || "";
45331
45636
  this.contractID = data.contractID || "";
@@ -45535,7 +45840,7 @@ function useManpowerSitesCtrl() {
45535
45840
 
45536
45841
  // src/utils/cron.util.ts
45537
45842
  var import_node_server_utils214 = require("@7365admin1/node-server-utils");
45538
- var import_mongodb121 = require("mongodb");
45843
+ var import_mongodb122 = require("mongodb");
45539
45844
  var import_moment_timezone4 = __toESM(require("moment-timezone"));
45540
45845
  var createManpowerRemarksDaily = async () => {
45541
45846
  const db = import_node_server_utils214.useAtlas.getDb();
@@ -45695,7 +46000,7 @@ var updateRemarksisAcknowledged = async () => {
45695
46000
  for (const id of updatedIds) {
45696
46001
  const doc = await remarks.findOne({ _id: id });
45697
46002
  const setting = await settings.findOne(
45698
- { siteId: new import_mongodb121.ObjectId(doc?.siteId) },
46003
+ { siteId: new import_mongodb122.ObjectId(doc?.siteId) },
45699
46004
  { projection: { emails: 1 } }
45700
46005
  );
45701
46006
  const payload = {
@@ -45781,7 +46086,7 @@ var updateRemarksStatusEod = async () => {
45781
46086
  for (const doc of docs) {
45782
46087
  let shiftsToCheck = [];
45783
46088
  const endShiftTime = await settings.findOne(
45784
- { siteId: new import_mongodb121.ObjectId(doc.siteId) },
46089
+ { siteId: new import_mongodb122.ObjectId(doc.siteId) },
45785
46090
  { projection: { shifts: 1, shiftType: 1 } }
45786
46091
  );
45787
46092
  if (doc.createdAtSGT === nowSGT) {
@@ -45887,7 +46192,7 @@ var isWithinHour = (alertTime, timeNow) => {
45887
46192
 
45888
46193
  // src/events/manpower.event.ts
45889
46194
  var import_node_server_utils215 = require("@7365admin1/node-server-utils");
45890
- var import_mongodb122 = require("mongodb");
46195
+ var import_mongodb123 = require("mongodb");
45891
46196
  var import_moment_timezone5 = __toESM(require("moment-timezone"));
45892
46197
  async function manpowerEvents(io) {
45893
46198
  let intervalId = null;
@@ -45913,7 +46218,7 @@ async function manpowerEvents(io) {
45913
46218
  }).toArray();
45914
46219
  for (const doc of docs) {
45915
46220
  const siteSettings = await settings.findOne(
45916
- { siteId: new import_mongodb122.ObjectId(doc.siteId), enabled: true },
46221
+ { siteId: new import_mongodb123.ObjectId(doc.siteId), enabled: true },
45917
46222
  { projection: { shifts: 1, shiftType: 1 } }
45918
46223
  );
45919
46224
  const shiftType = siteSettings?.shiftType || "2-shifts";
@@ -46032,7 +46337,7 @@ function genericSignature(params, secretKey) {
46032
46337
  }
46033
46338
 
46034
46339
  // src/repositories/reddot-payment.repository.ts
46035
- var import_mongodb126 = require("mongodb");
46340
+ var import_mongodb127 = require("mongodb");
46036
46341
 
46037
46342
  // src/utils/date-format.util.ts
46038
46343
  var import_moment_timezone6 = __toESM(require("moment-timezone"));
@@ -46057,11 +46362,11 @@ function formatDateString(today, format, dateRange) {
46057
46362
  }
46058
46363
 
46059
46364
  // src/models/credit-card.model.ts
46060
- var import_mongodb123 = require("mongodb");
46365
+ var import_mongodb124 = require("mongodb");
46061
46366
  var MCardInfo = class {
46062
46367
  // this is coming from RDP transaction
46063
46368
  constructor({
46064
- _id = new import_mongodb123.ObjectId(),
46369
+ _id = new import_mongodb124.ObjectId(),
46065
46370
  userId,
46066
46371
  cardType,
46067
46372
  cardNumber,
@@ -46096,11 +46401,11 @@ var MCardInfo = class {
46096
46401
  };
46097
46402
 
46098
46403
  // src/models/cart.model.ts
46099
- var import_mongodb124 = require("mongodb");
46404
+ var import_mongodb125 = require("mongodb");
46100
46405
  var MUnitBillings = class {
46101
46406
  // transaction response messages
46102
46407
  constructor({
46103
- _id = new import_mongodb124.ObjectId(),
46408
+ _id = new import_mongodb125.ObjectId(),
46104
46409
  unit,
46105
46410
  unitId,
46106
46411
  unitBill,
@@ -46141,7 +46446,7 @@ var MUnitBillings = class {
46141
46446
  };
46142
46447
 
46143
46448
  // src/repositories/payment.repository.ts
46144
- var import_mongodb125 = require("mongodb");
46449
+ var import_mongodb126 = require("mongodb");
46145
46450
  var import_node_server_utils216 = require("@7365admin1/node-server-utils");
46146
46451
  var PaymentBillRepo = () => {
46147
46452
  const getDB2 = () => {
@@ -46175,7 +46480,7 @@ var PaymentBillRepo = () => {
46175
46480
  if (unitBillInfo?.status === "Inactive" /* inactive */) {
46176
46481
  throw new Error("This Bill is Inactive!");
46177
46482
  }
46178
- const billId = new import_mongodb125.ObjectId(unitBillInfo?.billId);
46483
+ const billId = new import_mongodb126.ObjectId(unitBillInfo?.billId);
46179
46484
  const billInfo = await billCollection().findOne({ _id: billId });
46180
46485
  if (!billInfo) {
46181
46486
  throw new Error("Bill info not found");
@@ -46214,13 +46519,13 @@ var PaymentBillRepo = () => {
46214
46519
  const saveCreditCardInfo = async (payload) => {
46215
46520
  try {
46216
46521
  if (payload.userId)
46217
- payload.userId = new import_mongodb125.ObjectId(payload.userId);
46522
+ payload.userId = new import_mongodb126.ObjectId(payload.userId);
46218
46523
  if (payload.site)
46219
- payload.site = new import_mongodb125.ObjectId(payload.site);
46524
+ payload.site = new import_mongodb126.ObjectId(payload.site);
46220
46525
  if (payload.organization)
46221
- payload.organization = new import_mongodb125.ObjectId(payload.organization);
46526
+ payload.organization = new import_mongodb126.ObjectId(payload.organization);
46222
46527
  if (payload.createdBy)
46223
- payload.createdBy = new import_mongodb125.ObjectId(payload.createdBy);
46528
+ payload.createdBy = new import_mongodb126.ObjectId(payload.createdBy);
46224
46529
  const createdAt = formatDateString(/* @__PURE__ */ new Date(), "mm-dd-yyyy");
46225
46530
  payload.createdAt = createdAt;
46226
46531
  const result = await creditCollection().insertOne(new MCardInfo(payload));
@@ -46232,19 +46537,19 @@ var PaymentBillRepo = () => {
46232
46537
  const checkOutUnitBills = async (payload) => {
46233
46538
  try {
46234
46539
  if (payload.unitId)
46235
- payload.unitId = new import_mongodb125.ObjectId(payload.unitId);
46540
+ payload.unitId = new import_mongodb126.ObjectId(payload.unitId);
46236
46541
  if (payload.site)
46237
- payload.site = new import_mongodb125.ObjectId(payload.site);
46542
+ payload.site = new import_mongodb126.ObjectId(payload.site);
46238
46543
  if (payload.organization)
46239
- payload.organization = new import_mongodb125.ObjectId(payload.organization);
46544
+ payload.organization = new import_mongodb126.ObjectId(payload.organization);
46240
46545
  payload.createdAt = await formatDateString(/* @__PURE__ */ new Date(), "mm-dd-yyyy");
46241
46546
  const addToCart = await cartCollection().insertOne(new MUnitBillings(payload));
46242
46547
  const unitId = payload.unitId;
46243
46548
  const dateFormatted = formatDateString(/* @__PURE__ */ new Date(), "for-ref");
46244
46549
  const unit = unitId?.toString().slice(-4);
46245
- const newId = new import_mongodb125.ObjectId(addToCart?.insertedId).toString().slice(-4);
46550
+ const newId = new import_mongodb126.ObjectId(addToCart?.insertedId).toString().slice(-4);
46246
46551
  const referenceNumber = `CRT${unit}${newId}${dateFormatted}`;
46247
- const result = await cartCollection().findOneAndUpdate({ _id: new import_mongodb125.ObjectId(addToCart.insertedId) }, { $set: { referenceNumber } }, { returnDocument: "after" });
46552
+ const result = await cartCollection().findOneAndUpdate({ _id: new import_mongodb126.ObjectId(addToCart.insertedId) }, { $set: { referenceNumber } }, { returnDocument: "after" });
46248
46553
  return result;
46249
46554
  } catch (error) {
46250
46555
  throw new Error(error.message || error || "Server Internal Error");
@@ -46275,7 +46580,7 @@ var PaymentBillRepo = () => {
46275
46580
  for (const ref of refNumber) {
46276
46581
  const unitBillInfo = await collection().findOne({ referenceNumber: ref });
46277
46582
  const billId = unitBillInfo?.billId;
46278
- const billInfo = await billCollection().findOne({ _id: new import_mongodb125.ObjectId(billId) });
46583
+ const billInfo = await billCollection().findOne({ _id: new import_mongodb126.ObjectId(billId) });
46279
46584
  const billAmount = billInfo?.price;
46280
46585
  payload.updatedAt = updatedAt;
46281
46586
  payload.amountPaid = billAmount;
@@ -46426,7 +46731,7 @@ var useRedDotPaymentRepo = () => {
46426
46731
  throw new Error("Failed to Add Merchant Details");
46427
46732
  }
46428
46733
  const merchantId = merchant?.insertedId;
46429
- const orgId = new import_mongodb126.ObjectId(_id);
46734
+ const orgId = new import_mongodb127.ObjectId(_id);
46430
46735
  const result = await orgCollection().findOneAndUpdate({ _id: orgId }, { $push: { merchant: merchantId } }, {
46431
46736
  returnDocument: "after"
46432
46737
  });
@@ -46455,7 +46760,7 @@ var useRedDotPaymentRepo = () => {
46455
46760
  const getMerchantDetailsById = async (_id) => {
46456
46761
  try {
46457
46762
  if (_id)
46458
- _id = new import_mongodb126.ObjectId(_id);
46763
+ _id = new import_mongodb127.ObjectId(_id);
46459
46764
  const result = await redDotMerchantCollection().aggregate([
46460
46765
  {
46461
46766
  $match: {
@@ -46710,7 +47015,7 @@ function useRedDotPaymentController() {
46710
47015
 
46711
47016
  // src/repositories/verification-v2.repo.ts
46712
47017
  var import_node_server_utils218 = require("@7365admin1/node-server-utils");
46713
- var import_mongodb127 = require("mongodb");
47018
+ var import_mongodb128 = require("mongodb");
46714
47019
  function useVerificationRepoV2() {
46715
47020
  const db = import_node_server_utils218.useAtlas.getDb();
46716
47021
  if (!db) {
@@ -46763,7 +47068,7 @@ function useVerificationRepoV2() {
46763
47068
  }
46764
47069
  async function updateVerificationStatusById(_id, status, session) {
46765
47070
  try {
46766
- _id = new import_mongodb127.ObjectId(_id);
47071
+ _id = new import_mongodb128.ObjectId(_id);
46767
47072
  } catch (error) {
46768
47073
  throw new import_node_server_utils218.BadRequestError("Invalid verification ID format.");
46769
47074
  }
@@ -46906,7 +47211,7 @@ function useVerificationRepoV2() {
46906
47211
  }
46907
47212
  async function updateStatusById(_id, status, session) {
46908
47213
  try {
46909
- _id = new import_mongodb127.ObjectId(_id);
47214
+ _id = new import_mongodb128.ObjectId(_id);
46910
47215
  } catch (error) {
46911
47216
  throw new import_node_server_utils218.BadRequestError("Invalid verification ID format.");
46912
47217
  }
@@ -47492,7 +47797,7 @@ var import_node_server_utils222 = require("@7365admin1/node-server-utils");
47492
47797
  var import_uuid2 = require("uuid");
47493
47798
 
47494
47799
  // src/repositories/user-v2.repo.ts
47495
- var import_mongodb128 = require("mongodb");
47800
+ var import_mongodb129 = require("mongodb");
47496
47801
  var import_node_server_utils221 = require("@7365admin1/node-server-utils");
47497
47802
  function useUserRepoV2() {
47498
47803
  const { updateFeedbackCreatedByName } = useFeedbackRepo();
@@ -47693,7 +47998,7 @@ function useUserRepoV2() {
47693
47998
  }
47694
47999
  if (organization) {
47695
48000
  try {
47696
- query.defaultOrg = new import_mongodb128.ObjectId(organization);
48001
+ query.defaultOrg = new import_mongodb129.ObjectId(organization);
47697
48002
  cacheOptions.organization = organization.toString();
47698
48003
  } catch (error) {
47699
48004
  throw new import_node_server_utils221.BadRequestError("Invalid organization ID format.");
@@ -47832,13 +48137,13 @@ function useUserRepoV2() {
47832
48137
  );
47833
48138
  }
47834
48139
  try {
47835
- _id = new import_mongodb128.ObjectId(_id);
48140
+ _id = new import_mongodb129.ObjectId(_id);
47836
48141
  } catch (error) {
47837
48142
  throw new import_node_server_utils221.BadRequestError("Invalid ID.");
47838
48143
  }
47839
48144
  if (field === "defaultOrg") {
47840
48145
  try {
47841
- value = new import_mongodb128.ObjectId(value);
48146
+ value = new import_mongodb129.ObjectId(value);
47842
48147
  } catch (error) {
47843
48148
  throw new import_node_server_utils221.BadRequestError("Invalid organization ID.");
47844
48149
  }
@@ -47879,7 +48184,7 @@ function useUserRepoV2() {
47879
48184
  year
47880
48185
  }, session) {
47881
48186
  try {
47882
- _id = new import_mongodb128.ObjectId(_id);
48187
+ _id = new import_mongodb129.ObjectId(_id);
47883
48188
  } catch (error) {
47884
48189
  throw new import_node_server_utils221.BadRequestError("Invalid user ID format.");
47885
48190
  }
@@ -47909,7 +48214,7 @@ function useUserRepoV2() {
47909
48214
  }
47910
48215
  async function updatePassword({ _id, password }, session) {
47911
48216
  try {
47912
- _id = new import_mongodb128.ObjectId(_id);
48217
+ _id = new import_mongodb129.ObjectId(_id);
47913
48218
  } catch (error) {
47914
48219
  throw new import_node_server_utils221.BadRequestError("Invalid user ID format.");
47915
48220
  }
@@ -48756,6 +49061,7 @@ function useUserControllerV2() {
48756
49061
  remarksSchema,
48757
49062
  robotSchema,
48758
49063
  schema,
49064
+ schemaApprovedBy,
48759
49065
  schemaBilling,
48760
49066
  schemaBillingConfiguration,
48761
49067
  schemaBillingItem,