@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.mjs CHANGED
@@ -5547,6 +5547,7 @@ function useRoleRepo() {
5547
5547
  }).catch((err) => {
5548
5548
  logger14.error(`Failed to clear cache for namespace: dashboard`, err);
5549
5549
  });
5550
+ return "Successfully deleted role permission.";
5550
5551
  } catch (error) {
5551
5552
  throw new InternalServerError12("Failed to delete role.");
5552
5553
  }
@@ -19284,16 +19285,30 @@ function useCustomerSiteRepo() {
19284
19285
  return cachedData;
19285
19286
  }
19286
19287
  try {
19288
+ const distinctPipeline = [
19289
+ { $match: query },
19290
+ { $sort: sort },
19291
+ { $group: { _id: { name: "$name", site: "$site" }, doc: { $first: "$$ROOT" } } },
19292
+ { $replaceRoot: { newRoot: "$doc" } },
19293
+ { $sort: sort }
19294
+ ];
19287
19295
  const items = await collection.aggregate(
19288
19296
  [
19289
- { $match: query },
19290
- { $sort: sort },
19297
+ ...distinctPipeline,
19291
19298
  { $skip: page * limit },
19292
19299
  { $limit: limit }
19293
19300
  ],
19294
19301
  { session }
19295
19302
  ).toArray();
19296
- const length = await collection.countDocuments(query, { session });
19303
+ const countResult = await collection.aggregate(
19304
+ [
19305
+ { $match: query },
19306
+ { $group: { _id: { name: "$name", site: "$site" } } },
19307
+ { $count: "total" }
19308
+ ],
19309
+ { session }
19310
+ ).toArray();
19311
+ const length = countResult[0]?.total ?? 0;
19297
19312
  const data = paginate22(items, page, limit, length);
19298
19313
  setCache(cacheKey, data, 15 * 60).then(() => {
19299
19314
  logger67.info(`Cache set for key: ${cacheKey}`);
@@ -21410,7 +21425,8 @@ var KeyRepo = class {
21410
21425
  location: 1,
21411
21426
  prefix: 1,
21412
21427
  keyNo: 1,
21413
- parentId: 1
21428
+ parentId: 1,
21429
+ status: 1
21414
21430
  }
21415
21431
  }
21416
21432
  ]).toArray();
@@ -21653,7 +21669,8 @@ function useVisitorTransactionService() {
21653
21669
  add: _add,
21654
21670
  updateById: _updateVisitorTansactionById,
21655
21671
  getExpiredCheckedOutTransactionsBySite: _getExpiredCheckedOutTransactionsBySite,
21656
- updateManyDahuaSyncStatus: _updateManyDahuaSyncStatus
21672
+ updateManyDahuaSyncStatus: _updateManyDahuaSyncStatus,
21673
+ getVisitorTransactionById: _getVisitorTransactionById
21657
21674
  } = useVisitorTransactionRepo();
21658
21675
  const { getById } = useBuildingUnitRepo();
21659
21676
  const {
@@ -21672,6 +21689,70 @@ function useVisitorTransactionService() {
21672
21689
  const { getAllSites: _getAllSites } = useSiteRepo();
21673
21690
  const { getByUserId: _getByUserId } = usePersonRepo();
21674
21691
  const { add: addVehicle } = useVehicleRepo();
21692
+ function extractKeyId(item) {
21693
+ if (!item)
21694
+ return null;
21695
+ if (typeof item === "string") {
21696
+ return ObjectId58.isValid(item) ? item : null;
21697
+ }
21698
+ if (typeof item === "object" && item !== null) {
21699
+ if ("keyId" in item) {
21700
+ const keyId = String(item.keyId);
21701
+ return ObjectId58.isValid(keyId) ? keyId : null;
21702
+ }
21703
+ const value = String(item);
21704
+ return ObjectId58.isValid(value) ? value : null;
21705
+ }
21706
+ return null;
21707
+ }
21708
+ function normalizeKeyRefs(items) {
21709
+ if (!Array.isArray(items))
21710
+ return [];
21711
+ const seen = /* @__PURE__ */ new Set();
21712
+ const normalized = [];
21713
+ for (const item of items) {
21714
+ const keyId = extractKeyId(item);
21715
+ if (!keyId || seen.has(keyId))
21716
+ continue;
21717
+ seen.add(keyId);
21718
+ normalized.push({ keyId: new ObjectId58(keyId) });
21719
+ }
21720
+ return normalized;
21721
+ }
21722
+ async function syncTransactionKeys({
21723
+ current,
21724
+ incoming,
21725
+ site,
21726
+ session
21727
+ }) {
21728
+ const currentIds = current.map((item) => item.keyId.toString());
21729
+ const incomingIds = incoming.map((item) => item.keyId.toString());
21730
+ const currentSet = new Set(currentIds);
21731
+ const incomingSet = new Set(incomingIds);
21732
+ const removedIds = currentIds.filter((id) => !incomingSet.has(id));
21733
+ const addedIds = incomingIds.filter((id) => !currentSet.has(id));
21734
+ for (const keyId of removedIds) {
21735
+ const existingKey = await KeyRepo.getById(keyId);
21736
+ if (!existingKey)
21737
+ continue;
21738
+ if (existingKey.status === "In Use" /* IN_USE */) {
21739
+ await KeyRepo.updateKeyById(
21740
+ keyId,
21741
+ { status: "Available" /* AVAILABLE */ },
21742
+ site,
21743
+ session
21744
+ );
21745
+ }
21746
+ }
21747
+ for (const keyId of addedIds) {
21748
+ await KeyRepo.updateKeyById(
21749
+ keyId,
21750
+ { status: "In Use" /* IN_USE */ },
21751
+ site,
21752
+ session
21753
+ );
21754
+ }
21755
+ }
21675
21756
  async function add(value) {
21676
21757
  const session = useAtlas48.getClient()?.startSession();
21677
21758
  const allowedPersonTypes = [
@@ -21916,7 +21997,7 @@ function useVisitorTransactionService() {
21916
21997
  session?.endSession();
21917
21998
  }
21918
21999
  }
21919
- async function updateById(id, value) {
22000
+ async function updateVisitorTransactionById(id, value) {
21920
22001
  const session = useAtlas48.getClient()?.startSession();
21921
22002
  session?.startTransaction();
21922
22003
  try {
@@ -22092,18 +22173,70 @@ function useVisitorTransactionService() {
22092
22173
  await session?.commitTransaction();
22093
22174
  return result;
22094
22175
  } catch (error) {
22095
- logger77.error("Error in people service invite visitor:", error);
22176
+ logger77.error("Error in visitor transaction invite visitor:", error);
22096
22177
  await session.abortTransaction();
22097
22178
  throw error;
22098
22179
  } finally {
22099
22180
  session?.endSession();
22100
22181
  }
22101
22182
  }
22183
+ async function changeVisitorTransactionKeysById(id, visitorPass, passKeys) {
22184
+ const session = useAtlas48.getClient()?.startSession();
22185
+ if (!session) {
22186
+ throw new Error(
22187
+ "Unable to start session for visitor transaction service."
22188
+ );
22189
+ }
22190
+ try {
22191
+ session.startTransaction();
22192
+ const visitorTransaction = await _getVisitorTransactionById(id);
22193
+ if (!visitorTransaction) {
22194
+ throw new Error("Visitor transaction not found.");
22195
+ }
22196
+ const updatePayload = {};
22197
+ if (visitorPass !== void 0) {
22198
+ const currentVisitorPass = normalizeKeyRefs(
22199
+ visitorTransaction.visitorPass
22200
+ );
22201
+ const incomingVisitorPass = normalizeKeyRefs(visitorPass);
22202
+ await syncTransactionKeys({
22203
+ current: currentVisitorPass,
22204
+ incoming: incomingVisitorPass,
22205
+ site: visitorTransaction.site,
22206
+ session
22207
+ });
22208
+ updatePayload.visitorPass = incomingVisitorPass;
22209
+ }
22210
+ if (passKeys !== void 0) {
22211
+ const currentPassKeys = normalizeKeyRefs(visitorTransaction.passKeys);
22212
+ const incomingPassKeys = normalizeKeyRefs(passKeys);
22213
+ await syncTransactionKeys({
22214
+ current: currentPassKeys,
22215
+ incoming: incomingPassKeys,
22216
+ site: visitorTransaction.site,
22217
+ session
22218
+ });
22219
+ updatePayload.passKeys = incomingPassKeys;
22220
+ }
22221
+ if (Object.keys(updatePayload).length > 0) {
22222
+ await _updateVisitorTansactionById(id, updatePayload, session);
22223
+ }
22224
+ await session.commitTransaction();
22225
+ return "Successfully changed visitor transaction keys.";
22226
+ } catch (error) {
22227
+ await session.abortTransaction();
22228
+ logger77.error("Error in visitor transaction change keys by id:", error);
22229
+ throw error;
22230
+ } finally {
22231
+ session.endSession();
22232
+ }
22233
+ }
22102
22234
  return {
22103
22235
  add,
22104
- updateById,
22236
+ updateVisitorTransactionById,
22105
22237
  processTransactionDahuaStatus,
22106
- inviteVisitor
22238
+ inviteVisitor,
22239
+ changeVisitorTransactionKeysById
22107
22240
  };
22108
22241
  }
22109
22242
 
@@ -22113,8 +22246,9 @@ import { BadRequestError as BadRequestError97, logger as logger78 } from "@7365a
22113
22246
  function useVisitorTransactionController() {
22114
22247
  const {
22115
22248
  add: _add,
22116
- updateById: _updateVisitorTansactionById,
22117
- inviteVisitor: _inviteVisitor
22249
+ updateVisitorTransactionById: _updateVisitorTransactionById,
22250
+ inviteVisitor: _inviteVisitor,
22251
+ changeVisitorTransactionKeysById: _changeVisitorTransactionKeysById
22118
22252
  } = useVisitorTransactionService();
22119
22253
  const {
22120
22254
  getAll: _getAll,
@@ -22256,7 +22390,7 @@ function useVisitorTransactionController() {
22256
22390
  return;
22257
22391
  }
22258
22392
  try {
22259
- await _updateVisitorTansactionById(_id, req.body);
22393
+ await _updateVisitorTransactionById(_id, req.body);
22260
22394
  res.status(200).json({ message: "Successfully updated visitor transaction." });
22261
22395
  return;
22262
22396
  } catch (error2) {
@@ -22310,8 +22444,31 @@ function useVisitorTransactionController() {
22310
22444
  next(new BadRequestError97(messages));
22311
22445
  return;
22312
22446
  }
22313
- const { expectedCheckIn, arrivalTime, duration, name, contact, email, plateNumber, isOvernightParking, numberOfPassengers, purpose, inviterUserId } = value;
22314
- const rest = { expectedCheckIn, arrivalTime, duration, name, contact, email, plateNumber, isOvernightParking, numberOfPassengers, purpose };
22447
+ const {
22448
+ expectedCheckIn,
22449
+ arrivalTime,
22450
+ duration,
22451
+ name,
22452
+ contact,
22453
+ email,
22454
+ plateNumber,
22455
+ isOvernightParking,
22456
+ numberOfPassengers,
22457
+ purpose,
22458
+ inviterUserId
22459
+ } = value;
22460
+ const rest = {
22461
+ expectedCheckIn,
22462
+ arrivalTime,
22463
+ duration,
22464
+ name,
22465
+ contact,
22466
+ email,
22467
+ plateNumber,
22468
+ isOvernightParking,
22469
+ numberOfPassengers,
22470
+ purpose
22471
+ };
22315
22472
  try {
22316
22473
  const result = await _inviteVisitor(rest, inviterUserId);
22317
22474
  res.status(200).json({ insertedId: result });
@@ -22322,13 +22479,61 @@ function useVisitorTransactionController() {
22322
22479
  return;
22323
22480
  }
22324
22481
  }
22482
+ async function changeVisitorTransactionKeysById(req, res, next) {
22483
+ const idValidation = Joi55.string().hex().length(24).required();
22484
+ const bodyValidation = Joi55.object({
22485
+ visitorPass: Joi55.array().items(
22486
+ Joi55.object({
22487
+ keyId: Joi55.string().hex().length(24).required()
22488
+ })
22489
+ ).optional(),
22490
+ passKeys: Joi55.array().items(
22491
+ Joi55.object({
22492
+ keyId: Joi55.string().hex().length(24).required()
22493
+ })
22494
+ ).optional()
22495
+ }).or("visitorPass", "passKeys");
22496
+ const _id = req.params.id;
22497
+ const { error: idError } = idValidation.validate(_id);
22498
+ if (idError) {
22499
+ logger78.log({ level: "error", message: idError.message });
22500
+ next(new BadRequestError97(idError.message));
22501
+ return;
22502
+ }
22503
+ const { error, value } = bodyValidation.validate(req.body, {
22504
+ abortEarly: false
22505
+ });
22506
+ if (error) {
22507
+ const message = error.details.map((d) => d.message).join(", ");
22508
+ logger78.log({ level: "error", message });
22509
+ next(new BadRequestError97(message));
22510
+ return;
22511
+ }
22512
+ try {
22513
+ const { visitorPass, passKeys } = value;
22514
+ const result = await _changeVisitorTransactionKeysById(
22515
+ _id,
22516
+ visitorPass,
22517
+ passKeys
22518
+ );
22519
+ res.status(200).json({
22520
+ message: result || "Successfully changed visitor transaction keys."
22521
+ });
22522
+ return;
22523
+ } catch (error2) {
22524
+ logger78.log({ level: "error", message: error2.message });
22525
+ next(error2);
22526
+ return;
22527
+ }
22528
+ }
22325
22529
  return {
22326
22530
  add,
22327
22531
  getAll,
22328
22532
  updateVisitorTansactionById,
22329
22533
  deleteVisitorTransaction,
22330
22534
  inviteVisitor,
22331
- getVisitorTransactionById
22535
+ getVisitorTransactionById,
22536
+ changeVisitorTransactionKeysById
22332
22537
  };
22333
22538
  }
22334
22539
 
@@ -36525,6 +36730,10 @@ var schemaSOABillingItem = Joi92.object({
36525
36730
  taxPercentage: Joi92.number().optional().allow(null),
36526
36731
  taxAmount: Joi92.number().optional().allow(null)
36527
36732
  });
36733
+ var schemaApprovedBy = Joi92.object({
36734
+ _id: Joi92.string().hex().optional().allow(null, ""),
36735
+ name: Joi92.string().optional().allow(null, "")
36736
+ });
36528
36737
  var schemaStatementOfAccount = Joi92.object({
36529
36738
  _id: Joi92.string().hex().optional(),
36530
36739
  site: Joi92.string().hex().required(),
@@ -36538,6 +36747,7 @@ var schemaStatementOfAccount = Joi92.object({
36538
36747
  category: Joi92.string().optional().allow(null, ""),
36539
36748
  status: Joi92.string().valid("pending", "approved", "rejected", "deleted").optional().allow(null, ""),
36540
36749
  billing: Joi92.array().items(schemaSOABillingItem).optional().allow(null, ""),
36750
+ approvedBy: schemaApprovedBy.optional().allow(null, ""),
36541
36751
  createdBy: Joi92.string().hex().required(),
36542
36752
  createdByName: Joi92.string().optional().allow(null, ""),
36543
36753
  createdAt: Joi92.date().optional(),
@@ -36557,6 +36767,7 @@ var schemaUpdateStatementOfAccount = Joi92.object({
36557
36767
  category: Joi92.string().optional().allow(null, ""),
36558
36768
  status: Joi92.string().valid("pending", "approved", "rejected", "deleted").optional().allow(null, ""),
36559
36769
  billing: Joi92.array().items(schemaSOABillingItem).optional().allow(null, ""),
36770
+ approvedBy: schemaApprovedBy.optional().allow(null, ""),
36560
36771
  createdBy: Joi92.string().optional().allow(null, ""),
36561
36772
  createdByName: Joi92.string().optional().allow(null, "")
36562
36773
  });
@@ -36621,6 +36832,7 @@ function MStatementOfAccount(value) {
36621
36832
  status: value.status ?? "pending",
36622
36833
  createdBy: value.createdBy,
36623
36834
  createdByName: value.createdByName ?? "",
36835
+ approvedBy: value.approvedBy,
36624
36836
  createdAt: value.createdAt ?? /* @__PURE__ */ new Date(),
36625
36837
  updatedAt: value.updatedAt ?? "",
36626
36838
  deletedAt: value.deletedAt ?? ""
@@ -36959,6 +37171,35 @@ function useStatementOfAccountRepo() {
36959
37171
  });
36960
37172
  });
36961
37173
  }
37174
+ async function reviewSOA(_id, value, session) {
37175
+ value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
37176
+ try {
37177
+ _id = new ObjectId97(_id);
37178
+ } catch (error) {
37179
+ throw new BadRequestError151("Invalid ID format.");
37180
+ }
37181
+ try {
37182
+ const res = await collection.updateOne(
37183
+ { _id },
37184
+ { $set: value },
37185
+ { session }
37186
+ );
37187
+ if (res.modifiedCount === 0) {
37188
+ throw new InternalServerError50(`Unable to ${value.status} soa.`);
37189
+ }
37190
+ delNamespace().then(() => {
37191
+ logger128.info(`Cache cleared for namespace: ${namespace_collection}`);
37192
+ }).catch((err) => {
37193
+ logger128.error(
37194
+ `Failed to clear cache for namespace: ${namespace_collection}`,
37195
+ err
37196
+ );
37197
+ });
37198
+ return res;
37199
+ } catch (error) {
37200
+ throw error;
37201
+ }
37202
+ }
36962
37203
  return {
36963
37204
  createTextIndex,
36964
37205
  add,
@@ -36967,7 +37208,8 @@ function useStatementOfAccountRepo() {
36967
37208
  updateById,
36968
37209
  deleteById,
36969
37210
  updateStatusById,
36970
- getResidentUserSoa
37211
+ getResidentUserSoa,
37212
+ reviewSOA
36971
37213
  };
36972
37214
  }
36973
37215
 
@@ -36980,9 +37222,10 @@ import {
36980
37222
  logger as logger129,
36981
37223
  useAtlas as useAtlas83
36982
37224
  } from "@7365admin1/node-server-utils";
37225
+ import { ObjectId as ObjectId98 } from "mongodb";
36983
37226
  import { launch } from "puppeteer";
36984
37227
  function useStatementOfAccountService() {
36985
- const { add: _add } = useStatementOfAccountRepo();
37228
+ const { add: _add, reviewSOA: _reviewSOA } = useStatementOfAccountRepo();
36986
37229
  const { getUnitBillingBySite } = useSiteUnitBillingRepo();
36987
37230
  const { getUserById } = useUserRepo();
36988
37231
  async function add(value, dateFrom, dateTo) {
@@ -37110,9 +37353,31 @@ function useStatementOfAccountService() {
37110
37353
  throw error;
37111
37354
  }
37112
37355
  }
37356
+ async function reviewSOA(id, value) {
37357
+ const session = useAtlas83.getClient()?.startSession();
37358
+ session?.startTransaction();
37359
+ try {
37360
+ if (value?.approvedBy?._id) {
37361
+ const approvedBy = await getUserById(value?.approvedBy?._id);
37362
+ if (!approvedBy || !approvedBy.name)
37363
+ throw new BadRequestError152("Created by not found.");
37364
+ value.approvedBy.name = approvedBy.name;
37365
+ value.approvedBy._id = new ObjectId98(approvedBy._id);
37366
+ }
37367
+ await _reviewSOA(id, value, session);
37368
+ await session?.commitTransaction();
37369
+ return `Successfully ${value.status} soa.`;
37370
+ } catch (error) {
37371
+ await session?.abortTransaction();
37372
+ throw error;
37373
+ } finally {
37374
+ session?.endSession();
37375
+ }
37376
+ }
37113
37377
  return {
37114
37378
  add,
37115
- generatePDF
37379
+ generatePDF,
37380
+ reviewSOA
37116
37381
  };
37117
37382
  }
37118
37383
 
@@ -37127,7 +37392,11 @@ function useStatementOfAccountController() {
37127
37392
  updateStatusById: _updateStatusById,
37128
37393
  getResidentUserSoa: _getResidentUserSoa
37129
37394
  } = useStatementOfAccountRepo();
37130
- const { add: _add, generatePDF: _generatePDF } = useStatementOfAccountService();
37395
+ const {
37396
+ add: _add,
37397
+ generatePDF: _generatePDF,
37398
+ reviewSOA: _reviewSOA
37399
+ } = useStatementOfAccountService();
37131
37400
  async function add(req, res, next) {
37132
37401
  const cookies = req.headers.cookie?.split(";").map((cookie) => cookie.trim().split("=")).reduce(
37133
37402
  (acc, [key, value]) => ({ ...acc, [key]: value }),
@@ -37427,6 +37696,40 @@ function useStatementOfAccountController() {
37427
37696
  return;
37428
37697
  }
37429
37698
  }
37699
+ async function reviewSOA(req, res, next) {
37700
+ const cookies = req.headers.cookie?.split(";").map((cookie) => cookie.trim().split("=")).reduce(
37701
+ (acc, [key, value]) => ({ ...acc, [key]: value }),
37702
+ {}
37703
+ );
37704
+ req.body.approvedBy = {
37705
+ _id: "",
37706
+ name: ""
37707
+ };
37708
+ req.body.approvedBy._id = cookies?.["user"] ? cookies["user"].toString() : req.body.approvedBy._id;
37709
+ const _id = req.params.id;
37710
+ const payload = { _id, ...req.body };
37711
+ const schema2 = Joi93.object({
37712
+ _id: Joi93.string().hex().required(),
37713
+ status: Joi93.string().valid("approved", "rejected").required(),
37714
+ approvedBy: schemaApprovedBy
37715
+ });
37716
+ const { error } = schema2.validate(payload);
37717
+ if (error) {
37718
+ const messages = error.details.map((d) => d.message).join(", ");
37719
+ logger130.log({ level: "error", message: messages });
37720
+ next(new BadRequestError153(messages));
37721
+ return;
37722
+ }
37723
+ try {
37724
+ const result = await _reviewSOA(_id, req.body);
37725
+ res.status(200).json({ message: result });
37726
+ return;
37727
+ } catch (error2) {
37728
+ logger130.log({ level: "error", message: error2.message });
37729
+ next(error2);
37730
+ return;
37731
+ }
37732
+ }
37430
37733
  return {
37431
37734
  add,
37432
37735
  getAll,
@@ -37435,13 +37738,14 @@ function useStatementOfAccountController() {
37435
37738
  deleteById,
37436
37739
  generatePDF,
37437
37740
  updateStatusById,
37438
- getResidentUserSoa
37741
+ getResidentUserSoa,
37742
+ reviewSOA
37439
37743
  };
37440
37744
  }
37441
37745
 
37442
37746
  // src/models/site-entrypass-settings.model.ts
37443
37747
  import { BadRequestError as BadRequestError154, logger as logger131 } from "@7365admin1/node-server-utils";
37444
- import { ObjectId as ObjectId98 } from "mongodb";
37748
+ import { ObjectId as ObjectId99 } from "mongodb";
37445
37749
  import Joi94 from "joi";
37446
37750
  var schemaEntryPassSettings = Joi94.object({
37447
37751
  _id: Joi94.string().hex().optional().allow("", null),
@@ -37489,21 +37793,21 @@ function MEntryPassSettings(value) {
37489
37793
  }
37490
37794
  if (value._id && typeof value._id === "string") {
37491
37795
  try {
37492
- value._id = new ObjectId98(value._id);
37796
+ value._id = new ObjectId99(value._id);
37493
37797
  } catch {
37494
37798
  throw new BadRequestError154("Invalid _id format");
37495
37799
  }
37496
37800
  }
37497
37801
  if (value.site && typeof value.site === "string") {
37498
37802
  try {
37499
- value.site = new ObjectId98(value.site);
37803
+ value.site = new ObjectId99(value.site);
37500
37804
  } catch {
37501
37805
  throw new BadRequestError154("Invalid site format");
37502
37806
  }
37503
37807
  }
37504
37808
  if (value.org && typeof value.org === "string") {
37505
37809
  try {
37506
- value.org = new ObjectId98(value.org);
37810
+ value.org = new ObjectId99(value.org);
37507
37811
  } catch {
37508
37812
  throw new BadRequestError154("Invalid org format");
37509
37813
  }
@@ -37542,7 +37846,7 @@ import {
37542
37846
  useAtlas as useAtlas84,
37543
37847
  useCache as useCache51
37544
37848
  } from "@7365admin1/node-server-utils";
37545
- import { ObjectId as ObjectId99 } from "mongodb";
37849
+ import { ObjectId as ObjectId100 } from "mongodb";
37546
37850
  function useEntryPassSettingsRepo() {
37547
37851
  const db = useAtlas84.getDb();
37548
37852
  if (!db) {
@@ -37652,7 +37956,7 @@ function useEntryPassSettingsRepo() {
37652
37956
  }
37653
37957
  async function getEntryPassSettingsById(_id) {
37654
37958
  try {
37655
- _id = new ObjectId99(_id);
37959
+ _id = new ObjectId100(_id);
37656
37960
  } catch (error) {
37657
37961
  throw new BadRequestError155("Invalid entry pass settings ID format.");
37658
37962
  }
@@ -37719,7 +38023,7 @@ function useEntryPassSettingsRepo() {
37719
38023
  }
37720
38024
  async function updateEntryPassSettingsById(_id, value) {
37721
38025
  try {
37722
- _id = new ObjectId99(_id);
38026
+ _id = new ObjectId100(_id);
37723
38027
  } catch (error) {
37724
38028
  throw new BadRequestError155("Invalid entry pass settings ID format.");
37725
38029
  }
@@ -37747,7 +38051,7 @@ function useEntryPassSettingsRepo() {
37747
38051
  }
37748
38052
  async function deleteEntryPassSettingsById(_id, session) {
37749
38053
  try {
37750
- _id = new ObjectId99(_id);
38054
+ _id = new ObjectId100(_id);
37751
38055
  } catch (error) {
37752
38056
  throw new BadRequestError155("Invalid card ID format.");
37753
38057
  }
@@ -37780,7 +38084,7 @@ function useEntryPassSettingsRepo() {
37780
38084
  }
37781
38085
  async function getEntryPassSettingsBySiteId(site) {
37782
38086
  try {
37783
- site = new ObjectId99(site);
38087
+ site = new ObjectId100(site);
37784
38088
  } catch (error) {
37785
38089
  throw new BadRequestError155("Invalid entry pass settings ID format.");
37786
38090
  }
@@ -37847,7 +38151,7 @@ function useEntryPassSettingsRepo() {
37847
38151
  }
37848
38152
  async function updateEntryPassSettingsBySiteId(site, value) {
37849
38153
  try {
37850
- site = new ObjectId99(site);
38154
+ site = new ObjectId100(site);
37851
38155
  } catch (error) {
37852
38156
  throw new BadRequestError155("Invalid entry pass settings ID format.");
37853
38157
  }
@@ -38212,7 +38516,7 @@ function useDashboardController() {
38212
38516
  }
38213
38517
 
38214
38518
  // src/models/nfc-patrol-route.model.ts
38215
- import { ObjectId as ObjectId100 } from "mongodb";
38519
+ import { ObjectId as ObjectId101 } from "mongodb";
38216
38520
  import Joi97 from "joi";
38217
38521
  import { BadRequestError as BadRequestError158, logger as logger136 } from "@7365admin1/node-server-utils";
38218
38522
  var schemaNfcPatrolRoute = Joi97.object({
@@ -38248,23 +38552,23 @@ function MNfcPatrolRoute(value) {
38248
38552
  }
38249
38553
  if (value._id && typeof value._id === "string") {
38250
38554
  try {
38251
- value._id = new ObjectId100(value._id);
38555
+ value._id = new ObjectId101(value._id);
38252
38556
  } catch (error2) {
38253
38557
  throw new BadRequestError158("Invalid _id format");
38254
38558
  }
38255
38559
  }
38256
38560
  try {
38257
- value.site = new ObjectId100(value.site);
38561
+ value.site = new ObjectId101(value.site);
38258
38562
  } catch (error2) {
38259
38563
  throw new BadRequestError158("Invalid site format");
38260
38564
  }
38261
38565
  try {
38262
- value.createdBy = new ObjectId100(value.createdBy);
38566
+ value.createdBy = new ObjectId101(value.createdBy);
38263
38567
  } catch (error2) {
38264
38568
  throw new BadRequestError158("Invalid createdBy format");
38265
38569
  }
38266
38570
  return {
38267
- _id: value._id ?? new ObjectId100(),
38571
+ _id: value._id ?? new ObjectId101(),
38268
38572
  site: value.site,
38269
38573
  name: value.name,
38270
38574
  checkPointNumber: value.checkPointNumber,
@@ -38289,7 +38593,7 @@ import {
38289
38593
  useAtlas as useAtlas86,
38290
38594
  useCache as useCache53
38291
38595
  } from "@7365admin1/node-server-utils";
38292
- import { ObjectId as ObjectId101 } from "mongodb";
38596
+ import { ObjectId as ObjectId102 } from "mongodb";
38293
38597
  function useNfcPatrolRouteRepo() {
38294
38598
  const db = useAtlas86.getDb();
38295
38599
  if (!db) {
@@ -38333,7 +38637,7 @@ function useNfcPatrolRouteRepo() {
38333
38637
  }, session) {
38334
38638
  page = page > 0 ? page - 1 : 0;
38335
38639
  try {
38336
- site = new ObjectId101(site);
38640
+ site = new ObjectId102(site);
38337
38641
  } catch (error) {
38338
38642
  throw new BadRequestError159("Invalid site ID format.");
38339
38643
  }
@@ -38404,7 +38708,7 @@ function useNfcPatrolRouteRepo() {
38404
38708
  }
38405
38709
  async function getById(_id, isStart) {
38406
38710
  try {
38407
- _id = new ObjectId101(_id);
38711
+ _id = new ObjectId102(_id);
38408
38712
  } catch (error) {
38409
38713
  throw new BadRequestError159("Invalid ID.");
38410
38714
  }
@@ -38514,18 +38818,18 @@ function useNfcPatrolRouteRepo() {
38514
38818
  throw new BadRequestError159(error.message);
38515
38819
  }
38516
38820
  try {
38517
- _id = new ObjectId101(_id);
38821
+ _id = new ObjectId102(_id);
38518
38822
  } catch (error2) {
38519
38823
  throw new BadRequestError159("Invalid ID.");
38520
38824
  }
38521
38825
  try {
38522
- value.site = new ObjectId101(value.site);
38826
+ value.site = new ObjectId102(value.site);
38523
38827
  } catch (error2) {
38524
38828
  throw new BadRequestError159("Invalid site format");
38525
38829
  }
38526
38830
  if (value.updatedBy) {
38527
38831
  try {
38528
- value.updatedBy = new ObjectId101(value.updatedBy);
38832
+ value.updatedBy = new ObjectId102(value.updatedBy);
38529
38833
  } catch (error2) {
38530
38834
  throw new BadRequestError159("Invalid createdBy format");
38531
38835
  }
@@ -38758,7 +39062,7 @@ function useNfcPatrolRouteController() {
38758
39062
  }
38759
39063
 
38760
39064
  // src/models/incident-report.model.ts
38761
- import { ObjectId as ObjectId102 } from "mongodb";
39065
+ import { ObjectId as ObjectId103 } from "mongodb";
38762
39066
  import Joi99 from "joi";
38763
39067
  var residentSchema = Joi99.object({
38764
39068
  _id: Joi99.string().hex().optional().allow(null, ""),
@@ -38962,28 +39266,28 @@ var schemaUpdateIncidentReport = Joi99.object({
38962
39266
  function MIncidentReport(value) {
38963
39267
  if (value._id && typeof value._id === "string") {
38964
39268
  try {
38965
- value._id = new ObjectId102(value._id);
39269
+ value._id = new ObjectId103(value._id);
38966
39270
  } catch {
38967
39271
  throw new Error("Invalid incident report ID.");
38968
39272
  }
38969
39273
  }
38970
39274
  if (value.organization && typeof value.organization === "string") {
38971
39275
  try {
38972
- value.organization = new ObjectId102(value.organization);
39276
+ value.organization = new ObjectId103(value.organization);
38973
39277
  } catch {
38974
39278
  throw new Error("Invalid organization ID.");
38975
39279
  }
38976
39280
  }
38977
39281
  if (value.site && typeof value.site === "string") {
38978
39282
  try {
38979
- value.site = new ObjectId102(value.site);
39283
+ value.site = new ObjectId103(value.site);
38980
39284
  } catch {
38981
39285
  throw new Error("Invalid site ID.");
38982
39286
  }
38983
39287
  }
38984
39288
  if (value.approvedBy && typeof value.approvedBy === "string") {
38985
39289
  try {
38986
- value.approvedBy = new ObjectId102(value.approvedBy);
39290
+ value.approvedBy = new ObjectId103(value.approvedBy);
38987
39291
  } catch {
38988
39292
  throw new Error("Invalid approvedBy ID.");
38989
39293
  }
@@ -38991,7 +39295,7 @@ function MIncidentReport(value) {
38991
39295
  const { incidentInformation } = value;
38992
39296
  if (incidentInformation?.siteInfo?.site && typeof incidentInformation.siteInfo.site === "string") {
38993
39297
  try {
38994
- incidentInformation.siteInfo.site = new ObjectId102(
39298
+ incidentInformation.siteInfo.site = new ObjectId103(
38995
39299
  incidentInformation.siteInfo.site
38996
39300
  );
38997
39301
  } catch {
@@ -39005,7 +39309,7 @@ function MIncidentReport(value) {
39005
39309
  incidentInformation.submissionForm.dateOfReport = incidentInformation.submissionForm.dateOfReport.toISOString();
39006
39310
  }
39007
39311
  return {
39008
- _id: value._id ?? new ObjectId102(),
39312
+ _id: value._id ?? new ObjectId103(),
39009
39313
  reportId: value.reportId,
39010
39314
  incidentInformation: value.incidentInformation,
39011
39315
  affectedEntities: value.affectedEntities,
@@ -39042,7 +39346,7 @@ import {
39042
39346
  useAtlas as useAtlas88,
39043
39347
  useCache as useCache54
39044
39348
  } from "@7365admin1/node-server-utils";
39045
- import { ObjectId as ObjectId103 } from "mongodb";
39349
+ import { ObjectId as ObjectId104 } from "mongodb";
39046
39350
  var incidents_namespace_collection = "incident-reports";
39047
39351
  function useIncidentReportRepo() {
39048
39352
  const db = useAtlas88.getDb();
@@ -39109,7 +39413,7 @@ function useIncidentReportRepo() {
39109
39413
  page = page > 0 ? page - 1 : 0;
39110
39414
  let dateExpr = {};
39111
39415
  try {
39112
- site = new ObjectId103(site);
39416
+ site = new ObjectId104(site);
39113
39417
  } catch (error) {
39114
39418
  throw new BadRequestError162("Invalid site ID format.");
39115
39419
  }
@@ -39210,7 +39514,7 @@ function useIncidentReportRepo() {
39210
39514
  page = page > 0 ? page - 1 : 0;
39211
39515
  let dateExpr = {};
39212
39516
  try {
39213
- site = new ObjectId103(site);
39517
+ site = new ObjectId104(site);
39214
39518
  } catch (error) {
39215
39519
  throw new BadRequestError162("Invalid site ID format.");
39216
39520
  }
@@ -39279,7 +39583,7 @@ function useIncidentReportRepo() {
39279
39583
  }
39280
39584
  async function getIncidentReportById(_id, session) {
39281
39585
  try {
39282
- _id = new ObjectId103(_id);
39586
+ _id = new ObjectId104(_id);
39283
39587
  } catch (error) {
39284
39588
  throw new BadRequestError162("Invalid incident report ID format.");
39285
39589
  }
@@ -39310,27 +39614,27 @@ function useIncidentReportRepo() {
39310
39614
  async function updateIncidentReportById(_id, value, session) {
39311
39615
  value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
39312
39616
  try {
39313
- _id = new ObjectId103(_id);
39617
+ _id = new ObjectId104(_id);
39314
39618
  } catch (error) {
39315
39619
  throw new BadRequestError162("Invalid ID format.");
39316
39620
  }
39317
39621
  if (value.organization && typeof value.organization === "string") {
39318
39622
  try {
39319
- value.organization = new ObjectId103(value.organization);
39623
+ value.organization = new ObjectId104(value.organization);
39320
39624
  } catch {
39321
39625
  throw new Error("Invalid organization ID.");
39322
39626
  }
39323
39627
  }
39324
39628
  if (value.site && typeof value.site === "string") {
39325
39629
  try {
39326
- value.site = new ObjectId103(value.site);
39630
+ value.site = new ObjectId104(value.site);
39327
39631
  } catch {
39328
39632
  throw new Error("Invalid site ID.");
39329
39633
  }
39330
39634
  }
39331
39635
  if (value.approvedBy && typeof value.approvedBy === "string") {
39332
39636
  try {
39333
- value.approvedBy = new ObjectId103(value.approvedBy);
39637
+ value.approvedBy = new ObjectId104(value.approvedBy);
39334
39638
  } catch {
39335
39639
  throw new Error("Invalid approvedBy ID.");
39336
39640
  }
@@ -39338,7 +39642,7 @@ function useIncidentReportRepo() {
39338
39642
  const { incidentInformation } = value;
39339
39643
  if (incidentInformation?.siteInfo?.site && typeof incidentInformation.siteInfo.site === "string") {
39340
39644
  try {
39341
- incidentInformation.siteInfo.site = new ObjectId103(
39645
+ incidentInformation.siteInfo.site = new ObjectId104(
39342
39646
  incidentInformation.siteInfo.site
39343
39647
  );
39344
39648
  } catch {
@@ -39373,7 +39677,7 @@ function useIncidentReportRepo() {
39373
39677
  }
39374
39678
  async function deleteIncidentReportById(_id) {
39375
39679
  try {
39376
- _id = new ObjectId103(_id);
39680
+ _id = new ObjectId104(_id);
39377
39681
  } catch (error) {
39378
39682
  throw new BadRequestError162("Invalid occurrence subject ID format.");
39379
39683
  }
@@ -39405,7 +39709,7 @@ function useIncidentReportRepo() {
39405
39709
  async function reviewIncidentReport(_id, value, session) {
39406
39710
  value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
39407
39711
  try {
39408
- _id = new ObjectId103(_id);
39712
+ _id = new ObjectId104(_id);
39409
39713
  } catch (error) {
39410
39714
  throw new BadRequestError162("Invalid ID format.");
39411
39715
  }
@@ -39897,7 +40201,7 @@ function useIncidentReportController() {
39897
40201
  }
39898
40202
 
39899
40203
  // src/models/nfc-patrol-settings.model.ts
39900
- import { ObjectId as ObjectId104 } from "mongodb";
40204
+ import { ObjectId as ObjectId105 } from "mongodb";
39901
40205
  import Joi101 from "joi";
39902
40206
  import { BadRequestError as BadRequestError165, logger as logger142 } from "@7365admin1/node-server-utils";
39903
40207
  var objectId = Joi101.string().hex().length(24);
@@ -39923,7 +40227,7 @@ function MNfcPatrolSettings(value) {
39923
40227
  }
39924
40228
  if (value.site) {
39925
40229
  try {
39926
- value.site = new ObjectId104(value.site);
40230
+ value.site = new ObjectId105(value.site);
39927
40231
  } catch (error2) {
39928
40232
  throw new BadRequestError165("Invalid site ID format.");
39929
40233
  }
@@ -39943,7 +40247,7 @@ function MNfcPatrolSettingsUpdate(value) {
39943
40247
  }
39944
40248
  if (value.updatedBy) {
39945
40249
  try {
39946
- value.updatedBy = new ObjectId104(value.updatedBy);
40250
+ value.updatedBy = new ObjectId105(value.updatedBy);
39947
40251
  } catch (error2) {
39948
40252
  throw new BadRequestError165("Invalid updatedBy ID format.");
39949
40253
  }
@@ -39965,7 +40269,7 @@ import {
39965
40269
  useAtlas as useAtlas90,
39966
40270
  useCache as useCache55
39967
40271
  } from "@7365admin1/node-server-utils";
39968
- import { ObjectId as ObjectId105 } from "mongodb";
40272
+ import { ObjectId as ObjectId106 } from "mongodb";
39969
40273
  function useNfcPatrolSettingsRepository() {
39970
40274
  const db = useAtlas90.getDb();
39971
40275
  if (!db) {
@@ -39995,7 +40299,7 @@ function useNfcPatrolSettingsRepository() {
39995
40299
  }
39996
40300
  async function getNfcPatrolSettingsBySite(site, session) {
39997
40301
  try {
39998
- site = new ObjectId105(site);
40302
+ site = new ObjectId106(site);
39999
40303
  } catch (error) {
40000
40304
  throw new BadRequestError166("Invalid nfc patrol settings site ID format.");
40001
40305
  }
@@ -40039,7 +40343,7 @@ function useNfcPatrolSettingsRepository() {
40039
40343
  }
40040
40344
  async function updateNfcPatrolSettings(site, value, session) {
40041
40345
  try {
40042
- site = new ObjectId105(site);
40346
+ site = new ObjectId106(site);
40043
40347
  } catch (error) {
40044
40348
  throw new BadRequestError166("Invalid attendance settings ID format.");
40045
40349
  }
@@ -40208,7 +40512,7 @@ function useNfcPatrolSettingsController() {
40208
40512
 
40209
40513
  // src/services/occurrence-entry.service.ts
40210
40514
  import { useAtlas as useAtlas93 } from "@7365admin1/node-server-utils";
40211
- import { ObjectId as ObjectId108 } from "mongodb";
40515
+ import { ObjectId as ObjectId109 } from "mongodb";
40212
40516
 
40213
40517
  // src/repositories/occurrence-subject.repo.ts
40214
40518
  import {
@@ -40223,7 +40527,7 @@ import {
40223
40527
  } from "@7365admin1/node-server-utils";
40224
40528
 
40225
40529
  // src/models/occurrence-subject.model.ts
40226
- import { ObjectId as ObjectId106 } from "mongodb";
40530
+ import { ObjectId as ObjectId107 } from "mongodb";
40227
40531
  import Joi103 from "joi";
40228
40532
  var schemaOccurrenceSubject = Joi103.object({
40229
40533
  site: Joi103.string().hex().required(),
@@ -40237,27 +40541,27 @@ var schemaUpdateOccurrenceSubject = Joi103.object({
40237
40541
  function MOccurrenceSubject(value) {
40238
40542
  if (value._id && typeof value._id === "string") {
40239
40543
  try {
40240
- value._id = new ObjectId106(value._id);
40544
+ value._id = new ObjectId107(value._id);
40241
40545
  } catch {
40242
40546
  throw new Error("Invalid ID.");
40243
40547
  }
40244
40548
  }
40245
40549
  if (value.site && typeof value.site === "string") {
40246
40550
  try {
40247
- value.site = new ObjectId106(value.site);
40551
+ value.site = new ObjectId107(value.site);
40248
40552
  } catch {
40249
40553
  throw new Error("Invalid site ID.");
40250
40554
  }
40251
40555
  }
40252
40556
  if (value.addedBy && typeof value.addedBy === "string") {
40253
40557
  try {
40254
- value.addedBy = new ObjectId106(value.addedBy);
40558
+ value.addedBy = new ObjectId107(value.addedBy);
40255
40559
  } catch {
40256
40560
  throw new Error("Invalid addedBy ID.");
40257
40561
  }
40258
40562
  }
40259
40563
  return {
40260
- _id: value._id ?? new ObjectId106(),
40564
+ _id: value._id ?? new ObjectId107(),
40261
40565
  site: value.site,
40262
40566
  subject: value.subject,
40263
40567
  addedBy: value.addedBy ?? "",
@@ -40268,7 +40572,7 @@ function MOccurrenceSubject(value) {
40268
40572
  }
40269
40573
 
40270
40574
  // src/repositories/occurrence-subject.repo.ts
40271
- import { ObjectId as ObjectId107 } from "mongodb";
40575
+ import { ObjectId as ObjectId108 } from "mongodb";
40272
40576
  function useOccurrenceSubjectRepo() {
40273
40577
  const db = useAtlas92.getDb();
40274
40578
  if (!db) {
@@ -40327,7 +40631,7 @@ function useOccurrenceSubjectRepo() {
40327
40631
  }, session) {
40328
40632
  page = page > 0 ? page - 1 : 0;
40329
40633
  try {
40330
- site = new ObjectId107(site);
40634
+ site = new ObjectId108(site);
40331
40635
  } catch (error) {
40332
40636
  throw new BadRequestError169("Invalid site ID format.");
40333
40637
  }
@@ -40422,7 +40726,7 @@ function useOccurrenceSubjectRepo() {
40422
40726
  }
40423
40727
  async function getOccurrenceSubjectById(_id, session) {
40424
40728
  try {
40425
- _id = new ObjectId107(_id);
40729
+ _id = new ObjectId108(_id);
40426
40730
  } catch (error) {
40427
40731
  throw new BadRequestError169("Invalid occurrence subject ID format.");
40428
40732
  }
@@ -40439,7 +40743,7 @@ function useOccurrenceSubjectRepo() {
40439
40743
  async function updateOccurrenceSubjectById(_id, value, session) {
40440
40744
  value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
40441
40745
  try {
40442
- _id = new ObjectId107(_id);
40746
+ _id = new ObjectId108(_id);
40443
40747
  } catch (error) {
40444
40748
  throw new BadRequestError169("Invalid ID format.");
40445
40749
  }
@@ -40469,7 +40773,7 @@ function useOccurrenceSubjectRepo() {
40469
40773
  }
40470
40774
  async function deleteOccurrenceSubjectById(_id) {
40471
40775
  try {
40472
- _id = new ObjectId107(_id);
40776
+ _id = new ObjectId108(_id);
40473
40777
  } catch (error) {
40474
40778
  throw new BadRequestError169("Invalid occurrence subject ID format.");
40475
40779
  }
@@ -40581,8 +40885,8 @@ function useOccurrenceEntryService() {
40581
40885
  value.dailyOccurrenceBookId = occurrenceEntry.dailyOccurrenceBookId;
40582
40886
  value.bookEntryCount = value.bookEntryCount ? value.bookEntryCount : occurrenceEntry.bookEntryCount;
40583
40887
  value.occurrence = value.occurrence ? value.occurrence : occurrenceEntry.occurrence;
40584
- value.signature = value.signature ? new ObjectId108(value.signature) : occurrenceEntry.signature._id;
40585
- value.eSignature = value.eSignature ? new ObjectId108(value.eSignature) : occurrenceEntry.eSignature;
40888
+ value.signature = value.signature ? new ObjectId109(value.signature) : occurrenceEntry.signature._id;
40889
+ value.eSignature = value.eSignature ? new ObjectId109(value.eSignature) : occurrenceEntry.eSignature;
40586
40890
  value.createdAt = /* @__PURE__ */ new Date();
40587
40891
  value.date = value.date ? value.date : occurrenceEntry.date;
40588
40892
  value.userName = value.userName ? value.userName : occurrenceEntry.signature.name;
@@ -40782,7 +41086,7 @@ function useOccurrenceEntryController() {
40782
41086
 
40783
41087
  // src/models/online-form.model.ts
40784
41088
  import Joi105 from "joi";
40785
- import { ObjectId as ObjectId109 } from "mongodb";
41089
+ import { ObjectId as ObjectId110 } from "mongodb";
40786
41090
  var schemaOnlineForm = Joi105.object({
40787
41091
  _id: Joi105.string().hex().optional().allow("", null),
40788
41092
  name: Joi105.string().required(),
@@ -40830,21 +41134,21 @@ function MOnlineForm(value) {
40830
41134
  }
40831
41135
  if (value._id && typeof value._id === "string") {
40832
41136
  try {
40833
- value._id = new ObjectId109(value._id);
41137
+ value._id = new ObjectId110(value._id);
40834
41138
  } catch (error2) {
40835
41139
  throw new Error("Invalid ID.");
40836
41140
  }
40837
41141
  }
40838
41142
  if (value.org && typeof value.org === "string") {
40839
41143
  try {
40840
- value.org = new ObjectId109(value.org);
41144
+ value.org = new ObjectId110(value.org);
40841
41145
  } catch (error2) {
40842
41146
  throw new Error("Invalid org ID.");
40843
41147
  }
40844
41148
  }
40845
41149
  if (value.site && typeof value.site === "string") {
40846
41150
  try {
40847
- value.site = new ObjectId109(value.site);
41151
+ value.site = new ObjectId110(value.site);
40848
41152
  } catch (error2) {
40849
41153
  throw new Error("Invalid site ID.");
40850
41154
  }
@@ -40876,7 +41180,7 @@ import {
40876
41180
  useAtlas as useAtlas94,
40877
41181
  useCache as useCache57
40878
41182
  } from "@7365admin1/node-server-utils";
40879
- import { ObjectId as ObjectId110 } from "mongodb";
41183
+ import { ObjectId as ObjectId111 } from "mongodb";
40880
41184
  function useOnlineFormRepo() {
40881
41185
  const db = useAtlas94.getDb();
40882
41186
  if (!db) {
@@ -40928,7 +41232,7 @@ function useOnlineFormRepo() {
40928
41232
  }) {
40929
41233
  page = page > 0 ? page - 1 : 0;
40930
41234
  try {
40931
- site = new ObjectId110(site);
41235
+ site = new ObjectId111(site);
40932
41236
  } catch (error) {
40933
41237
  throw new BadRequestError171("Invalid site ID format.");
40934
41238
  }
@@ -40988,7 +41292,7 @@ function useOnlineFormRepo() {
40988
41292
  }
40989
41293
  async function getOnlineFormById(_id) {
40990
41294
  try {
40991
- _id = new ObjectId110(_id);
41295
+ _id = new ObjectId111(_id);
40992
41296
  } catch (error) {
40993
41297
  throw new BadRequestError171("Invalid online form ID format.");
40994
41298
  }
@@ -41031,7 +41335,7 @@ function useOnlineFormRepo() {
41031
41335
  }
41032
41336
  async function updateOnlineFormById(_id, value) {
41033
41337
  try {
41034
- _id = new ObjectId110(_id);
41338
+ _id = new ObjectId111(_id);
41035
41339
  } catch (error) {
41036
41340
  throw new BadRequestError171("Invalid online form ID format.");
41037
41341
  }
@@ -41059,7 +41363,7 @@ function useOnlineFormRepo() {
41059
41363
  }
41060
41364
  async function deleteOnlineFormById(_id, session) {
41061
41365
  try {
41062
- _id = new ObjectId110(_id);
41366
+ _id = new ObjectId111(_id);
41063
41367
  } catch (error) {
41064
41368
  throw new BadRequestError171("Invalid online form ID format.");
41065
41369
  }
@@ -41092,7 +41396,7 @@ function useOnlineFormRepo() {
41092
41396
  }
41093
41397
  async function getOnlineFormsBySiteId(site, { search = "", page = 1, limit = 10, status = "active" }) {
41094
41398
  try {
41095
- site = new ObjectId110(site);
41399
+ site = new ObjectId111(site);
41096
41400
  } catch (error) {
41097
41401
  throw new BadRequestError171(
41098
41402
  "Invalid online form configuration site ID format."
@@ -41533,7 +41837,7 @@ function useOccurrenceSubjectController() {
41533
41837
  }
41534
41838
 
41535
41839
  // src/models/nfc-patrol-log.model.ts
41536
- import { ObjectId as ObjectId111 } from "mongodb";
41840
+ import { ObjectId as ObjectId112 } from "mongodb";
41537
41841
  import Joi108 from "joi";
41538
41842
  import { BadRequestError as BadRequestError174, logger as logger151 } from "@7365admin1/node-server-utils";
41539
41843
  var schemaNfcPatrolLog = Joi108.object({
@@ -41585,32 +41889,32 @@ function MNfcPatrolLog(valueArg) {
41585
41889
  }
41586
41890
  if (value._id && typeof value._id === "string") {
41587
41891
  try {
41588
- value._id = new ObjectId111(value._id);
41892
+ value._id = new ObjectId112(value._id);
41589
41893
  } catch (error2) {
41590
41894
  throw new BadRequestError174("Invalid _id format");
41591
41895
  }
41592
41896
  }
41593
41897
  try {
41594
- value.site = new ObjectId111(value.site);
41898
+ value.site = new ObjectId112(value.site);
41595
41899
  } catch (error2) {
41596
41900
  throw new BadRequestError174("Invalid site format");
41597
41901
  }
41598
41902
  if (value?.createdBy) {
41599
41903
  try {
41600
- value.createdBy = new ObjectId111(value.createdBy);
41904
+ value.createdBy = new ObjectId112(value.createdBy);
41601
41905
  } catch (error2) {
41602
41906
  throw new BadRequestError174("Invalid createdBy format");
41603
41907
  }
41604
41908
  }
41605
41909
  if (value?.route?._id) {
41606
41910
  try {
41607
- value.route._id = new ObjectId111(value.route._id);
41911
+ value.route._id = new ObjectId112(value.route._id);
41608
41912
  } catch (error2) {
41609
41913
  throw new BadRequestError174("Invalid route _id format");
41610
41914
  }
41611
41915
  }
41612
41916
  return {
41613
- _id: value._id ?? new ObjectId111(),
41917
+ _id: value._id ?? new ObjectId112(),
41614
41918
  site: value.site,
41615
41919
  route: value.route,
41616
41920
  date: value.date,
@@ -41632,7 +41936,7 @@ import {
41632
41936
  useAtlas as useAtlas96,
41633
41937
  useCache as useCache58
41634
41938
  } from "@7365admin1/node-server-utils";
41635
- import { ObjectId as ObjectId112 } from "mongodb";
41939
+ import { ObjectId as ObjectId113 } from "mongodb";
41636
41940
  function useNfcPatrolLogRepo() {
41637
41941
  const db = useAtlas96.getDb();
41638
41942
  if (!db) {
@@ -41685,7 +41989,7 @@ function useNfcPatrolLogRepo() {
41685
41989
  const pageIndex = page > 0 ? page - 1 : 0;
41686
41990
  let siteId;
41687
41991
  try {
41688
- siteId = typeof site === "string" ? new ObjectId112(site) : site;
41992
+ siteId = typeof site === "string" ? new ObjectId113(site) : site;
41689
41993
  } catch {
41690
41994
  throw new BadRequestError175("Invalid site ID format.");
41691
41995
  }
@@ -41696,7 +42000,7 @@ function useNfcPatrolLogRepo() {
41696
42000
  query.date = date;
41697
42001
  }
41698
42002
  if (route?._id) {
41699
- query["route._id"] = typeof route._id === "string" ? new ObjectId112(route._id) : route._id;
42003
+ query["route._id"] = typeof route._id === "string" ? new ObjectId113(route._id) : route._id;
41700
42004
  }
41701
42005
  if (route?.startTime) {
41702
42006
  query["route.startTime"] = route.startTime;
@@ -42568,7 +42872,7 @@ function useNewDashboardController() {
42568
42872
 
42569
42873
  // src/models/manpower-monitoring.model.ts
42570
42874
  import Joi111 from "joi";
42571
- import { ObjectId as ObjectId113 } from "mongodb";
42875
+ import { ObjectId as ObjectId114 } from "mongodb";
42572
42876
  var shiftSchema = Joi111.object({
42573
42877
  name: Joi111.string().required(),
42574
42878
  checkIn: Joi111.string().optional().allow("", null),
@@ -42593,7 +42897,7 @@ var manpowerMonitoringSchema = Joi111.object({
42593
42897
  });
42594
42898
  var MManpowerMonitoring = class {
42595
42899
  constructor(data) {
42596
- this._id = new ObjectId113();
42900
+ this._id = new ObjectId114();
42597
42901
  this.serviceProviderId = data.serviceProviderId || "";
42598
42902
  this.siteId = data.siteId || "";
42599
42903
  this.siteName = data.siteName;
@@ -43063,7 +43367,7 @@ var hrmlabs_attendance_util_default = {
43063
43367
  };
43064
43368
 
43065
43369
  // src/repositories/manpower-monitoring.repo.ts
43066
- import { ObjectId as ObjectId114 } from "mongodb";
43370
+ import { ObjectId as ObjectId115 } from "mongodb";
43067
43371
  var { hrmLabsAuthentication: hrmLabsAuthentication2, fetchSites: fetchSites2 } = hrmlabs_attendance_util_default;
43068
43372
  function useManpowerMonitoringRepo() {
43069
43373
  const db = useAtlas99.getDb();
@@ -43077,11 +43381,11 @@ function useManpowerMonitoringRepo() {
43077
43381
  try {
43078
43382
  value = new MManpowerMonitoring(value);
43079
43383
  if (value.createdBy)
43080
- value.createdBy = new ObjectId114(value.createdBy);
43384
+ value.createdBy = new ObjectId115(value.createdBy);
43081
43385
  if (value.siteId)
43082
- value.siteId = new ObjectId114(value.siteId);
43386
+ value.siteId = new ObjectId115(value.siteId);
43083
43387
  if (value.serviceProviderId)
43084
- value.serviceProviderId = new ObjectId114(value.serviceProviderId);
43388
+ value.serviceProviderId = new ObjectId115(value.serviceProviderId);
43085
43389
  const result = await collection.insertOne(value, { session });
43086
43390
  return result;
43087
43391
  } catch (error) {
@@ -43122,8 +43426,8 @@ function useManpowerMonitoringRepo() {
43122
43426
  }
43123
43427
  async function getManpowerSettingsBySiteId(_id, serviceProviderId) {
43124
43428
  try {
43125
- _id = new ObjectId114(_id);
43126
- serviceProviderId = new ObjectId114(serviceProviderId);
43429
+ _id = new ObjectId115(_id);
43430
+ serviceProviderId = new ObjectId115(serviceProviderId);
43127
43431
  } catch (error) {
43128
43432
  throw new Error("Invalid Site ID format.");
43129
43433
  }
@@ -43139,7 +43443,7 @@ function useManpowerMonitoringRepo() {
43139
43443
  }
43140
43444
  async function updateManpowerMonitoringSettings(_id, value) {
43141
43445
  try {
43142
- _id = new ObjectId114(_id);
43446
+ _id = new ObjectId115(_id);
43143
43447
  } catch (error) {
43144
43448
  throw new BadRequestError180("Invalid ID format.");
43145
43449
  }
@@ -43166,7 +43470,7 @@ function useManpowerMonitoringRepo() {
43166
43470
  for (let item of value) {
43167
43471
  item = new MManpowerMonitoring(item);
43168
43472
  const data = await collection.findOne({
43169
- siteId: new ObjectId114(item.siteId)
43473
+ siteId: new ObjectId115(item.siteId)
43170
43474
  });
43171
43475
  if (data) {
43172
43476
  let updateValue;
@@ -43191,11 +43495,11 @@ function useManpowerMonitoringRepo() {
43191
43495
  }
43192
43496
  } else {
43193
43497
  if (item.createdBy)
43194
- item.createdBy = new ObjectId114(item.createdBy);
43498
+ item.createdBy = new ObjectId115(item.createdBy);
43195
43499
  if (item.siteId)
43196
- item.siteId = new ObjectId114(item.siteId);
43500
+ item.siteId = new ObjectId115(item.siteId);
43197
43501
  if (item.serviceProviderId)
43198
- item.serviceProviderId = new ObjectId114(item.serviceProviderId);
43502
+ item.serviceProviderId = new ObjectId115(item.serviceProviderId);
43199
43503
  const result = await collection.insertOne(item);
43200
43504
  if (result.insertedId) {
43201
43505
  results.inserted++;
@@ -43219,7 +43523,7 @@ function useManpowerMonitoringRepo() {
43219
43523
  const siteUrl = process.env.HRMLABS_SITE_URL;
43220
43524
  try {
43221
43525
  const serviceProvider = await serviceProviderCollection.findOne({
43222
- _id: new ObjectId114(serviceProviderId)
43526
+ _id: new ObjectId115(serviceProviderId)
43223
43527
  });
43224
43528
  if (!serviceProvider) {
43225
43529
  throw new Error("Service Provider not found.");
@@ -43269,7 +43573,7 @@ import {
43269
43573
 
43270
43574
  // src/models/manpower-remarks.model.ts
43271
43575
  import Joi112 from "joi";
43272
- import { ObjectId as ObjectId115 } from "mongodb";
43576
+ import { ObjectId as ObjectId116 } from "mongodb";
43273
43577
  var remarksSchema = Joi112.object({
43274
43578
  name: Joi112.string().required(),
43275
43579
  remark: Joi112.object({
@@ -43293,7 +43597,7 @@ var manpowerRemarksSchema = Joi112.object({
43293
43597
  });
43294
43598
  var MManpowerRemarks = class {
43295
43599
  constructor(data) {
43296
- this._id = new ObjectId115();
43600
+ this._id = new ObjectId116();
43297
43601
  this.serviceProviderId = data.serviceProviderId || "";
43298
43602
  this.siteId = data.siteId || "";
43299
43603
  this.siteName = data.siteName || "";
@@ -43311,7 +43615,7 @@ var MManpowerRemarks = class {
43311
43615
  };
43312
43616
 
43313
43617
  // src/repositories/manpower-remarks.repo.ts
43314
- import { ObjectId as ObjectId116 } from "mongodb";
43618
+ import { ObjectId as ObjectId117 } from "mongodb";
43315
43619
  import moment2 from "moment-timezone";
43316
43620
  function useManpowerRemarksRepo() {
43317
43621
  const db = useAtlas100.getDb();
@@ -43324,9 +43628,9 @@ function useManpowerRemarksRepo() {
43324
43628
  try {
43325
43629
  value = new MManpowerRemarks(value);
43326
43630
  if (value.siteId)
43327
- value.siteId = new ObjectId116(value.siteId);
43631
+ value.siteId = new ObjectId117(value.siteId);
43328
43632
  if (value.serviceProviderId)
43329
- value.serviceProviderId = new ObjectId116(value.serviceProviderId);
43633
+ value.serviceProviderId = new ObjectId117(value.serviceProviderId);
43330
43634
  const result = await collection.insertOne(value, { session });
43331
43635
  return result;
43332
43636
  } catch (error) {
@@ -43346,7 +43650,7 @@ function useManpowerRemarksRepo() {
43346
43650
  limit = limit || 10;
43347
43651
  const searchQuery = {};
43348
43652
  const nowSGT = moment2().tz("Asia/Singapore");
43349
- searchQuery.serviceProviderId = new ObjectId116(serviceProviderId);
43653
+ searchQuery.serviceProviderId = new ObjectId117(serviceProviderId);
43350
43654
  if (search != "") {
43351
43655
  searchQuery.siteName = { $regex: search, $options: "i" };
43352
43656
  }
@@ -43378,8 +43682,8 @@ function useManpowerRemarksRepo() {
43378
43682
  }
43379
43683
  async function getManpowerRemarksBySiteId(_id, date, serviceProviderId) {
43380
43684
  try {
43381
- _id = new ObjectId116(_id);
43382
- serviceProviderId = new ObjectId116(serviceProviderId);
43685
+ _id = new ObjectId117(_id);
43686
+ serviceProviderId = new ObjectId117(serviceProviderId);
43383
43687
  } catch (error) {
43384
43688
  throw new Error("Invalid Site ID format.");
43385
43689
  }
@@ -43396,13 +43700,13 @@ function useManpowerRemarksRepo() {
43396
43700
  }
43397
43701
  async function updateManpowerRemarks(_id, value) {
43398
43702
  try {
43399
- _id = new ObjectId116(_id);
43703
+ _id = new ObjectId117(_id);
43400
43704
  } catch (error) {
43401
43705
  throw new BadRequestError181("Invalid ID format.");
43402
43706
  }
43403
43707
  try {
43404
43708
  if (value.createdBy) {
43405
- value.createdBy = new ObjectId116(value.createdBy);
43709
+ value.createdBy = new ObjectId117(value.createdBy);
43406
43710
  }
43407
43711
  const updateValue = {
43408
43712
  ...value,
@@ -43419,7 +43723,7 @@ function useManpowerRemarksRepo() {
43419
43723
  }
43420
43724
  async function updateRemarksStatus(_id, value) {
43421
43725
  try {
43422
- _id = new ObjectId116(_id);
43726
+ _id = new ObjectId117(_id);
43423
43727
  } catch (error) {
43424
43728
  throw new BadRequestError181("Invalid ID format.");
43425
43729
  }
@@ -43691,7 +43995,7 @@ function useManpowerMonitoringCtrl() {
43691
43995
 
43692
43996
  // src/models/manpower-designations.model.ts
43693
43997
  import Joi114 from "joi";
43694
- import { ObjectId as ObjectId117 } from "mongodb";
43998
+ import { ObjectId as ObjectId118 } from "mongodb";
43695
43999
  var designationsSchema = Joi114.object({
43696
44000
  title: Joi114.string().required(),
43697
44001
  shifts: Joi114.object({
@@ -43710,7 +44014,7 @@ var manpowerDesignationsSchema = Joi114.object({
43710
44014
  });
43711
44015
  var MManpowerDesignations = class {
43712
44016
  constructor(data) {
43713
- this._id = new ObjectId117();
44017
+ this._id = new ObjectId118();
43714
44018
  this.siteId = data.siteId || "";
43715
44019
  this.siteName = data.siteName || "";
43716
44020
  this.serviceProviderId = data.serviceProviderId || "";
@@ -43726,7 +44030,7 @@ var MManpowerDesignations = class {
43726
44030
  import {
43727
44031
  useAtlas as useAtlas102
43728
44032
  } from "@7365admin1/node-server-utils";
43729
- import { ObjectId as ObjectId118 } from "mongodb";
44033
+ import { ObjectId as ObjectId119 } from "mongodb";
43730
44034
  function useManpowerDesignationRepo() {
43731
44035
  const db = useAtlas102.getDb();
43732
44036
  if (!db) {
@@ -43738,11 +44042,11 @@ function useManpowerDesignationRepo() {
43738
44042
  try {
43739
44043
  value = new MManpowerDesignations(value);
43740
44044
  if (value.createdBy)
43741
- value.createdBy = new ObjectId118(value.createdBy);
44045
+ value.createdBy = new ObjectId119(value.createdBy);
43742
44046
  if (value.siteId)
43743
- value.siteId = new ObjectId118(value.siteId);
44047
+ value.siteId = new ObjectId119(value.siteId);
43744
44048
  if (value.serviceProviderId)
43745
- value.serviceProviderId = new ObjectId118(value.serviceProviderId);
44049
+ value.serviceProviderId = new ObjectId119(value.serviceProviderId);
43746
44050
  const result = await collection.insertOne(value);
43747
44051
  return result;
43748
44052
  } catch (error) {
@@ -43751,8 +44055,8 @@ function useManpowerDesignationRepo() {
43751
44055
  }
43752
44056
  async function getManpowerDesignationsBySiteId(_id, serviceProviderId) {
43753
44057
  try {
43754
- _id = new ObjectId118(_id);
43755
- serviceProviderId = new ObjectId118(serviceProviderId);
44058
+ _id = new ObjectId119(_id);
44059
+ serviceProviderId = new ObjectId119(serviceProviderId);
43756
44060
  } catch (error) {
43757
44061
  throw new Error("Invalid Site ID format.");
43758
44062
  }
@@ -43768,7 +44072,7 @@ function useManpowerDesignationRepo() {
43768
44072
  }
43769
44073
  async function updateManpowerDesignations(_id, value) {
43770
44074
  try {
43771
- _id = new ObjectId118(_id);
44075
+ _id = new ObjectId119(_id);
43772
44076
  } catch (error) {
43773
44077
  throw new Error("Invalid ID format.");
43774
44078
  }
@@ -43871,7 +44175,7 @@ function useManpowerDesignationCtrl() {
43871
44175
 
43872
44176
  // src/models/overnight-parking.model.ts
43873
44177
  import Joi116 from "joi";
43874
- import { ObjectId as ObjectId119 } from "mongodb";
44178
+ import { ObjectId as ObjectId120 } from "mongodb";
43875
44179
  var dayScheduleSchema = Joi116.object({
43876
44180
  isEnabled: Joi116.boolean().required(),
43877
44181
  startTime: Joi116.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().allow(null, "").messages({
@@ -43913,7 +44217,7 @@ function MOvernightParkingApprovalHours(value) {
43913
44217
  }
43914
44218
  if (value.site && typeof value.site === "string") {
43915
44219
  try {
43916
- value.site = new ObjectId119(value.site);
44220
+ value.site = new ObjectId120(value.site);
43917
44221
  } catch {
43918
44222
  throw new Error("Invalid site ID.");
43919
44223
  }
@@ -45537,7 +45841,7 @@ function useManpowerRemarkCtrl() {
45537
45841
 
45538
45842
  // src/models/manpower-sites.model.ts
45539
45843
  import Joi122 from "joi";
45540
- import { ObjectId as ObjectId120 } from "mongodb";
45844
+ import { ObjectId as ObjectId121 } from "mongodb";
45541
45845
  var manpowerSitesSchema = Joi122.object({
45542
45846
  id: Joi122.string().hex().required(),
45543
45847
  text: Joi122.string().hex().optional().allow("", null),
@@ -45548,7 +45852,7 @@ var manpowerSitesSchema = Joi122.object({
45548
45852
  });
45549
45853
  var MManpowerSites = class {
45550
45854
  constructor(data) {
45551
- this._id = new ObjectId120();
45855
+ this._id = new ObjectId121();
45552
45856
  this.id = data.id || "";
45553
45857
  this.text = data.text || "";
45554
45858
  this.contractID = data.contractID || "";
@@ -45770,7 +46074,7 @@ import {
45770
46074
  getDirectory as getDirectory3,
45771
46075
  logger as logger174
45772
46076
  } from "@7365admin1/node-server-utils";
45773
- import { ObjectId as ObjectId121 } from "mongodb";
46077
+ import { ObjectId as ObjectId122 } from "mongodb";
45774
46078
  import moment4 from "moment-timezone";
45775
46079
  var createManpowerRemarksDaily = async () => {
45776
46080
  const db = useAtlas108.getDb();
@@ -45930,7 +46234,7 @@ var updateRemarksisAcknowledged = async () => {
45930
46234
  for (const id of updatedIds) {
45931
46235
  const doc = await remarks.findOne({ _id: id });
45932
46236
  const setting = await settings.findOne(
45933
- { siteId: new ObjectId121(doc?.siteId) },
46237
+ { siteId: new ObjectId122(doc?.siteId) },
45934
46238
  { projection: { emails: 1 } }
45935
46239
  );
45936
46240
  const payload = {
@@ -46016,7 +46320,7 @@ var updateRemarksStatusEod = async () => {
46016
46320
  for (const doc of docs) {
46017
46321
  let shiftsToCheck = [];
46018
46322
  const endShiftTime = await settings.findOne(
46019
- { siteId: new ObjectId121(doc.siteId) },
46323
+ { siteId: new ObjectId122(doc.siteId) },
46020
46324
  { projection: { shifts: 1, shiftType: 1 } }
46021
46325
  );
46022
46326
  if (doc.createdAtSGT === nowSGT) {
@@ -46122,7 +46426,7 @@ var isWithinHour = (alertTime, timeNow) => {
46122
46426
 
46123
46427
  // src/events/manpower.event.ts
46124
46428
  import { useAtlas as useAtlas109 } from "@7365admin1/node-server-utils";
46125
- import { ObjectId as ObjectId122 } from "mongodb";
46429
+ import { ObjectId as ObjectId123 } from "mongodb";
46126
46430
  import moment5 from "moment-timezone";
46127
46431
  async function manpowerEvents(io) {
46128
46432
  let intervalId = null;
@@ -46148,7 +46452,7 @@ async function manpowerEvents(io) {
46148
46452
  }).toArray();
46149
46453
  for (const doc of docs) {
46150
46454
  const siteSettings = await settings.findOne(
46151
- { siteId: new ObjectId122(doc.siteId), enabled: true },
46455
+ { siteId: new ObjectId123(doc.siteId), enabled: true },
46152
46456
  { projection: { shifts: 1, shiftType: 1 } }
46153
46457
  );
46154
46458
  const shiftType = siteSettings?.shiftType || "2-shifts";
@@ -46267,7 +46571,7 @@ function genericSignature(params, secretKey) {
46267
46571
  }
46268
46572
 
46269
46573
  // src/repositories/reddot-payment.repository.ts
46270
- import { ObjectId as ObjectId126 } from "mongodb";
46574
+ import { ObjectId as ObjectId127 } from "mongodb";
46271
46575
 
46272
46576
  // src/utils/date-format.util.ts
46273
46577
  import moment6 from "moment-timezone";
@@ -46292,11 +46596,11 @@ function formatDateString(today, format, dateRange) {
46292
46596
  }
46293
46597
 
46294
46598
  // src/models/credit-card.model.ts
46295
- import { ObjectId as ObjectId123 } from "mongodb";
46599
+ import { ObjectId as ObjectId124 } from "mongodb";
46296
46600
  var MCardInfo = class {
46297
46601
  // this is coming from RDP transaction
46298
46602
  constructor({
46299
- _id = new ObjectId123(),
46603
+ _id = new ObjectId124(),
46300
46604
  userId,
46301
46605
  cardType,
46302
46606
  cardNumber,
@@ -46331,11 +46635,11 @@ var MCardInfo = class {
46331
46635
  };
46332
46636
 
46333
46637
  // src/models/cart.model.ts
46334
- import { ObjectId as ObjectId124 } from "mongodb";
46638
+ import { ObjectId as ObjectId125 } from "mongodb";
46335
46639
  var MUnitBillings = class {
46336
46640
  // transaction response messages
46337
46641
  constructor({
46338
- _id = new ObjectId124(),
46642
+ _id = new ObjectId125(),
46339
46643
  unit,
46340
46644
  unitId,
46341
46645
  unitBill,
@@ -46376,7 +46680,7 @@ var MUnitBillings = class {
46376
46680
  };
46377
46681
 
46378
46682
  // src/repositories/payment.repository.ts
46379
- import { ObjectId as ObjectId125 } from "mongodb";
46683
+ import { ObjectId as ObjectId126 } from "mongodb";
46380
46684
  import {
46381
46685
  InternalServerError as InternalServerError66,
46382
46686
  useAtlas as useAtlas110
@@ -46413,7 +46717,7 @@ var PaymentBillRepo = () => {
46413
46717
  if (unitBillInfo?.status === "Inactive" /* inactive */) {
46414
46718
  throw new Error("This Bill is Inactive!");
46415
46719
  }
46416
- const billId = new ObjectId125(unitBillInfo?.billId);
46720
+ const billId = new ObjectId126(unitBillInfo?.billId);
46417
46721
  const billInfo = await billCollection().findOne({ _id: billId });
46418
46722
  if (!billInfo) {
46419
46723
  throw new Error("Bill info not found");
@@ -46452,13 +46756,13 @@ var PaymentBillRepo = () => {
46452
46756
  const saveCreditCardInfo = async (payload) => {
46453
46757
  try {
46454
46758
  if (payload.userId)
46455
- payload.userId = new ObjectId125(payload.userId);
46759
+ payload.userId = new ObjectId126(payload.userId);
46456
46760
  if (payload.site)
46457
- payload.site = new ObjectId125(payload.site);
46761
+ payload.site = new ObjectId126(payload.site);
46458
46762
  if (payload.organization)
46459
- payload.organization = new ObjectId125(payload.organization);
46763
+ payload.organization = new ObjectId126(payload.organization);
46460
46764
  if (payload.createdBy)
46461
- payload.createdBy = new ObjectId125(payload.createdBy);
46765
+ payload.createdBy = new ObjectId126(payload.createdBy);
46462
46766
  const createdAt = formatDateString(/* @__PURE__ */ new Date(), "mm-dd-yyyy");
46463
46767
  payload.createdAt = createdAt;
46464
46768
  const result = await creditCollection().insertOne(new MCardInfo(payload));
@@ -46470,19 +46774,19 @@ var PaymentBillRepo = () => {
46470
46774
  const checkOutUnitBills = async (payload) => {
46471
46775
  try {
46472
46776
  if (payload.unitId)
46473
- payload.unitId = new ObjectId125(payload.unitId);
46777
+ payload.unitId = new ObjectId126(payload.unitId);
46474
46778
  if (payload.site)
46475
- payload.site = new ObjectId125(payload.site);
46779
+ payload.site = new ObjectId126(payload.site);
46476
46780
  if (payload.organization)
46477
- payload.organization = new ObjectId125(payload.organization);
46781
+ payload.organization = new ObjectId126(payload.organization);
46478
46782
  payload.createdAt = await formatDateString(/* @__PURE__ */ new Date(), "mm-dd-yyyy");
46479
46783
  const addToCart = await cartCollection().insertOne(new MUnitBillings(payload));
46480
46784
  const unitId = payload.unitId;
46481
46785
  const dateFormatted = formatDateString(/* @__PURE__ */ new Date(), "for-ref");
46482
46786
  const unit = unitId?.toString().slice(-4);
46483
- const newId = new ObjectId125(addToCart?.insertedId).toString().slice(-4);
46787
+ const newId = new ObjectId126(addToCart?.insertedId).toString().slice(-4);
46484
46788
  const referenceNumber = `CRT${unit}${newId}${dateFormatted}`;
46485
- const result = await cartCollection().findOneAndUpdate({ _id: new ObjectId125(addToCart.insertedId) }, { $set: { referenceNumber } }, { returnDocument: "after" });
46789
+ const result = await cartCollection().findOneAndUpdate({ _id: new ObjectId126(addToCart.insertedId) }, { $set: { referenceNumber } }, { returnDocument: "after" });
46486
46790
  return result;
46487
46791
  } catch (error) {
46488
46792
  throw new Error(error.message || error || "Server Internal Error");
@@ -46513,7 +46817,7 @@ var PaymentBillRepo = () => {
46513
46817
  for (const ref of refNumber) {
46514
46818
  const unitBillInfo = await collection().findOne({ referenceNumber: ref });
46515
46819
  const billId = unitBillInfo?.billId;
46516
- const billInfo = await billCollection().findOne({ _id: new ObjectId125(billId) });
46820
+ const billInfo = await billCollection().findOne({ _id: new ObjectId126(billId) });
46517
46821
  const billAmount = billInfo?.price;
46518
46822
  payload.updatedAt = updatedAt;
46519
46823
  payload.amountPaid = billAmount;
@@ -46667,7 +46971,7 @@ var useRedDotPaymentRepo = () => {
46667
46971
  throw new Error("Failed to Add Merchant Details");
46668
46972
  }
46669
46973
  const merchantId = merchant?.insertedId;
46670
- const orgId = new ObjectId126(_id);
46974
+ const orgId = new ObjectId127(_id);
46671
46975
  const result = await orgCollection().findOneAndUpdate({ _id: orgId }, { $push: { merchant: merchantId } }, {
46672
46976
  returnDocument: "after"
46673
46977
  });
@@ -46696,7 +47000,7 @@ var useRedDotPaymentRepo = () => {
46696
47000
  const getMerchantDetailsById = async (_id) => {
46697
47001
  try {
46698
47002
  if (_id)
46699
- _id = new ObjectId126(_id);
47003
+ _id = new ObjectId127(_id);
46700
47004
  const result = await redDotMerchantCollection().aggregate([
46701
47005
  {
46702
47006
  $match: {
@@ -46960,7 +47264,7 @@ import {
46960
47264
  useAtlas as useAtlas112,
46961
47265
  useCache as useCache66
46962
47266
  } from "@7365admin1/node-server-utils";
46963
- import { ObjectId as ObjectId127 } from "mongodb";
47267
+ import { ObjectId as ObjectId128 } from "mongodb";
46964
47268
  function useVerificationRepoV2() {
46965
47269
  const db = useAtlas112.getDb();
46966
47270
  if (!db) {
@@ -47013,7 +47317,7 @@ function useVerificationRepoV2() {
47013
47317
  }
47014
47318
  async function updateVerificationStatusById(_id, status, session) {
47015
47319
  try {
47016
- _id = new ObjectId127(_id);
47320
+ _id = new ObjectId128(_id);
47017
47321
  } catch (error) {
47018
47322
  throw new BadRequestError195("Invalid verification ID format.");
47019
47323
  }
@@ -47156,7 +47460,7 @@ function useVerificationRepoV2() {
47156
47460
  }
47157
47461
  async function updateStatusById(_id, status, session) {
47158
47462
  try {
47159
- _id = new ObjectId127(_id);
47463
+ _id = new ObjectId128(_id);
47160
47464
  } catch (error) {
47161
47465
  throw new BadRequestError195("Invalid verification ID format.");
47162
47466
  }
@@ -47758,7 +48062,7 @@ import {
47758
48062
  import { v4 as uuidv42 } from "uuid";
47759
48063
 
47760
48064
  // src/repositories/user-v2.repo.ts
47761
- import { ObjectId as ObjectId128 } from "mongodb";
48065
+ import { ObjectId as ObjectId129 } from "mongodb";
47762
48066
  import {
47763
48067
  useAtlas as useAtlas114,
47764
48068
  InternalServerError as InternalServerError70,
@@ -47970,7 +48274,7 @@ function useUserRepoV2() {
47970
48274
  }
47971
48275
  if (organization) {
47972
48276
  try {
47973
- query.defaultOrg = new ObjectId128(organization);
48277
+ query.defaultOrg = new ObjectId129(organization);
47974
48278
  cacheOptions.organization = organization.toString();
47975
48279
  } catch (error) {
47976
48280
  throw new BadRequestError198("Invalid organization ID format.");
@@ -48109,13 +48413,13 @@ function useUserRepoV2() {
48109
48413
  );
48110
48414
  }
48111
48415
  try {
48112
- _id = new ObjectId128(_id);
48416
+ _id = new ObjectId129(_id);
48113
48417
  } catch (error) {
48114
48418
  throw new BadRequestError198("Invalid ID.");
48115
48419
  }
48116
48420
  if (field === "defaultOrg") {
48117
48421
  try {
48118
- value = new ObjectId128(value);
48422
+ value = new ObjectId129(value);
48119
48423
  } catch (error) {
48120
48424
  throw new BadRequestError198("Invalid organization ID.");
48121
48425
  }
@@ -48156,7 +48460,7 @@ function useUserRepoV2() {
48156
48460
  year
48157
48461
  }, session) {
48158
48462
  try {
48159
- _id = new ObjectId128(_id);
48463
+ _id = new ObjectId129(_id);
48160
48464
  } catch (error) {
48161
48465
  throw new BadRequestError198("Invalid user ID format.");
48162
48466
  }
@@ -48186,7 +48490,7 @@ function useUserRepoV2() {
48186
48490
  }
48187
48491
  async function updatePassword({ _id, password }, session) {
48188
48492
  try {
48189
- _id = new ObjectId128(_id);
48493
+ _id = new ObjectId129(_id);
48190
48494
  } catch (error) {
48191
48495
  throw new BadRequestError198("Invalid user ID format.");
48192
48496
  }
@@ -49040,6 +49344,7 @@ export {
49040
49344
  remarksSchema,
49041
49345
  robotSchema,
49042
49346
  schema,
49347
+ schemaApprovedBy,
49043
49348
  schemaBilling,
49044
49349
  schemaBillingConfiguration,
49045
49350
  schemaBillingItem,