@7365admin1/core 3.13.0 → 3.15.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
@@ -537,13 +537,13 @@ var require_logger = __commonJS({
537
537
  "use strict";
538
538
  exports.__esModule = true;
539
539
  var _utils = require_utils();
540
- var logger200 = {
540
+ var logger201 = {
541
541
  methodMap: ["debug", "info", "warn", "error"],
542
542
  level: "info",
543
543
  // Maps a given level value to the `methodMap` indexes above.
544
544
  lookupLevel: function lookupLevel(level) {
545
545
  if (typeof level === "string") {
546
- var levelMap = _utils.indexOf(logger200.methodMap, level.toLowerCase());
546
+ var levelMap = _utils.indexOf(logger201.methodMap, level.toLowerCase());
547
547
  if (levelMap >= 0) {
548
548
  level = levelMap;
549
549
  } else {
@@ -554,9 +554,9 @@ var require_logger = __commonJS({
554
554
  },
555
555
  // Can be overridden in the host environment
556
556
  log: function log(level) {
557
- level = logger200.lookupLevel(level);
558
- if (typeof console !== "undefined" && logger200.lookupLevel(logger200.level) <= level) {
559
- var method = logger200.methodMap[level];
557
+ level = logger201.lookupLevel(level);
558
+ if (typeof console !== "undefined" && logger201.lookupLevel(logger201.level) <= level) {
559
+ var method = logger201.methodMap[level];
560
560
  if (!console[method]) {
561
561
  method = "log";
562
562
  }
@@ -567,7 +567,7 @@ var require_logger = __commonJS({
567
567
  }
568
568
  }
569
569
  };
570
- exports["default"] = logger200;
570
+ exports["default"] = logger201;
571
571
  module.exports = exports["default"];
572
572
  }
573
573
  });
@@ -8280,12 +8280,6 @@ function useUserRepo() {
8280
8280
  throw new BadRequestError9("Invalid user ID format.");
8281
8281
  }
8282
8282
  try {
8283
- const cacheKey = makeCacheKey5(namespace_collection, { _id });
8284
- const cachedData = await getCache(cacheKey);
8285
- if (cachedData) {
8286
- logger7.info(`Cache hit for key: ${cacheKey}`);
8287
- return cachedData;
8288
- }
8289
8283
  const results = await collection.aggregate([
8290
8284
  { $match: { _id } },
8291
8285
  {
@@ -8309,17 +8303,42 @@ function useUserRepo() {
8309
8303
  ],
8310
8304
  as: "serviceProviders"
8311
8305
  }
8312
- }
8306
+ },
8307
+ {
8308
+ $lookup: {
8309
+ from: "buildings",
8310
+ localField: "block",
8311
+ foreignField: "_id",
8312
+ pipeline: [{ $project: { _id: 0, name: 1, block: 1 } }],
8313
+ as: "blockInfo"
8314
+ }
8315
+ },
8316
+ { $unwind: { path: "$blockInfo", preserveNullAndEmptyArrays: true } },
8317
+ {
8318
+ $lookup: {
8319
+ from: "building-levels",
8320
+ localField: "level",
8321
+ foreignField: "_id",
8322
+ pipeline: [{ $project: { _id: 0, name: 1 } }],
8323
+ as: "levelInfo"
8324
+ }
8325
+ },
8326
+ { $unwind: { path: "$levelInfo", preserveNullAndEmptyArrays: true } },
8327
+ {
8328
+ $lookup: {
8329
+ from: "building-units",
8330
+ localField: "unitId",
8331
+ foreignField: "_id",
8332
+ pipeline: [{ $project: { _id: 0, name: 1 } }],
8333
+ as: "unitInfo"
8334
+ }
8335
+ },
8336
+ { $unwind: { path: "$unitInfo", preserveNullAndEmptyArrays: true } }
8313
8337
  ]).toArray();
8314
8338
  const data = results.length > 0 ? results[0] : null;
8315
8339
  if (!data) {
8316
8340
  throw new NotFoundError4("User not found.");
8317
8341
  }
8318
- setCache(cacheKey, data, 15 * 60).then(() => {
8319
- logger7.info(`Cache set for key: ${cacheKey}`);
8320
- }).catch((err) => {
8321
- logger7.error(`Failed to set cache for key: ${cacheKey}`, err);
8322
- });
8323
8342
  return data;
8324
8343
  } catch (error) {
8325
8344
  if (error instanceof AppError) {
@@ -8716,6 +8735,7 @@ var APP_POOL_MAINTENANCE = process.env.APP_POOL_MAINTENANCE ?? "http://localhost
8716
8735
  var ENCRYPTION_KEY = process.env.ENCRYPTION_KEY ?? "";
8717
8736
  var DOMAIN = process.env.DOMAIN ?? "localhost";
8718
8737
  var OPEN_AI_API_KEY = process.env.OPEN_AI_API_KEY;
8738
+ var ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
8719
8739
  var STORAGE_API = process.env.STORAGE_API;
8720
8740
 
8721
8741
  // src/services/auth.service.ts
@@ -9216,59 +9236,41 @@ function useMemberRepo() {
9216
9236
  try {
9217
9237
  const items = await collection.aggregate([
9218
9238
  { $match: query },
9219
- { $sort: { _id: -1 } },
9220
- { $skip: page * limit },
9221
- { $limit: limit },
9222
- {
9223
- $lookup: {
9224
- from: "organizations",
9225
- localField: "org",
9226
- foreignField: "_id",
9227
- as: "orgData"
9228
- }
9229
- },
9230
- {
9231
- $unwind: {
9232
- path: "$orgData",
9233
- preserveNullAndEmptyArrays: true
9234
- }
9235
- },
9236
9239
  {
9237
9240
  $lookup: {
9238
9241
  from: "organizations",
9239
9242
  localField: "org",
9240
9243
  foreignField: "_id",
9241
- as: "defaultSite"
9244
+ as: "org"
9242
9245
  }
9243
9246
  },
9244
9247
  {
9245
9248
  $unwind: {
9246
- path: "$defaultSite",
9249
+ path: "$org",
9247
9250
  preserveNullAndEmptyArrays: true
9248
9251
  }
9249
9252
  },
9250
9253
  {
9251
9254
  $group: {
9252
- _id: "$org",
9253
- text: { $first: "$orgName" },
9254
- value: { $first: "$org" },
9255
- defaultSite: { $first: "$defaultSite.defaultSite" },
9256
- onboardingRequired: {
9257
- $first: "$orgData.onboardingRequired"
9258
- },
9259
- onboardingCompleted: {
9260
- $first: "$orgData.onboardingCompleted"
9261
- },
9262
- onboardingCompletedAt: {
9263
- $first: "$orgData.onboardingCompletedAt"
9264
- }
9255
+ _id: "$org._id",
9256
+ text: { $first: "$org.name" },
9257
+ value: { $first: "$org._id" },
9258
+ type: { $first: "$org.type" },
9259
+ defaultSite: { $first: "$org.defaultSite" },
9260
+ onboardingRequired: { $first: "$org.onboardingRequired" },
9261
+ onboardingCompleted: { $first: "$org.onboardingCompleted" },
9262
+ onboardingCompletedAt: { $first: "$org.onboardingCompletedAt" }
9265
9263
  }
9266
9264
  },
9265
+ { $sort: { _id: -1 } },
9266
+ { $skip: page * limit },
9267
+ { $limit: limit },
9267
9268
  {
9268
9269
  $project: {
9269
9270
  _id: 0,
9270
9271
  text: 1,
9271
9272
  value: 1,
9273
+ type: 1,
9272
9274
  defaultSite: 1,
9273
9275
  onboardingRequired: 1,
9274
9276
  onboardingCompleted: 1,
@@ -11159,21 +11161,10 @@ function useSiteRepo() {
11159
11161
  throw new BadRequestError18("Invalid site ID format.");
11160
11162
  }
11161
11163
  try {
11162
- const cacheKey = makeCacheKey9(namespace_collection, { _id });
11163
- const cachedData = await getCache(cacheKey);
11164
- if (cachedData) {
11165
- logger12.info(`Cache hit for key: ${cacheKey}`);
11166
- return cachedData;
11167
- }
11168
11164
  const data = await collection.aggregate([{ $match: { _id, status: { $ne: "deleted" } } }]).toArray();
11169
11165
  if (!data || !data.length) {
11170
11166
  throw new NotFoundError8("Site not found.");
11171
11167
  }
11172
- setCache(cacheKey, data[0], 15 * 60).then(() => {
11173
- logger12.info(`Cache set for key: ${cacheKey}`);
11174
- }).catch((err) => {
11175
- logger12.error(`Failed to set cache for key: ${cacheKey}`, err);
11176
- });
11177
11168
  return data[0];
11178
11169
  } catch (error) {
11179
11170
  throw error;
@@ -25614,6 +25605,22 @@ function useBuildingUnitRepo() {
25614
25605
  }
25615
25606
  return [level];
25616
25607
  }
25608
+ function escapeRegExp(value) {
25609
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
25610
+ }
25611
+ function makeFlexibleRegex(value) {
25612
+ const pattern = value.trim().split(/\s+/).map(escapeRegExp).join("\\s*");
25613
+ return pattern ? new RegExp(pattern, "i") : null;
25614
+ }
25615
+ function getSearchParts(searchText) {
25616
+ const levelMatch = searchText.match(/\b(?:lvl|level)\s*([a-z0-9]+)\b/i);
25617
+ const levelSearch = levelMatch?.[0] ?? "";
25618
+ const unitSearch = levelSearch ? searchText.replace(levelSearch, "").trim() : "";
25619
+ return {
25620
+ levelRegex: makeFlexibleRegex(levelSearch),
25621
+ unitRegex: makeFlexibleRegex(unitSearch)
25622
+ };
25623
+ }
25617
25624
  async function add(value, session) {
25618
25625
  try {
25619
25626
  value = MBuildingUnit(value);
@@ -25739,9 +25746,11 @@ function useBuildingUnitRepo() {
25739
25746
  status = "active"
25740
25747
  } = {}) {
25741
25748
  page = page > 0 ? page - 1 : 0;
25749
+ const searchText = search.trim();
25750
+ const searchRegex = makeFlexibleRegex(searchText);
25751
+ const { levelRegex, unitRegex } = getSearchParts(searchText);
25742
25752
  const query = {
25743
25753
  status,
25744
- ...search && { $text: { $search: search } },
25745
25754
  ...site && { site: toObjectId11(site) },
25746
25755
  ...building && { building: toObjectId11(building) }
25747
25756
  };
@@ -25750,7 +25759,7 @@ function useBuildingUnitRepo() {
25750
25759
  page,
25751
25760
  limit,
25752
25761
  sort: JSON.stringify(sort),
25753
- ...search && { search },
25762
+ ...searchText && { search: searchText },
25754
25763
  ...site && { site },
25755
25764
  ...building && { building },
25756
25765
  ...status && { status }
@@ -25772,8 +25781,45 @@ function useBuildingUnitRepo() {
25772
25781
  });
25773
25782
  return cached;
25774
25783
  }
25775
- const items = await collection.aggregate([
25784
+ const pipeline = [
25776
25785
  { $match: query },
25786
+ {
25787
+ $lookup: {
25788
+ from: "building-levels",
25789
+ localField: "level",
25790
+ foreignField: "_id",
25791
+ pipeline: [{ $project: { name: 1 } }],
25792
+ as: "level"
25793
+ }
25794
+ },
25795
+ { $set: { level: { $first: "$level" } } },
25796
+ ...searchRegex ? [
25797
+ {
25798
+ $match: {
25799
+ $or: [
25800
+ { name: searchRegex },
25801
+ { buildingName: searchRegex },
25802
+ { "level.name": searchRegex },
25803
+ ...levelRegex && unitRegex ? [
25804
+ {
25805
+ $and: [
25806
+ {
25807
+ $or: [
25808
+ { name: unitRegex },
25809
+ { buildingName: unitRegex }
25810
+ ]
25811
+ },
25812
+ { "level.name": levelRegex }
25813
+ ]
25814
+ }
25815
+ ] : []
25816
+ ]
25817
+ }
25818
+ }
25819
+ ] : []
25820
+ ];
25821
+ const items = await collection.aggregate([
25822
+ ...pipeline,
25777
25823
  {
25778
25824
  $lookup: {
25779
25825
  from: "sites",
@@ -25799,22 +25845,13 @@ function useBuildingUnitRepo() {
25799
25845
  as: "site"
25800
25846
  }
25801
25847
  },
25802
- {
25803
- $lookup: {
25804
- from: "building-levels",
25805
- localField: "level",
25806
- foreignField: "_id",
25807
- pipeline: [{ $project: { name: 1 } }],
25808
- as: "level"
25809
- }
25810
- },
25811
- { $set: { level: { $first: "$level" } } },
25812
25848
  { $set: { site: { $first: "$site" } } },
25813
25849
  { $sort: sort },
25814
25850
  { $skip: page * limit },
25815
25851
  { $limit: limit }
25816
25852
  ]).toArray();
25817
- const length = await collection.countDocuments(query);
25853
+ const total = await collection.aggregate([...pipeline, { $count: "length" }]).toArray();
25854
+ const length = total[0]?.length ?? 0;
25818
25855
  const data = paginate21(items, page, limit, length);
25819
25856
  setCache(cacheKey, data, 600).then(() => {
25820
25857
  logger54.log({
@@ -27917,6 +27954,7 @@ function useBuildingRepo() {
27917
27954
  { key: { name: "text" }, name: "text-index" },
27918
27955
  // { key: { name: 1 }, unique: true, name: "unique-name-index" },
27919
27956
  { key: { site: 1 } },
27957
+ { key: { block: 1 }, name: "block-index" },
27920
27958
  { key: { createdAt: 1 } },
27921
27959
  {
27922
27960
  key: { site: 1, block: 1 },
@@ -28019,17 +28057,25 @@ function useBuildingRepo() {
28019
28057
  throw new BadRequestError80("Invalid site ID.");
28020
28058
  }
28021
28059
  }
28060
+ const searchText = search.trim();
28061
+ const blockSearch = Number(searchText);
28062
+ const canSearchBlock = searchText !== "" && Number.isFinite(blockSearch);
28022
28063
  const query = {
28023
28064
  status,
28024
- ...search && { $text: { $search: search } },
28025
- ...siteId && { site: siteId }
28065
+ ...siteId && { site: siteId },
28066
+ ...searchText && {
28067
+ $or: [
28068
+ { $text: { $search: searchText } },
28069
+ ...canSearchBlock ? [{ block: blockSearch }] : []
28070
+ ]
28071
+ }
28026
28072
  };
28027
28073
  sort = Object.keys(sort).length ? sort : { _id: -1 };
28028
28074
  const cacheParams = {
28029
28075
  page,
28030
28076
  limit,
28031
28077
  sort: JSON.stringify(sort),
28032
- ...search && { search },
28078
+ ...searchText && { search: searchText },
28033
28079
  ...site && { site },
28034
28080
  ...status && { status }
28035
28081
  };
@@ -29810,6 +29856,24 @@ function useBuildingUnitController() {
29810
29856
  getAllLevelsWithUnits: _getAllLevelsWithUnits
29811
29857
  } = useBuildingUnitRepo();
29812
29858
  const { add: _add, updateById: _updateById } = useBuildingUnitService();
29859
+ function normalizeQueryString(value) {
29860
+ if (Array.isArray(value)) {
29861
+ for (const item of value) {
29862
+ const normalized = normalizeQueryString(item);
29863
+ if (normalized)
29864
+ return normalized;
29865
+ }
29866
+ return "";
29867
+ }
29868
+ if (value && typeof value === "object") {
29869
+ for (const item of Object.values(value)) {
29870
+ const normalized = normalizeQueryString(item);
29871
+ if (normalized)
29872
+ return normalized;
29873
+ }
29874
+ }
29875
+ return typeof value === "string" ? value : "";
29876
+ }
29813
29877
  async function add(req, res, next) {
29814
29878
  const data = req.body;
29815
29879
  const validation = Joi47.object({
@@ -29883,7 +29947,11 @@ function useBuildingUnitController() {
29883
29947
  sort: Joi47.string().valid(...Object.values(SortFields)).default("_id" /* ID */),
29884
29948
  order: Joi47.string().valid(...Object.values(SortOrder)).default("asc" /* ASC */)
29885
29949
  });
29886
- const { error, value } = validation.validate(req.query, {
29950
+ const query = {
29951
+ ...req.query,
29952
+ search: normalizeQueryString(req.query.search)
29953
+ };
29954
+ const { error, value } = validation.validate(query, {
29887
29955
  abortEarly: false
29888
29956
  });
29889
29957
  if (error) {
@@ -30044,7 +30112,11 @@ function useBuildingUnitController() {
30044
30112
  order: Joi47.string().valid(...Object.values(SortOrder)).default("asc" /* ASC */),
30045
30113
  level: Joi47.string().hex().length(24).optional().allow(null, "")
30046
30114
  });
30047
- const { error, value } = validation.validate(req.query, {
30115
+ const query = {
30116
+ ...req.query,
30117
+ search: normalizeQueryString(req.query.search)
30118
+ };
30119
+ const { error, value } = validation.validate(query, {
30048
30120
  abortEarly: false
30049
30121
  });
30050
30122
  if (error) {
@@ -45300,6 +45372,31 @@ async function getTransactions(index, url) {
45300
45372
  return Promise.reject(error);
45301
45373
  }
45302
45374
  }
45375
+ function encryptPayload(payloadHex) {
45376
+ const buffer = Buffer.from(payloadHex, "ascii");
45377
+ const encrypted = crypto.publicEncrypt(
45378
+ {
45379
+ key: "testing",
45380
+ padding: crypto.constants.RSA_PKCS1_PADDING
45381
+ },
45382
+ buffer
45383
+ );
45384
+ return encrypted.toString("base64");
45385
+ }
45386
+ function toHex(num, length) {
45387
+ return num.toString(16).padStart(length * 2, "0");
45388
+ }
45389
+ function buildPayload(cardNumber, validityMinutes) {
45390
+ const randomHex = crypto.randomBytes(2).toString("hex");
45391
+ const cardHex = toHex(cardNumber, 4);
45392
+ const epochHex = toHex(Math.floor(Date.now() / 1e3), 4);
45393
+ const validityHex = toHex(validityMinutes, 2);
45394
+ return randomHex + cardHex + epochHex + validityHex;
45395
+ }
45396
+ function generateQrCodeData(cardNumber, validityMinutes) {
45397
+ const payloadHex = buildPayload(cardNumber, validityMinutes);
45398
+ return encryptPayload(payloadHex);
45399
+ }
45303
45400
 
45304
45401
  // src/repositories/access-management.repo.ts
45305
45402
  import { parseStringPromise as parseStringPromise2 } from "xml2js";
@@ -48549,6 +48646,14 @@ function useAccessManagementSvc() {
48549
48646
  throw new Error(err.message);
48550
48647
  }
48551
48648
  };
48649
+ const generateQrCodeWithExpirySvc = async ({ cardNumber, validityMinutes }) => {
48650
+ try {
48651
+ const response = generateQrCodeData(cardNumber, validityMinutes);
48652
+ return response;
48653
+ } catch (error) {
48654
+ throw new Error(error.message);
48655
+ }
48656
+ };
48552
48657
  return {
48553
48658
  addPhysicalCardSvc,
48554
48659
  addNonPhysicalCardSvc,
@@ -48591,7 +48696,8 @@ function useAccessManagementSvc() {
48591
48696
  getResidentsSvc,
48592
48697
  userAccessCardsSvc,
48593
48698
  removeTemplateSvc,
48594
- qrCodeListSvc
48699
+ qrCodeListSvc,
48700
+ generateQrCodeWithExpirySvc
48595
48701
  };
48596
48702
  }
48597
48703
 
@@ -48639,7 +48745,8 @@ function useAccessManagementController() {
48639
48745
  getResidentsSvc,
48640
48746
  userAccessCardsSvc,
48641
48747
  removeTemplateSvc,
48642
- qrCodeListSvc
48748
+ qrCodeListSvc,
48749
+ generateQrCodeWithExpirySvc
48643
48750
  } = useAccessManagementSvc();
48644
48751
  const addPhysicalCard = async (req, res) => {
48645
48752
  try {
@@ -49751,6 +49858,23 @@ function useAccessManagementController() {
49751
49858
  });
49752
49859
  }
49753
49860
  };
49861
+ const generateQrCodeWithExpiry = async (req, res) => {
49862
+ try {
49863
+ const { cardNumber, validityMinutes } = req.body;
49864
+ const result = await generateQrCodeWithExpirySvc({ cardNumber, validityMinutes });
49865
+ return res.status(200).json({
49866
+ message: "successful!",
49867
+ data: {
49868
+ result
49869
+ }
49870
+ });
49871
+ } catch (error) {
49872
+ return res.status(400).json({
49873
+ data: null,
49874
+ message: error.message
49875
+ });
49876
+ }
49877
+ };
49754
49878
  return {
49755
49879
  addPhysicalCard,
49756
49880
  addNonPhysicalCard,
@@ -49791,7 +49915,8 @@ function useAccessManagementController() {
49791
49915
  getResidents,
49792
49916
  userAccessCards,
49793
49917
  removeTemplate,
49794
- qrCodeList
49918
+ qrCodeList,
49919
+ generateQrCodeWithExpiry
49795
49920
  };
49796
49921
  }
49797
49922
 
@@ -54671,7 +54796,7 @@ function useIncidentReportRepo() {
54671
54796
  }
54672
54797
 
54673
54798
  // src/services/incident-report.service.ts
54674
- import OpenAI from "openai";
54799
+ import Anthropic from "@anthropic-ai/sdk";
54675
54800
  function useIncidentReportService() {
54676
54801
  const {
54677
54802
  add: _add,
@@ -54764,20 +54889,12 @@ function useIncidentReportService() {
54764
54889
  }
54765
54890
  }
54766
54891
  async function createIncidentSummary(value) {
54767
- const session = useAtlas91.getClient()?.startSession();
54768
- session?.startTransaction();
54769
54892
  const sample = `On August 4, 2024, an incident report labeled IR10 was submitted following an earthquake that occurred between 10:00 AM and 10:30 AM at a designated test site. The report indicated that the incident was reported by a complainant named Maryam, who provided her contact information as +65-123456789. The recipient of the complaint was Rash, whose contact number is +65-987654321. The description of the complaint detailed a historical context regarding the origins of Lorem Ipsum text, an academic piece that has been referenced throughout centuries.
54770
- ' +
54771
- '
54772
- ' +
54773
- 'The report highlighted that no individuals were directly affected or injured in the incident. However, there was damage to property associated with the incident, particularly mentioning an individual named Ruzzy, with contact +65-34567777889, who experienced property damage. The report states that this damage was also elaborated upon with historical context, reiterating similar pieces of information on the classical literature that influenced the Lorem Ipsum narrative.
54774
- ' +
54775
- '
54776
- ' +
54777
- "No authorities were called, and the incident's resolution was marked at 11:00 AM, with actions taken by Ola, the shift in charge during the incident. The management was informed of the incident at 10:08 AM, and security implications were considered but not detailed. The report remains pending and does not mention a reason for rejection or approval status. The incident is documented with attached photographs. The overall status of the report remains pending as of the latest update.`;
54778
- const openai = new OpenAI({
54779
- apiKey: OPEN_AI_API_KEY
54780
- });
54893
+
54894
+ The report highlighted that no individuals were directly affected or injured in the incident. However, there was damage to property associated with the incident, particularly mentioning an individual named Ruzzy, with contact +65-34567777889, who experienced property damage. The report states that this damage was also elaborated upon with historical context, reiterating similar pieces of information on the classical literature that influenced the Lorem Ipsum narrative.
54895
+
54896
+ No authorities were called, and the incident's resolution was marked at 11:00 AM, with actions taken by Ola, the shift in charge during the incident. The management was informed of the incident at 10:08 AM, and security implications were considered but not detailed. The report remains pending and does not mention a reason for rejection or approval status. The incident is documented with attached photographs. The overall status of the report remains pending as of the latest update.`;
54897
+ const anthropic = new Anthropic({ apiKey: ANTHROPIC_API_KEY });
54781
54898
  try {
54782
54899
  if (value?.incidentInformation?.siteInfo?.site) {
54783
54900
  const site = await _getSiteById(
@@ -54794,19 +54911,15 @@ function useIncidentReportService() {
54794
54911
  value.organization = org.name;
54795
54912
  }
54796
54913
  }
54797
- const completion = await openai.chat.completions.create({
54798
- model: "gpt-4o-mini",
54799
- messages: [
54800
- {
54801
- role: "system",
54802
- content: `You write a comprehensive summary for incident reports, exclude the attachment, and make it in essay format, and don't add any explaination to how the summary is about, and don't use the mongodb id number for the summary and Must include the following answers to What happened ?, Where did it happened ?, Who was involved ?, How did it happened?, Why did it happened?, Is there any security implications due to incident ?, just keep it plain since we will save it directly into the database. here's a sample: ${sample}`
54803
- },
54804
- { role: "user", content: JSON.stringify(value) }
54805
- ]
54914
+ const response = await anthropic.messages.create({
54915
+ model: "claude-sonnet-4-6",
54916
+ max_tokens: 1024,
54917
+ system: `You write a comprehensive summary for incident reports, exclude the attachment, and make it in essay format, and don't add any explaination to how the summary is about, and don't use the mongodb id number for the summary and Must include the following answers to What happened ?, Where did it happened ?, Who was involved ?, How did it happened?, Why did it happened?, Is there any security implications due to incident ?, just keep it plain since we will save it directly into the database. here's a sample: ${sample}`,
54918
+ messages: [{ role: "user", content: JSON.stringify(value) }]
54806
54919
  });
54807
- const briefsummary = completion?.choices[0]?.message?.content;
54808
- if (briefsummary) {
54809
- return briefsummary;
54920
+ const briefSummary = response.content[0].type === "text" ? response.content[0].text : null;
54921
+ if (briefSummary) {
54922
+ return briefSummary;
54810
54923
  } else {
54811
54924
  return "Failed to generate a summary.";
54812
54925
  }
@@ -57224,14 +57337,14 @@ function useNewDashboardRepo() {
57224
57337
  site: { $in: [siteIdObj, siteId] },
57225
57338
  service: "Security",
57226
57339
  createdAt: periodRange,
57227
- status: { $nin: ["completed"] }
57340
+ status: { $nin: ["Completed", "Deleted"] }
57228
57341
  }
57229
57342
  },
57230
57343
  {
57231
57344
  $facet: {
57232
57345
  total: [{ $count: "count" }],
57233
57346
  inProgress: [
57234
- { $match: { status: "in-progress" } },
57347
+ { $match: { status: "In-Progress" } },
57235
57348
  { $count: "count" }
57236
57349
  ]
57237
57350
  }
@@ -57243,7 +57356,7 @@ function useNewDashboardRepo() {
57243
57356
  site: { $in: [siteIdObj, siteId] },
57244
57357
  service: "Security",
57245
57358
  createdAt: { $gte: yesterday, $lte: yesterdayEnd },
57246
- status: { $nin: ["completed"] }
57359
+ status: { $nin: ["Completed", "Deleted"] }
57247
57360
  }
57248
57361
  },
57249
57362
  { $count: "count" }
@@ -57254,7 +57367,7 @@ function useNewDashboardRepo() {
57254
57367
  site: { $in: [siteIdObj, siteId] },
57255
57368
  service: "Security",
57256
57369
  createdAt: { $gte: today, $lte: todayEnd },
57257
- status: { $nin: ["completed"] }
57370
+ status: { $nin: ["Completed", "Deleted"] }
57258
57371
  }
57259
57372
  },
57260
57373
  { $count: "count" }
@@ -57263,7 +57376,7 @@ function useNewDashboardRepo() {
57263
57376
  {
57264
57377
  $match: {
57265
57378
  site: { $in: [siteIdObj, siteId] },
57266
- status: { $in: ["pending", "Pending"] },
57379
+ status: { $in: ["pending"] },
57267
57380
  createdAt: periodRange
57268
57381
  }
57269
57382
  },
@@ -57273,7 +57386,7 @@ function useNewDashboardRepo() {
57273
57386
  {
57274
57387
  $match: {
57275
57388
  site: { $in: [siteIdObj, siteId] },
57276
- status: { $in: ["pending", "Pending"] },
57389
+ status: { $in: ["pending"] },
57277
57390
  createdAt: { $gte: yesterday, $lte: yesterdayEnd }
57278
57391
  }
57279
57392
  },
@@ -57283,7 +57396,7 @@ function useNewDashboardRepo() {
57283
57396
  {
57284
57397
  $match: {
57285
57398
  site: { $in: [siteIdObj, siteId] },
57286
- status: { $in: ["pending", "Pending"] },
57399
+ status: { $in: ["pending"] },
57287
57400
  createdAt: { $gte: today, $lte: todayEnd }
57288
57401
  }
57289
57402
  },
@@ -57565,11 +57678,11 @@ function useNewDashboardRepo() {
57565
57678
  [
57566
57679
  db.collection(incidents_namespace_collection).find({
57567
57680
  site: { $in: [siteIdObj, siteId] },
57568
- status: { $in: ["pending", "Pending"] }
57681
+ status: { $in: ["pending"] }
57569
57682
  }).sort({ createdAt: -1 }).toArray(),
57570
57683
  db.collection(facility_bookings_namespace_collection2).find({
57571
57684
  site: { $in: [siteIdObj, siteId] },
57572
- status: { $in: ["Pending", "pending", "For Review", "for review"] }
57685
+ status: { $in: ["Pending", "For Review"] }
57573
57686
  }).sort({ createdAt: -1 }).toArray()
57574
57687
  ]
57575
57688
  );
@@ -57578,14 +57691,16 @@ function useNewDashboardRepo() {
57578
57691
  const todayAttentions = [];
57579
57692
  if (pendingIncidentCount > 0) {
57580
57693
  todayAttentions.push({
57581
- id: "incidents-pending",
57694
+ id: pendingIncidentDocs[0]._id.toString(),
57695
+ type: "incident",
57582
57696
  title: `${pendingIncidentCount} incident${pendingIncidentCount === 1 ? "" : "s"} pending acknowledge`,
57583
57697
  createdAt: pendingIncidentDocs[0].updatedAt || pendingIncidentDocs[0].createdAt || /* @__PURE__ */ new Date()
57584
57698
  });
57585
57699
  }
57586
57700
  if (pendingFacilityBookingCount > 0) {
57587
57701
  todayAttentions.push({
57588
- id: "facility-booking-pending",
57702
+ id: pendingFacilityBookingDocs[0]._id.toString(),
57703
+ type: "facility-booking",
57589
57704
  title: `${pendingFacilityBookingCount} facility booking${pendingFacilityBookingCount === 1 ? "" : "s"} need approval`,
57590
57705
  createdAt: pendingFacilityBookingDocs[0].createdAt || /* @__PURE__ */ new Date()
57591
57706
  });
@@ -57640,14 +57755,14 @@ function useNewDashboardRepo() {
57640
57755
  $match: {
57641
57756
  site: { $in: [siteIdObj, siteId] },
57642
57757
  createdAt: periodRange,
57643
- status: { $nin: ["completed"] }
57758
+ status: { $nin: ["Completed", "Deleted"] }
57644
57759
  }
57645
57760
  },
57646
57761
  {
57647
57762
  $facet: {
57648
57763
  total: [{ $count: "count" }],
57649
57764
  inProgress: [
57650
- { $match: { status: "in-progress" } },
57765
+ { $match: { status: "In-Progress" } },
57651
57766
  { $count: "count" }
57652
57767
  ]
57653
57768
  }
@@ -57658,7 +57773,7 @@ function useNewDashboardRepo() {
57658
57773
  $match: {
57659
57774
  site: { $in: [siteIdObj, siteId] },
57660
57775
  createdAt: { $gte: yesterday, $lte: yesterdayEnd },
57661
- status: { $nin: ["completed"] }
57776
+ status: { $nin: ["Completed", "Deleted"] }
57662
57777
  }
57663
57778
  },
57664
57779
  { $count: "count" }
@@ -57668,7 +57783,7 @@ function useNewDashboardRepo() {
57668
57783
  $match: {
57669
57784
  site: { $in: [siteIdObj, siteId] },
57670
57785
  createdAt: { $gte: today, $lte: todayEnd },
57671
- status: { $nin: ["completed"] }
57786
+ status: { $nin: ["Completed", "Deleted"] }
57672
57787
  }
57673
57788
  },
57674
57789
  { $count: "count" }
@@ -57677,7 +57792,7 @@ function useNewDashboardRepo() {
57677
57792
  {
57678
57793
  $match: {
57679
57794
  site: { $in: [siteIdObj, siteId] },
57680
- status: { $in: ["pending", "Pending"] },
57795
+ status: { $in: ["pending"] },
57681
57796
  createdAt: periodRange
57682
57797
  }
57683
57798
  },
@@ -57687,7 +57802,7 @@ function useNewDashboardRepo() {
57687
57802
  {
57688
57803
  $match: {
57689
57804
  site: { $in: [siteIdObj, siteId] },
57690
- status: { $in: ["pending", "Pending"] },
57805
+ status: { $in: ["pending"] },
57691
57806
  createdAt: { $gte: yesterday, $lte: yesterdayEnd }
57692
57807
  }
57693
57808
  },
@@ -57697,7 +57812,7 @@ function useNewDashboardRepo() {
57697
57812
  {
57698
57813
  $match: {
57699
57814
  site: { $in: [siteIdObj, siteId] },
57700
- status: { $in: ["pending", "Pending"] },
57815
+ status: { $in: ["pending"] },
57701
57816
  createdAt: { $gte: today, $lte: todayEnd }
57702
57817
  }
57703
57818
  },
@@ -57947,6 +58062,13 @@ function useNewDashboardRepo() {
57947
58062
  const periodRange = getDateRange(period);
57948
58063
  try {
57949
58064
  const workOrderService = workOrderServiceMap[serviceType] ?? serviceType;
58065
+ const workOrderMatchQuery = {
58066
+ site,
58067
+ status: { $nin: ["Completed", "Deleted"] }
58068
+ };
58069
+ if (serviceType !== "property_management_agency") {
58070
+ workOrderMatchQuery.service = workOrderService;
58071
+ }
57950
58072
  const [
57951
58073
  workOrderReport,
57952
58074
  supplyAlertReport,
@@ -57959,17 +58081,15 @@ function useNewDashboardRepo() {
57959
58081
  workOrderCollection.aggregate([
57960
58082
  {
57961
58083
  $match: {
57962
- site,
57963
- service: workOrderService,
57964
- createdAt: periodRange,
57965
- status: { $nin: ["completed"] }
58084
+ ...workOrderMatchQuery,
58085
+ createdAt: periodRange
57966
58086
  }
57967
58087
  },
57968
58088
  {
57969
58089
  $facet: {
57970
58090
  total: [{ $count: "count" }],
57971
58091
  inProgress: [
57972
- { $match: { status: "in-progress" } },
58092
+ { $match: { status: "In-Progress" } },
57973
58093
  { $count: "count" }
57974
58094
  ]
57975
58095
  }
@@ -58000,10 +58120,8 @@ function useNewDashboardRepo() {
58000
58120
  workOrderCollection.aggregate([
58001
58121
  {
58002
58122
  $match: {
58003
- site,
58004
- service: workOrderService,
58005
- createdAt: { $gte: yesterday, $lte: yesterdayEnd },
58006
- status: { $nin: ["completed"] }
58123
+ ...workOrderMatchQuery,
58124
+ createdAt: { $gte: yesterday, $lte: yesterdayEnd }
58007
58125
  }
58008
58126
  },
58009
58127
  { $count: "count" }
@@ -58011,10 +58129,8 @@ function useNewDashboardRepo() {
58011
58129
  workOrderCollection.aggregate([
58012
58130
  {
58013
58131
  $match: {
58014
- site,
58015
- service: workOrderService,
58016
- createdAt: { $gte: today, $lte: todayEnd },
58017
- status: { $nin: ["completed"] }
58132
+ ...workOrderMatchQuery,
58133
+ createdAt: { $gte: today, $lte: todayEnd }
58018
58134
  }
58019
58135
  },
58020
58136
  { $count: "count" }
@@ -58117,10 +58233,9 @@ function useNewDashboardRepo() {
58117
58233
  throw new BadRequestError182("Invalid period.");
58118
58234
  }
58119
58235
  try {
58120
- const workOrders = await workOrderCollection.find({
58236
+ const workOrderQuery = {
58121
58237
  site,
58122
- service: workOrderService,
58123
- status: { $nin: ["deleted", "Deleted"] },
58238
+ status: { $nin: ["Deleted"] },
58124
58239
  $or: [
58125
58240
  { createdAt: { $gte: rangeStart, $lte: rangeEnd } },
58126
58241
  {
@@ -58130,7 +58245,11 @@ function useNewDashboardRepo() {
58130
58245
  }
58131
58246
  }
58132
58247
  ]
58133
- }).project({ status: 1, createdAt: 1 }).toArray();
58248
+ };
58249
+ if (serviceType !== "property_management_agency") {
58250
+ workOrderQuery.service = workOrderService;
58251
+ }
58252
+ const workOrders = await workOrderCollection.find(workOrderQuery).project({ status: 1, createdAt: 1 }).toArray();
58134
58253
  const chartData = labels.map((label) => ({
58135
58254
  day: label,
58136
58255
  label,
@@ -58227,6 +58346,7 @@ function useNewDashboardRepo() {
58227
58346
  name: 1,
58228
58347
  type: 1,
58229
58348
  status: 1,
58349
+ schedule: 1,
58230
58350
  assigneeName: { $arrayElemAt: ["$_assigneeDoc.name", 0] }
58231
58351
  }
58232
58352
  },
@@ -58391,7 +58511,10 @@ function useNewDashboardRepo() {
58391
58511
  throw new BadRequestError182("Invalid site ID format.");
58392
58512
  }
58393
58513
  const workOrderService = workOrderServiceMap[serviceType] ?? serviceType;
58394
- const matchQuery = { site, service: workOrderService };
58514
+ const matchQuery = { site };
58515
+ if (serviceType !== "property_management_agency") {
58516
+ matchQuery.service = workOrderService;
58517
+ }
58395
58518
  if (period) {
58396
58519
  matchQuery.createdAt = getDateRange(period);
58397
58520
  }
@@ -65717,7 +65840,7 @@ function usePostFavoriteService() {
65717
65840
  });
65718
65841
  }
65719
65842
  await session?.commitTransaction();
65720
- return "Successfully added to favorites.";
65843
+ return "Successfully added to post-preloved.";
65721
65844
  } catch (error) {
65722
65845
  await session?.abortTransaction();
65723
65846
  throw error;
@@ -67129,9 +67252,112 @@ function useChatPrelovedController() {
67129
67252
  return { add, updateById, deleteById };
67130
67253
  }
67131
67254
 
67132
- // src/controllers/channel-preloved.controller.ts
67133
- import { BadRequestError as BadRequestError223, logger as logger193 } from "@7365admin1/node-server-utils";
67255
+ // src/events/chat-preloved.event.ts
67134
67256
  import Joi144 from "joi";
67257
+ import { logger as logger193, useCache as useCache69 } from "@7365admin1/node-server-utils";
67258
+ function parseSid(cookieHeader) {
67259
+ const match = cookieHeader.match(/(?:^|;\s*)sid=([^;]*)/);
67260
+ return match ? decodeURIComponent(match[1]) : null;
67261
+ }
67262
+ var schemaSendMessage = Joi144.object({
67263
+ receiverId: Joi144.string().hex().length(24).required(),
67264
+ channelId: Joi144.string().hex().length(24).optional().allow("", null),
67265
+ senderId: Joi144.string().hex().length(24).required(),
67266
+ postId: Joi144.string().hex().length(24).optional().allow("", null),
67267
+ message: Joi144.object({
67268
+ text: Joi144.string().required(),
67269
+ date: Joi144.date().optional().allow(null),
67270
+ time: Joi144.string().optional().allow("", null),
67271
+ senderId: Joi144.string().hex().length(24).required()
67272
+ }).required(),
67273
+ readMessage: Joi144.array().items(Joi144.string().hex()).optional().default([]),
67274
+ viewMessage: Joi144.array().items(Joi144.string().hex()).optional().default([]),
67275
+ attachments: Joi144.array().items(Joi144.string().hex()).optional().default([]),
67276
+ reactions: Joi144.string().optional().allow("", null).default(""),
67277
+ bidId: Joi144.string().hex().length(24).optional().allow("", null),
67278
+ edited: Joi144.boolean().optional().default(false)
67279
+ });
67280
+ var schemaTyping = Joi144.object({
67281
+ receiverId: Joi144.string().hex().length(24).required(),
67282
+ fromUserId: Joi144.string().hex().length(24).required(),
67283
+ senderName: Joi144.string().required()
67284
+ });
67285
+ var schemaChatMessageDeleted = Joi144.object({
67286
+ messageId: Joi144.string().hex().length(24).required(),
67287
+ receiverId: Joi144.string().hex().length(24).required()
67288
+ });
67289
+ function chatPrelovedEvents(io) {
67290
+ const namespace = io.of(/^\/chat-channel-[0-9a-fA-F]{24}$/);
67291
+ namespace.use(async (socket, next) => {
67292
+ try {
67293
+ const cookieHeader = socket.handshake.headers.cookie || "";
67294
+ let sid = parseSid(cookieHeader);
67295
+ if (!sid && socket.handshake.auth?.token) {
67296
+ sid = socket.handshake.auth.token;
67297
+ }
67298
+ if (!sid) {
67299
+ return next(new Error("Unauthorized"));
67300
+ }
67301
+ const { getCache } = useCache69("sessions");
67302
+ const sessionData = await getCache(`sid:${sid}`);
67303
+ if (!sessionData) {
67304
+ return next(new Error("Session expired or invalid"));
67305
+ }
67306
+ const session = sessionData;
67307
+ socket.data.userId = (session._id ?? sessionData).toString();
67308
+ next();
67309
+ } catch (error) {
67310
+ logger193.log({ level: "error", message: `Socket auth error: ${error.message}` });
67311
+ next(new Error("Authentication error"));
67312
+ }
67313
+ });
67314
+ namespace.on("connection", (socket) => {
67315
+ const userId = socket.data.userId;
67316
+ socket.join(userId);
67317
+ socket.on("sendMessage", (payload) => {
67318
+ const { error, value } = schemaSendMessage.validate(payload, {
67319
+ abortEarly: false
67320
+ });
67321
+ if (error) {
67322
+ const message = error.details.map((d) => d.message).join(", ");
67323
+ socket.emit("error", { event: "sendMessage", message });
67324
+ return;
67325
+ }
67326
+ namespace.to(value.receiverId).emit("receiveMessage", value);
67327
+ });
67328
+ socket.on("typing", (data) => {
67329
+ const { error, value } = schemaTyping.validate(data, {
67330
+ abortEarly: false
67331
+ });
67332
+ if (error) {
67333
+ const message = error.details.map((d) => d.message).join(", ");
67334
+ socket.emit("error", { event: "typing", message });
67335
+ return;
67336
+ }
67337
+ namespace.to(value.receiverId).emit("TypingNow", value);
67338
+ });
67339
+ socket.on("chatMessageDeleted", (data) => {
67340
+ const { error, value } = schemaChatMessageDeleted.validate(data, {
67341
+ abortEarly: false
67342
+ });
67343
+ if (error) {
67344
+ const message = error.details.map((d) => d.message).join(", ");
67345
+ socket.emit("error", { event: "chatMessageDeleted", message });
67346
+ return;
67347
+ }
67348
+ namespace.to(value.receiverId).emit("chatMessageDeleted", {
67349
+ messageId: value.messageId
67350
+ });
67351
+ });
67352
+ socket.on("disconnect", () => {
67353
+ socket.leave(userId);
67354
+ });
67355
+ });
67356
+ }
67357
+
67358
+ // src/controllers/channel-preloved.controller.ts
67359
+ import { BadRequestError as BadRequestError223, logger as logger194 } from "@7365admin1/node-server-utils";
67360
+ import Joi145 from "joi";
67135
67361
  function useChannelPrelovedController() {
67136
67362
  const {
67137
67363
  add: _add,
@@ -67145,7 +67371,7 @@ function useChannelPrelovedController() {
67145
67371
  });
67146
67372
  if (error) {
67147
67373
  const messages = error.details.map((d) => d.message).join(", ");
67148
- logger193.log({ level: "error", message: messages });
67374
+ logger194.log({ level: "error", message: messages });
67149
67375
  next(new BadRequestError223(messages));
67150
67376
  return;
67151
67377
  }
@@ -67153,31 +67379,31 @@ function useChannelPrelovedController() {
67153
67379
  const data = await _add(value);
67154
67380
  res.status(201).json(data);
67155
67381
  } catch (error2) {
67156
- logger193.log({ level: "error", message: error2.message });
67382
+ logger194.log({ level: "error", message: error2.message });
67157
67383
  next(error2);
67158
67384
  }
67159
67385
  }
67160
67386
  async function getChannelMessages(req, res, next) {
67161
- const paramsSchema = Joi144.object({
67162
- id: Joi144.string().hex().length(24).required()
67387
+ const paramsSchema = Joi145.object({
67388
+ id: Joi145.string().hex().length(24).required()
67163
67389
  });
67164
- const querySchema = Joi144.object({
67165
- page: Joi144.number().integer().min(1).default(1),
67166
- limit: Joi144.number().integer().min(1).max(100).default(10),
67167
- isLoadMore: Joi144.boolean().default(false),
67168
- lastMessageId: Joi144.string().hex().length(24).optional().allow("", null)
67390
+ const querySchema = Joi145.object({
67391
+ page: Joi145.number().integer().min(1).default(1),
67392
+ limit: Joi145.number().integer().min(1).max(100).default(10),
67393
+ isLoadMore: Joi145.boolean().default(false),
67394
+ lastMessageId: Joi145.string().hex().length(24).optional().allow("", null)
67169
67395
  });
67170
67396
  const { error: paramError, value: params } = paramsSchema.validate(
67171
67397
  req.params
67172
67398
  );
67173
67399
  if (paramError) {
67174
- logger193.log({ level: "error", message: paramError.message });
67400
+ logger194.log({ level: "error", message: paramError.message });
67175
67401
  next(new BadRequestError223(paramError.message));
67176
67402
  return;
67177
67403
  }
67178
67404
  const { error: queryError, value: query } = querySchema.validate(req.query);
67179
67405
  if (queryError) {
67180
- logger193.log({ level: "error", message: queryError.message });
67406
+ logger194.log({ level: "error", message: queryError.message });
67181
67407
  next(new BadRequestError223(queryError.message));
67182
67408
  return;
67183
67409
  }
@@ -67191,19 +67417,19 @@ function useChannelPrelovedController() {
67191
67417
  );
67192
67418
  res.status(200).json(data);
67193
67419
  } catch (error) {
67194
- logger193.log({ level: "error", message: error.message });
67420
+ logger194.log({ level: "error", message: error.message });
67195
67421
  next(error);
67196
67422
  }
67197
67423
  }
67198
67424
  async function getChannel(req, res, next) {
67199
- const querySchema = Joi144.object({
67200
- postId: Joi144.string().hex().length(24).required(),
67201
- receiverId: Joi144.string().hex().length(24).required(),
67202
- senderId: Joi144.string().hex().length(24).required()
67425
+ const querySchema = Joi145.object({
67426
+ postId: Joi145.string().hex().length(24).required(),
67427
+ receiverId: Joi145.string().hex().length(24).required(),
67428
+ senderId: Joi145.string().hex().length(24).required()
67203
67429
  });
67204
67430
  const { error, value } = querySchema.validate(req.query);
67205
67431
  if (error) {
67206
- logger193.log({ level: "error", message: error.message });
67432
+ logger194.log({ level: "error", message: error.message });
67207
67433
  next(new BadRequestError223(error.message));
67208
67434
  return;
67209
67435
  }
@@ -67215,20 +67441,20 @@ function useChannelPrelovedController() {
67215
67441
  );
67216
67442
  res.status(200).json(data);
67217
67443
  } catch (error2) {
67218
- logger193.log({ level: "error", message: error2.message });
67444
+ logger194.log({ level: "error", message: error2.message });
67219
67445
  next(error2);
67220
67446
  }
67221
67447
  }
67222
67448
  async function getChatLists(req, res, next) {
67223
- const querySchema = Joi144.object({
67224
- currentUserId: Joi144.string().hex().length(24).required(),
67225
- page: Joi144.number().integer().min(1).default(1),
67226
- limit: Joi144.number().integer().min(1).max(100).default(10),
67227
- search: Joi144.string().optional().allow("", null)
67449
+ const querySchema = Joi145.object({
67450
+ currentUserId: Joi145.string().hex().length(24).required(),
67451
+ page: Joi145.number().integer().min(1).default(1),
67452
+ limit: Joi145.number().integer().min(1).max(100).default(10),
67453
+ search: Joi145.string().optional().allow("", null)
67228
67454
  });
67229
67455
  const { error, value } = querySchema.validate(req.query);
67230
67456
  if (error) {
67231
- logger193.log({ level: "error", message: error.message });
67457
+ logger194.log({ level: "error", message: error.message });
67232
67458
  next(new BadRequestError223(error.message));
67233
67459
  return;
67234
67460
  }
@@ -67241,7 +67467,7 @@ function useChannelPrelovedController() {
67241
67467
  );
67242
67468
  res.status(200).json(data);
67243
67469
  } catch (error2) {
67244
- logger193.log({ level: "error", message: error2.message });
67470
+ logger194.log({ level: "error", message: error2.message });
67245
67471
  next(error2);
67246
67472
  }
67247
67473
  }
@@ -67249,7 +67475,7 @@ function useChannelPrelovedController() {
67249
67475
  }
67250
67476
 
67251
67477
  // src/models/bid-preloved.model.ts
67252
- import Joi145 from "joi";
67478
+ import Joi146 from "joi";
67253
67479
  import { ObjectId as ObjectId149 } from "mongodb";
67254
67480
  var BidType = /* @__PURE__ */ ((BidType2) => {
67255
67481
  BidType2["BID"] = "bid";
@@ -67263,21 +67489,21 @@ var BidStatus = /* @__PURE__ */ ((BidStatus3) => {
67263
67489
  BidStatus3["CANCELLED"] = "cancelled";
67264
67490
  return BidStatus3;
67265
67491
  })(BidStatus || {});
67266
- var schemaBidPreloved = Joi145.object({
67267
- type: Joi145.string().valid(...Object.values(BidType)).required(),
67268
- postId: Joi145.string().hex().length(24).required(),
67269
- receiverId: Joi145.string().hex().length(24).required(),
67270
- buyerId: Joi145.string().hex().length(24).required(),
67271
- price: Joi145.when("type", {
67492
+ var schemaBidPreloved = Joi146.object({
67493
+ type: Joi146.string().valid(...Object.values(BidType)).required(),
67494
+ postId: Joi146.string().hex().length(24).required(),
67495
+ receiverId: Joi146.string().hex().length(24).required(),
67496
+ buyerId: Joi146.string().hex().length(24).required(),
67497
+ price: Joi146.when("type", {
67272
67498
  is: "bid" /* BID */,
67273
- then: Joi145.number().required(),
67274
- otherwise: Joi145.number().optional().allow(null)
67499
+ then: Joi146.number().required(),
67500
+ otherwise: Joi146.number().optional().allow(null)
67275
67501
  }),
67276
- message: Joi145.string().optional().allow("", null),
67277
- status: Joi145.string().valid(...Object.values(BidStatus)).optional().default("pending" /* PENDING */)
67502
+ message: Joi146.string().optional().allow("", null),
67503
+ status: Joi146.string().valid(...Object.values(BidStatus)).optional().default("pending" /* PENDING */)
67278
67504
  });
67279
- var schemaUpdateBidPreloved = Joi145.object({
67280
- status: Joi145.string().valid(...Object.values(BidStatus)).required()
67505
+ var schemaUpdateBidPreloved = Joi146.object({
67506
+ status: Joi146.string().valid(...Object.values(BidStatus)).required()
67281
67507
  });
67282
67508
  function MBidPreloved(value) {
67283
67509
  const { error } = schemaBidPreloved.validate(value);
@@ -67345,10 +67571,6 @@ function useBidPrelovedRepo() {
67345
67571
  return { add, getById, updateStatus };
67346
67572
  }
67347
67573
 
67348
- // src/controllers/bid-preloved.controller.ts
67349
- import { BadRequestError as BadRequestError224, logger as logger194 } from "@7365admin1/node-server-utils";
67350
- import Joi146 from "joi";
67351
-
67352
67574
  // src/services/bid-preloved.service.ts
67353
67575
  import { InternalServerError as InternalServerError83, useAtlas as useAtlas128 } from "@7365admin1/node-server-utils";
67354
67576
  function useBidPrelovedService() {
@@ -67413,6 +67635,8 @@ function useBidPrelovedService() {
67413
67635
  }
67414
67636
 
67415
67637
  // src/controllers/bid-preloved.controller.ts
67638
+ import { BadRequestError as BadRequestError224, logger as logger195 } from "@7365admin1/node-server-utils";
67639
+ import Joi147 from "joi";
67416
67640
  function useBidPrelovedController() {
67417
67641
  const { createBid: _createBid } = useBidPrelovedService();
67418
67642
  const { getById: _getById, updateStatus: _updateStatus } = useBidPrelovedRepo();
@@ -67422,7 +67646,7 @@ function useBidPrelovedController() {
67422
67646
  });
67423
67647
  if (error) {
67424
67648
  const messages = error.details.map((d) => d.message).join(", ");
67425
- logger194.log({ level: "error", message: messages });
67649
+ logger195.log({ level: "error", message: messages });
67426
67650
  next(new BadRequestError224(messages));
67427
67651
  return;
67428
67652
  }
@@ -67431,19 +67655,19 @@ function useBidPrelovedController() {
67431
67655
  res.status(201).json(data);
67432
67656
  } catch (error2) {
67433
67657
  console.log("error", error2);
67434
- logger194.log({ level: "error", message: error2.message });
67658
+ logger195.log({ level: "error", message: error2.message });
67435
67659
  next(error2);
67436
67660
  }
67437
67661
  }
67438
67662
  async function updateStatus(req, res, next) {
67439
- const paramsSchema = Joi146.object({
67440
- id: Joi146.string().hex().length(24).required()
67663
+ const paramsSchema = Joi147.object({
67664
+ id: Joi147.string().hex().length(24).required()
67441
67665
  });
67442
67666
  const { error: paramError, value: params } = paramsSchema.validate(
67443
67667
  req.params
67444
67668
  );
67445
67669
  if (paramError) {
67446
- logger194.log({ level: "error", message: paramError.message });
67670
+ logger195.log({ level: "error", message: paramError.message });
67447
67671
  next(new BadRequestError224(paramError.message));
67448
67672
  return;
67449
67673
  }
@@ -67451,7 +67675,7 @@ function useBidPrelovedController() {
67451
67675
  req.body
67452
67676
  );
67453
67677
  if (bodyError) {
67454
- logger194.log({ level: "error", message: bodyError.message });
67678
+ logger195.log({ level: "error", message: bodyError.message });
67455
67679
  next(new BadRequestError224(bodyError.message));
67456
67680
  return;
67457
67681
  }
@@ -67459,17 +67683,17 @@ function useBidPrelovedController() {
67459
67683
  const data = await _updateStatus(params.id, body.status);
67460
67684
  res.status(200).json(data);
67461
67685
  } catch (error) {
67462
- logger194.log({ level: "error", message: error.message });
67686
+ logger195.log({ level: "error", message: error.message });
67463
67687
  next(error);
67464
67688
  }
67465
67689
  }
67466
67690
  async function getById(req, res, next) {
67467
- const paramsSchema = Joi146.object({
67468
- id: Joi146.string().hex().length(24).required()
67691
+ const paramsSchema = Joi147.object({
67692
+ id: Joi147.string().hex().length(24).required()
67469
67693
  });
67470
67694
  const { error, value: params } = paramsSchema.validate(req.params);
67471
67695
  if (error) {
67472
- logger194.log({ level: "error", message: error.message });
67696
+ logger195.log({ level: "error", message: error.message });
67473
67697
  next(new BadRequestError224(error.message));
67474
67698
  return;
67475
67699
  }
@@ -67477,7 +67701,7 @@ function useBidPrelovedController() {
67477
67701
  const data = await _getById(params.id);
67478
67702
  res.status(200).json(data);
67479
67703
  } catch (error2) {
67480
- logger194.log({ level: "error", message: error2.message });
67704
+ logger195.log({ level: "error", message: error2.message });
67481
67705
  next(error2);
67482
67706
  }
67483
67707
  }
@@ -67485,7 +67709,7 @@ function useBidPrelovedController() {
67485
67709
  }
67486
67710
 
67487
67711
  // src/models/online-forms-v2.model.ts
67488
- import Joi147 from "joi";
67712
+ import Joi148 from "joi";
67489
67713
  import { ObjectId as ObjectId151 } from "mongodb";
67490
67714
  var FormEntryStatus = /* @__PURE__ */ ((FormEntryStatus2) => {
67491
67715
  FormEntryStatus2["ACTIVE"] = "active";
@@ -67493,49 +67717,49 @@ var FormEntryStatus = /* @__PURE__ */ ((FormEntryStatus2) => {
67493
67717
  FormEntryStatus2["DELETED"] = "deleted";
67494
67718
  return FormEntryStatus2;
67495
67719
  })(FormEntryStatus || {});
67496
- var schemaFormEntry = Joi147.object({
67497
- _id: Joi147.string().hex().optional().allow("", null),
67498
- formType: Joi147.string().required(),
67499
- block: Joi147.string().optional().allow(null, ""),
67500
- level: Joi147.string().optional().allow(null, ""),
67501
- unit: Joi147.string().optional().allow(null, ""),
67502
- name: Joi147.string().optional().allow(null, ""),
67503
- phoneNumber: Joi147.string().optional().allow(null, ""),
67504
- createdBy: Joi147.string().required(),
67505
- fields: Joi147.object().pattern(
67506
- Joi147.string(),
67507
- Joi147.alternatives().try(
67508
- Joi147.string(),
67509
- Joi147.number(),
67510
- Joi147.boolean(),
67511
- Joi147.valid(null)
67720
+ var schemaFormEntry = Joi148.object({
67721
+ _id: Joi148.string().hex().optional().allow("", null),
67722
+ formType: Joi148.string().required(),
67723
+ block: Joi148.string().optional().allow(null, ""),
67724
+ level: Joi148.string().optional().allow(null, ""),
67725
+ unit: Joi148.string().optional().allow(null, ""),
67726
+ name: Joi148.string().optional().allow(null, ""),
67727
+ phoneNumber: Joi148.string().optional().allow(null, ""),
67728
+ createdBy: Joi148.string().required(),
67729
+ fields: Joi148.object().pattern(
67730
+ Joi148.string(),
67731
+ Joi148.alternatives().try(
67732
+ Joi148.string(),
67733
+ Joi148.number(),
67734
+ Joi148.boolean(),
67735
+ Joi148.valid(null)
67512
67736
  )
67513
67737
  ).required(),
67514
- status: Joi147.string().optional().allow("", null),
67515
- org: Joi147.string().hex().optional().allow("", null),
67516
- site: Joi147.string().hex().optional().allow("", null),
67517
- createdAt: Joi147.date().optional().allow("", null),
67518
- updatedAt: Joi147.date().optional().allow("", null),
67519
- deletedAt: Joi147.date().optional().allow("", null)
67738
+ status: Joi148.string().optional().allow("", null),
67739
+ org: Joi148.string().hex().optional().allow("", null),
67740
+ site: Joi148.string().hex().optional().allow("", null),
67741
+ createdAt: Joi148.date().optional().allow("", null),
67742
+ updatedAt: Joi148.date().optional().allow("", null),
67743
+ deletedAt: Joi148.date().optional().allow("", null)
67520
67744
  });
67521
- var schemaUpdateFormEntry = Joi147.object({
67522
- _id: Joi147.string().hex().required(),
67523
- formType: Joi147.string().optional().allow("", null),
67524
- block: Joi147.string().optional().allow(null, ""),
67525
- level: Joi147.string().optional().allow(null, ""),
67526
- unit: Joi147.string().optional().allow(null, ""),
67527
- fields: Joi147.object().pattern(
67528
- Joi147.string(),
67529
- Joi147.alternatives().try(
67530
- Joi147.string(),
67531
- Joi147.number(),
67532
- Joi147.boolean(),
67533
- Joi147.valid(null)
67745
+ var schemaUpdateFormEntry = Joi148.object({
67746
+ _id: Joi148.string().hex().required(),
67747
+ formType: Joi148.string().optional().allow("", null),
67748
+ block: Joi148.string().optional().allow(null, ""),
67749
+ level: Joi148.string().optional().allow(null, ""),
67750
+ unit: Joi148.string().optional().allow(null, ""),
67751
+ fields: Joi148.object().pattern(
67752
+ Joi148.string(),
67753
+ Joi148.alternatives().try(
67754
+ Joi148.string(),
67755
+ Joi148.number(),
67756
+ Joi148.boolean(),
67757
+ Joi148.valid(null)
67534
67758
  )
67535
67759
  ).optional(),
67536
- status: Joi147.string().optional().allow("", null),
67537
- updatedAt: Joi147.date().optional().allow("", null),
67538
- deletedAt: Joi147.date().optional().allow("", null)
67760
+ status: Joi148.string().optional().allow("", null),
67761
+ updatedAt: Joi148.date().optional().allow("", null),
67762
+ deletedAt: Joi148.date().optional().allow("", null)
67539
67763
  });
67540
67764
  function MFormEntry(value) {
67541
67765
  const { error } = schemaFormEntry.validate(value);
@@ -67580,34 +67804,34 @@ function MFormEntry(value) {
67580
67804
  deletedAt: value.deletedAt ?? null
67581
67805
  };
67582
67806
  }
67583
- var residentFormEntry = Joi147.object({
67584
- _id: Joi147.string().hex().optional().allow("", null),
67585
- typeOfForm: Joi147.string().optional().allow("", null),
67586
- unitNumber: Joi147.string().optional().allow(null, ""),
67587
- fields: Joi147.object().pattern(
67588
- Joi147.string(),
67589
- Joi147.alternatives().try(
67590
- Joi147.string(),
67591
- Joi147.number(),
67592
- Joi147.boolean(),
67593
- Joi147.valid(null)
67807
+ var residentFormEntry = Joi148.object({
67808
+ _id: Joi148.string().hex().optional().allow("", null),
67809
+ typeOfForm: Joi148.string().optional().allow("", null),
67810
+ unitNumber: Joi148.string().optional().allow(null, ""),
67811
+ fields: Joi148.object().pattern(
67812
+ Joi148.string(),
67813
+ Joi148.alternatives().try(
67814
+ Joi148.string(),
67815
+ Joi148.number(),
67816
+ Joi148.boolean(),
67817
+ Joi148.valid(null)
67594
67818
  )
67595
67819
  ).optional().allow(null, ""),
67596
- status: Joi147.string().optional().allow("", null),
67597
- org: Joi147.string().hex().optional().allow("", null),
67598
- site: Joi147.string().hex().optional().allow("", null),
67599
- userId: Joi147.string().hex().optional().allow("", null),
67600
- createdAt: Joi147.date().optional().allow("", null),
67601
- updatedAt: Joi147.date().optional().allow("", null),
67602
- deletedAt: Joi147.date().optional().allow("", null),
67603
- remarks: Joi147.string().optional().allow("", null),
67604
- managementValues: Joi147.object().pattern(
67605
- Joi147.string(),
67606
- Joi147.alternatives().try(
67607
- Joi147.string(),
67608
- Joi147.number(),
67609
- Joi147.boolean(),
67610
- Joi147.valid(null)
67820
+ status: Joi148.string().optional().allow("", null),
67821
+ org: Joi148.string().hex().optional().allow("", null),
67822
+ site: Joi148.string().hex().optional().allow("", null),
67823
+ userId: Joi148.string().hex().optional().allow("", null),
67824
+ createdAt: Joi148.date().optional().allow("", null),
67825
+ updatedAt: Joi148.date().optional().allow("", null),
67826
+ deletedAt: Joi148.date().optional().allow("", null),
67827
+ remarks: Joi148.string().optional().allow("", null),
67828
+ managementValues: Joi148.object().pattern(
67829
+ Joi148.string(),
67830
+ Joi148.alternatives().try(
67831
+ Joi148.string(),
67832
+ Joi148.number(),
67833
+ Joi148.boolean(),
67834
+ Joi148.valid(null)
67611
67835
  )
67612
67836
  ).optional().allow(null, "")
67613
67837
  });
@@ -67616,12 +67840,12 @@ var residentFormEntry = Joi147.object({
67616
67840
  import {
67617
67841
  BadRequestError as BadRequestError225,
67618
67842
  InternalServerError as InternalServerError84,
67619
- logger as logger195,
67843
+ logger as logger196,
67620
67844
  makeCacheKey as makeCacheKey65,
67621
67845
  NotFoundError as NotFoundError62,
67622
67846
  paginate as paginate64,
67623
67847
  useAtlas as useAtlas129,
67624
- useCache as useCache69
67848
+ useCache as useCache70
67625
67849
  } from "@7365admin1/node-server-utils";
67626
67850
  import { ObjectId as ObjectId152 } from "mongodb";
67627
67851
  var online_forms_namespace_collection = "online-forms";
@@ -67631,7 +67855,7 @@ function useFormEntryRepo() {
67631
67855
  throw new InternalServerError84("Unable to connect to server.");
67632
67856
  }
67633
67857
  const collection = db.collection(online_forms_namespace_collection);
67634
- const { delNamespace, getCache, setCache } = useCache69(
67858
+ const { delNamespace, getCache, setCache } = useCache70(
67635
67859
  online_forms_namespace_collection
67636
67860
  );
67637
67861
  const { getUserById } = useUserRepo();
@@ -67844,7 +68068,7 @@ function useFormEntryRepo() {
67844
68068
  );
67845
68069
  const cachedData = await getCache(cacheKey);
67846
68070
  if (cachedData) {
67847
- logger195.info(`Cache hit for key: ${cacheKey}`);
68071
+ logger196.info(`Cache hit for key: ${cacheKey}`);
67848
68072
  return cachedData;
67849
68073
  }
67850
68074
  try {
@@ -67857,9 +68081,9 @@ function useFormEntryRepo() {
67857
68081
  const length = await collection.countDocuments(query);
67858
68082
  const data = paginate64(items, page, limit, length);
67859
68083
  setCache(cacheKey, data, 15 * 60).then(() => {
67860
- logger195.info(`Cache set for key: ${cacheKey}`);
68084
+ logger196.info(`Cache set for key: ${cacheKey}`);
67861
68085
  }).catch((err) => {
67862
- logger195.error(`Failed to set cache for key: ${cacheKey}`, err);
68086
+ logger196.error(`Failed to set cache for key: ${cacheKey}`, err);
67863
68087
  });
67864
68088
  return data;
67865
68089
  } catch (error) {
@@ -67879,8 +68103,8 @@ function useFormEntryRepo() {
67879
68103
  }
67880
68104
 
67881
68105
  // src/controllers/online-forms-v2.controller.ts
67882
- import { BadRequestError as BadRequestError226, logger as logger196 } from "@7365admin1/node-server-utils";
67883
- import Joi148 from "joi";
68106
+ import { BadRequestError as BadRequestError226, logger as logger197 } from "@7365admin1/node-server-utils";
68107
+ import Joi149 from "joi";
67884
68108
  import ExcelJS3 from "exceljs";
67885
68109
  import fs6 from "fs";
67886
68110
  function useFormEntryController() {
@@ -67941,7 +68165,7 @@ function useFormEntryController() {
67941
68165
  });
67942
68166
  if (error) {
67943
68167
  const messages = error.details.map((d) => d.message).join(", ");
67944
- logger196.log({ level: "error", message: messages });
68168
+ logger197.log({ level: "error", message: messages });
67945
68169
  next(new BadRequestError226(messages));
67946
68170
  return;
67947
68171
  }
@@ -67950,24 +68174,24 @@ function useFormEntryController() {
67950
68174
  fs6.unlink(req.file.path, () => {
67951
68175
  });
67952
68176
  } catch (error) {
67953
- logger196.log({ level: "error", message: error.message });
68177
+ logger197.log({ level: "error", message: error.message });
67954
68178
  next(error);
67955
68179
  }
67956
68180
  }
67957
68181
  async function getAll(req, res, next) {
67958
68182
  try {
67959
- const schema2 = Joi148.object({
67960
- search: Joi148.string().optional().allow("", null),
67961
- page: Joi148.number().integer().min(1).allow("", null).default(1),
67962
- limit: Joi148.number().integer().min(1).max(100).allow("", null).default(10),
67963
- status: Joi148.string().optional().allow(null, ""),
67964
- org: Joi148.string().hex().optional().allow("", null),
67965
- site: Joi148.string().hex().optional().allow("", null)
68183
+ const schema2 = Joi149.object({
68184
+ search: Joi149.string().optional().allow("", null),
68185
+ page: Joi149.number().integer().min(1).allow("", null).default(1),
68186
+ limit: Joi149.number().integer().min(1).max(100).allow("", null).default(10),
68187
+ status: Joi149.string().optional().allow(null, ""),
68188
+ org: Joi149.string().hex().optional().allow("", null),
68189
+ site: Joi149.string().hex().optional().allow("", null)
67966
68190
  });
67967
68191
  const { error, value } = schema2.validate(req.query);
67968
68192
  if (error) {
67969
68193
  const messages = error.details.map((d) => d.message).join(", ");
67970
- logger196.log({ level: "error", message: messages });
68194
+ logger197.log({ level: "error", message: messages });
67971
68195
  next(new BadRequestError226(messages));
67972
68196
  return;
67973
68197
  }
@@ -67976,20 +68200,20 @@ function useFormEntryController() {
67976
68200
  res.json(data);
67977
68201
  return;
67978
68202
  } catch (error) {
67979
- logger196.log({ level: "error", message: error.message });
68203
+ logger197.log({ level: "error", message: error.message });
67980
68204
  next(error);
67981
68205
  return;
67982
68206
  }
67983
68207
  }
67984
68208
  async function getFormEntryById(req, res, next) {
67985
68209
  try {
67986
- const schema2 = Joi148.object({
67987
- _id: Joi148.string().hex().length(24).required()
68210
+ const schema2 = Joi149.object({
68211
+ _id: Joi149.string().hex().length(24).required()
67988
68212
  });
67989
68213
  const { error, value } = schema2.validate({ _id: req.params.id });
67990
68214
  if (error) {
67991
68215
  const messages = error.details.map((d) => d.message).join(", ");
67992
- logger196.log({ level: "error", message: messages });
68216
+ logger197.log({ level: "error", message: messages });
67993
68217
  next(new BadRequestError226(messages));
67994
68218
  return;
67995
68219
  }
@@ -67998,7 +68222,7 @@ function useFormEntryController() {
67998
68222
  res.json(data);
67999
68223
  return;
68000
68224
  } catch (error) {
68001
- logger196.log({ level: "error", message: error.message });
68225
+ logger197.log({ level: "error", message: error.message });
68002
68226
  next(error);
68003
68227
  return;
68004
68228
  }
@@ -68011,7 +68235,7 @@ function useFormEntryController() {
68011
68235
  });
68012
68236
  if (error) {
68013
68237
  const messages = error.details.map((d) => d.message).join(", ");
68014
- logger196.log({ level: "error", message: messages });
68238
+ logger197.log({ level: "error", message: messages });
68015
68239
  next(new BadRequestError226(messages));
68016
68240
  return;
68017
68241
  }
@@ -68020,18 +68244,18 @@ function useFormEntryController() {
68020
68244
  res.json({ message: "Successfully updated online form." });
68021
68245
  return;
68022
68246
  } catch (error) {
68023
- logger196.log({ level: "error", message: error.message });
68247
+ logger197.log({ level: "error", message: error.message });
68024
68248
  next(error);
68025
68249
  return;
68026
68250
  }
68027
68251
  }
68028
68252
  async function deleteFormEntryById(req, res, next) {
68029
68253
  try {
68030
- const validation = Joi148.string().hex().required();
68254
+ const validation = Joi149.string().hex().required();
68031
68255
  const _id = req.params.id;
68032
68256
  const { error } = validation.validate(_id);
68033
68257
  if (error) {
68034
- logger196.log({ level: "error", message: error.message });
68258
+ logger197.log({ level: "error", message: error.message });
68035
68259
  next(new BadRequestError226(error.message));
68036
68260
  return;
68037
68261
  }
@@ -68039,7 +68263,7 @@ function useFormEntryController() {
68039
68263
  res.json({ message: "Successfully deleted online form." });
68040
68264
  return;
68041
68265
  } catch (error) {
68042
- logger196.log({ level: "error", message: error.message });
68266
+ logger197.log({ level: "error", message: error.message });
68043
68267
  next(error);
68044
68268
  return;
68045
68269
  }
@@ -68056,7 +68280,7 @@ function useFormEntryController() {
68056
68280
  });
68057
68281
  if (error) {
68058
68282
  const messages = error.details.map((d) => d.message).join(", ");
68059
- logger196.log({ level: "error", message: messages });
68283
+ logger197.log({ level: "error", message: messages });
68060
68284
  next(new BadRequestError226(messages));
68061
68285
  return;
68062
68286
  }
@@ -68065,7 +68289,7 @@ function useFormEntryController() {
68065
68289
  res.status(201).json({ message: data });
68066
68290
  return;
68067
68291
  } catch (error2) {
68068
- logger196.log({ level: "error", message: error2.message });
68292
+ logger197.log({ level: "error", message: error2.message });
68069
68293
  next(error2);
68070
68294
  return;
68071
68295
  }
@@ -68077,7 +68301,7 @@ function useFormEntryController() {
68077
68301
  });
68078
68302
  if (error) {
68079
68303
  const messages = error.details.map((d) => d.message).join(", ");
68080
- logger196.log({ level: "error", message: messages });
68304
+ logger197.log({ level: "error", message: messages });
68081
68305
  next(new BadRequestError226(messages));
68082
68306
  return;
68083
68307
  }
@@ -68086,27 +68310,27 @@ function useFormEntryController() {
68086
68310
  res.status(201).json({ message: data });
68087
68311
  return;
68088
68312
  } catch (error2) {
68089
- logger196.log({ level: "error", message: error2.message });
68313
+ logger197.log({ level: "error", message: error2.message });
68090
68314
  next(error2);
68091
68315
  return;
68092
68316
  }
68093
68317
  }
68094
68318
  async function residentForm(req, res, next) {
68095
68319
  try {
68096
- const residentFormPayload = Joi148.object({
68097
- org: Joi148.string().hex().required(),
68098
- site: Joi148.string().hex().required(),
68099
- userId: Joi148.string().hex().required(),
68100
- search: Joi148.string().optional().allow("", null),
68101
- page: Joi148.number().integer().min(1).allow("", null).default(1),
68102
- limit: Joi148.number().integer().min(1).max(100).allow("", null).default(10)
68320
+ const residentFormPayload = Joi149.object({
68321
+ org: Joi149.string().hex().required(),
68322
+ site: Joi149.string().hex().required(),
68323
+ userId: Joi149.string().hex().required(),
68324
+ search: Joi149.string().optional().allow("", null),
68325
+ page: Joi149.number().integer().min(1).allow("", null).default(1),
68326
+ limit: Joi149.number().integer().min(1).max(100).allow("", null).default(10)
68103
68327
  });
68104
68328
  const { error, value } = residentFormPayload.validate(req.query, {
68105
68329
  abortEarly: true
68106
68330
  });
68107
68331
  if (error) {
68108
68332
  const messages = error.details.map((d) => d.message).join(", ");
68109
- logger196.log({ level: "error", message: messages });
68333
+ logger197.log({ level: "error", message: messages });
68110
68334
  next(new BadRequestError226(messages));
68111
68335
  return;
68112
68336
  }
@@ -68114,7 +68338,7 @@ function useFormEntryController() {
68114
68338
  const result = await _residentForm({ userId, site, org, search, page, limit });
68115
68339
  res.json(result);
68116
68340
  } catch (error) {
68117
- logger196.log({ level: "error", message: error.message });
68341
+ logger197.log({ level: "error", message: error.message });
68118
68342
  next(error);
68119
68343
  return;
68120
68344
  }
@@ -68170,8 +68394,8 @@ function useBuildingLevelService() {
68170
68394
  }
68171
68395
 
68172
68396
  // src/controllers/building-level.controller.ts
68173
- import { BadRequestError as BadRequestError227, logger as logger197 } from "@7365admin1/node-server-utils";
68174
- import Joi149 from "joi";
68397
+ import { BadRequestError as BadRequestError227, logger as logger198 } from "@7365admin1/node-server-utils";
68398
+ import Joi150 from "joi";
68175
68399
  function useBuildingLevelController() {
68176
68400
  const { add: _add, updateLevelById: _updateLevelById } = useBuildingLevelService();
68177
68401
  const {
@@ -68188,7 +68412,7 @@ function useBuildingLevelController() {
68188
68412
  });
68189
68413
  if (error) {
68190
68414
  const messages = error.details.map((d) => d.message).join(", ");
68191
- logger197.log({ level: "error", message: messages });
68415
+ logger198.log({ level: "error", message: messages });
68192
68416
  next(new BadRequestError227(messages));
68193
68417
  return;
68194
68418
  }
@@ -68200,19 +68424,19 @@ function useBuildingLevelController() {
68200
68424
  }
68201
68425
  async function getAll(req, res, next) {
68202
68426
  try {
68203
- const validation = Joi149.object({
68204
- page: Joi149.number().min(1).optional().default(1),
68205
- limit: Joi149.number().min(1).optional().default(20),
68206
- search: Joi149.string().optional().allow("", null),
68207
- site: Joi149.string().hex().length(24).optional().allow("", null),
68208
- status: Joi149.string().valid(...Object.values(BuildingLevelStatus)).default("active" /* ACTIVE */)
68427
+ const validation = Joi150.object({
68428
+ page: Joi150.number().min(1).optional().default(1),
68429
+ limit: Joi150.number().min(1).optional().default(20),
68430
+ search: Joi150.string().optional().allow("", null),
68431
+ site: Joi150.string().hex().length(24).optional().allow("", null),
68432
+ status: Joi150.string().valid(...Object.values(BuildingLevelStatus)).default("active" /* ACTIVE */)
68209
68433
  });
68210
68434
  const { error, value } = validation.validate(req.query, {
68211
68435
  abortEarly: false
68212
68436
  });
68213
68437
  if (error) {
68214
68438
  const messages = error.details.map((d) => d.message);
68215
- logger197.log({ level: "error", message: messages.join(", ") });
68439
+ logger198.log({ level: "error", message: messages.join(", ") });
68216
68440
  next(new BadRequestError227(messages.join(", ")));
68217
68441
  return;
68218
68442
  }
@@ -68232,13 +68456,13 @@ function useBuildingLevelController() {
68232
68456
  }
68233
68457
  async function getById(req, res, next) {
68234
68458
  try {
68235
- const schema2 = Joi149.object({
68236
- id: Joi149.string().hex().length(24).required()
68459
+ const schema2 = Joi150.object({
68460
+ id: Joi150.string().hex().length(24).required()
68237
68461
  });
68238
68462
  const { error, value } = schema2.validate({ id: req.params.id });
68239
68463
  if (error) {
68240
68464
  const messages = error.details.map((d) => d.message);
68241
- logger197.log({ level: "error", message: messages.join(", ") });
68465
+ logger198.log({ level: "error", message: messages.join(", ") });
68242
68466
  next(new BadRequestError227(messages.join(", ")));
68243
68467
  return;
68244
68468
  }
@@ -68258,7 +68482,7 @@ function useBuildingLevelController() {
68258
68482
  });
68259
68483
  if (error) {
68260
68484
  const messages = error.details.map((d) => d.message);
68261
- logger197.log({ level: "error", message: messages.join(", ") });
68485
+ logger198.log({ level: "error", message: messages.join(", ") });
68262
68486
  next(new BadRequestError227(messages.join(", ")));
68263
68487
  return;
68264
68488
  }
@@ -68271,13 +68495,13 @@ function useBuildingLevelController() {
68271
68495
  }
68272
68496
  async function deleteById(req, res, next) {
68273
68497
  try {
68274
- const schema2 = Joi149.object({
68275
- id: Joi149.string().hex().required()
68498
+ const schema2 = Joi150.object({
68499
+ id: Joi150.string().hex().required()
68276
68500
  });
68277
68501
  const { error, value } = schema2.validate({ id: req.params.id });
68278
68502
  if (error) {
68279
68503
  const messages = error.details.map((d) => d.message);
68280
- logger197.log({ level: "error", message: messages.join(", ") });
68504
+ logger198.log({ level: "error", message: messages.join(", ") });
68281
68505
  next(new BadRequestError227(messages.join(", ")));
68282
68506
  return;
68283
68507
  }
@@ -68291,18 +68515,18 @@ function useBuildingLevelController() {
68291
68515
  }
68292
68516
  async function batchUpdateByIds(req, res, next) {
68293
68517
  try {
68294
- const schema2 = Joi149.array().items(
68295
- Joi149.object({
68296
- _id: Joi149.string().hex().length(24).required(),
68297
- value: Joi149.object({
68298
- name: Joi149.string().optional().allow("", null)
68518
+ const schema2 = Joi150.array().items(
68519
+ Joi150.object({
68520
+ _id: Joi150.string().hex().length(24).required(),
68521
+ value: Joi150.object({
68522
+ name: Joi150.string().optional().allow("", null)
68299
68523
  }).required()
68300
68524
  })
68301
68525
  );
68302
68526
  const { error, value } = schema2.validate(req.body);
68303
68527
  if (error) {
68304
68528
  const messages = error.details.map((d) => d.message);
68305
- logger197.log({ level: "error", message: messages.join(", ") });
68529
+ logger198.log({ level: "error", message: messages.join(", ") });
68306
68530
  next(new BadRequestError227(messages.join(", ")));
68307
68531
  return;
68308
68532
  }
@@ -68318,9 +68542,9 @@ function useBuildingLevelController() {
68318
68542
  }
68319
68543
  async function getBuildingLevelList(req, res, next) {
68320
68544
  try {
68321
- const schema2 = Joi149.object({
68322
- site: Joi149.string().hex().length(24).required(),
68323
- block: Joi149.string().hex().length(24).required()
68545
+ const schema2 = Joi150.object({
68546
+ site: Joi150.string().hex().length(24).required(),
68547
+ block: Joi150.string().hex().length(24).required()
68324
68548
  });
68325
68549
  const { error, value } = schema2.validate({
68326
68550
  site: req.params.siteId,
@@ -68328,7 +68552,7 @@ function useBuildingLevelController() {
68328
68552
  });
68329
68553
  if (error) {
68330
68554
  const messages = error.details.map((d) => d.message).join(", ");
68331
- logger197.log({ level: "error", message: messages });
68555
+ logger198.log({ level: "error", message: messages });
68332
68556
  next(new BadRequestError227(messages));
68333
68557
  return;
68334
68558
  }
@@ -68352,9 +68576,9 @@ function useBuildingLevelController() {
68352
68576
  }
68353
68577
 
68354
68578
  // src/models/hid-amico.model.ts
68355
- import { BadRequestError as BadRequestError228, logger as logger198 } from "@7365admin1/node-server-utils";
68579
+ import { BadRequestError as BadRequestError228, logger as logger199 } from "@7365admin1/node-server-utils";
68356
68580
  import { ObjectId as ObjectId153 } from "mongodb";
68357
- import Joi150 from "joi";
68581
+ import Joi151 from "joi";
68358
68582
  function canReadObjectId(value) {
68359
68583
  if (value instanceof ObjectId153)
68360
68584
  return true;
@@ -68394,159 +68618,159 @@ function toObjectId23(value, label = "ID") {
68394
68618
  }
68395
68619
  throw new BadRequestError228(`Invalid ${label} format`);
68396
68620
  }
68397
- var objectIdSchema2 = Joi150.custom((value, helpers) => canReadObjectId(value) ? value : helpers.error("any.invalid"), "ObjectId").messages({
68621
+ var objectIdSchema2 = Joi151.custom((value, helpers) => canReadObjectId(value) ? value : helpers.error("any.invalid"), "ObjectId").messages({
68398
68622
  "any.invalid": "{{#label}} must be a valid ObjectId"
68399
68623
  });
68400
- var schemaHidAmicoReader = Joi150.object({
68624
+ var schemaHidAmicoReader = Joi151.object({
68401
68625
  _id: objectIdSchema2.optional(),
68402
68626
  site: objectIdSchema2.required(),
68403
- name: Joi150.string().trim().required(),
68404
- baseUrl: Joi150.string().uri({ scheme: ["http", "https"] }).required(),
68405
- username: Joi150.string().trim().required(),
68406
- password: Joi150.string().required(),
68407
- location: Joi150.string().allow(null, "").optional(),
68408
- deviceId: Joi150.string().allow(null, "").optional(),
68409
- monitorPath: Joi150.string().allow(null, "").optional(),
68410
- enabled: Joi150.boolean().optional(),
68411
- status: Joi150.string().valid("active", "inactive", "deleted", "offline").optional(),
68412
- lastSeenAt: Joi150.date().optional(),
68413
- lastSyncAt: Joi150.date().optional(),
68414
- lastSyncStatus: Joi150.string().valid("idle", "running", "completed", "failed").optional(),
68415
- lastSyncMessage: Joi150.string().allow(null, "").optional(),
68416
- createdAt: Joi150.date().optional(),
68417
- updatedAt: Joi150.date().optional(),
68418
- deletedAt: Joi150.date().optional()
68627
+ name: Joi151.string().trim().required(),
68628
+ baseUrl: Joi151.string().uri({ scheme: ["http", "https"] }).required(),
68629
+ username: Joi151.string().trim().required(),
68630
+ password: Joi151.string().required(),
68631
+ location: Joi151.string().allow(null, "").optional(),
68632
+ deviceId: Joi151.string().allow(null, "").optional(),
68633
+ monitorPath: Joi151.string().allow(null, "").optional(),
68634
+ enabled: Joi151.boolean().optional(),
68635
+ status: Joi151.string().valid("active", "inactive", "deleted", "offline").optional(),
68636
+ lastSeenAt: Joi151.date().optional(),
68637
+ lastSyncAt: Joi151.date().optional(),
68638
+ lastSyncStatus: Joi151.string().valid("idle", "running", "completed", "failed").optional(),
68639
+ lastSyncMessage: Joi151.string().allow(null, "").optional(),
68640
+ createdAt: Joi151.date().optional(),
68641
+ updatedAt: Joi151.date().optional(),
68642
+ deletedAt: Joi151.date().optional()
68419
68643
  });
68420
- var schemaUpdateHidAmicoReader = Joi150.object({
68644
+ var schemaUpdateHidAmicoReader = Joi151.object({
68421
68645
  site: objectIdSchema2.optional(),
68422
- name: Joi150.string().trim().optional(),
68423
- baseUrl: Joi150.string().uri({ scheme: ["http", "https"] }).optional(),
68424
- username: Joi150.string().trim().optional(),
68425
- password: Joi150.string().allow(null, "").optional(),
68426
- location: Joi150.string().allow(null, "").optional(),
68427
- deviceId: Joi150.string().allow(null, "").optional(),
68428
- monitorPath: Joi150.string().allow(null, "").optional(),
68429
- enabled: Joi150.boolean().optional(),
68430
- status: Joi150.string().valid("active", "inactive", "deleted", "offline").optional(),
68431
- lastSeenAt: Joi150.date().optional(),
68432
- lastSyncAt: Joi150.date().optional(),
68433
- lastSyncStatus: Joi150.string().valid("idle", "running", "completed", "failed").optional(),
68434
- lastSyncMessage: Joi150.string().allow(null, "").optional(),
68435
- deletedAt: Joi150.date().optional()
68646
+ name: Joi151.string().trim().optional(),
68647
+ baseUrl: Joi151.string().uri({ scheme: ["http", "https"] }).optional(),
68648
+ username: Joi151.string().trim().optional(),
68649
+ password: Joi151.string().allow(null, "").optional(),
68650
+ location: Joi151.string().allow(null, "").optional(),
68651
+ deviceId: Joi151.string().allow(null, "").optional(),
68652
+ monitorPath: Joi151.string().allow(null, "").optional(),
68653
+ enabled: Joi151.boolean().optional(),
68654
+ status: Joi151.string().valid("active", "inactive", "deleted", "offline").optional(),
68655
+ lastSeenAt: Joi151.date().optional(),
68656
+ lastSyncAt: Joi151.date().optional(),
68657
+ lastSyncStatus: Joi151.string().valid("idle", "running", "completed", "failed").optional(),
68658
+ lastSyncMessage: Joi151.string().allow(null, "").optional(),
68659
+ deletedAt: Joi151.date().optional()
68436
68660
  });
68437
- var schemaHidAmicoEvent = Joi150.object({
68661
+ var schemaHidAmicoEvent = Joi151.object({
68438
68662
  _id: objectIdSchema2.optional(),
68439
68663
  reader: objectIdSchema2.required(),
68440
68664
  site: objectIdSchema2.optional(),
68441
- type: Joi150.string().required(),
68442
- payload: Joi150.object().unknown(true).required(),
68443
- status: Joi150.string().valid("received", "processed", "failed").optional(),
68444
- createdAt: Joi150.date().optional()
68665
+ type: Joi151.string().required(),
68666
+ payload: Joi151.object().unknown(true).required(),
68667
+ status: Joi151.string().valid("received", "processed", "failed").optional(),
68668
+ createdAt: Joi151.date().optional()
68445
68669
  });
68446
- var schemaHidAmicoIdentity = Joi150.object({
68670
+ var schemaHidAmicoIdentity = Joi151.object({
68447
68671
  _id: objectIdSchema2.optional(),
68448
68672
  reader: objectIdSchema2.required(),
68449
68673
  site: objectIdSchema2.required(),
68450
- hidUserId: Joi150.alternatives(Joi150.string(), Joi150.number()).optional().allow(null, ""),
68451
- registration: Joi150.string().optional().allow(null, ""),
68452
- cardNo: Joi150.string().optional().allow(null, ""),
68674
+ hidUserId: Joi151.alternatives(Joi151.string(), Joi151.number()).optional().allow(null, ""),
68675
+ registration: Joi151.string().optional().allow(null, ""),
68676
+ cardNo: Joi151.string().optional().allow(null, ""),
68453
68677
  person: objectIdSchema2.optional().allow(null, ""),
68454
68678
  user: objectIdSchema2.optional().allow(null, ""),
68455
68679
  member: objectIdSchema2.optional().allow(null, ""),
68456
68680
  visitor: objectIdSchema2.optional().allow(null, ""),
68457
- type: Joi150.string().valid("resident", "staff", "contractor", "visitor", "admin", "unknown").required(),
68458
- status: Joi150.string().valid("active", "inactive", "deleted").optional(),
68459
- metadata: Joi150.object().unknown(true).optional(),
68460
- createdAt: Joi150.date().optional(),
68461
- updatedAt: Joi150.date().optional(),
68462
- deletedAt: Joi150.date().optional()
68681
+ type: Joi151.string().valid("resident", "staff", "contractor", "visitor", "admin", "unknown").required(),
68682
+ status: Joi151.string().valid("active", "inactive", "deleted").optional(),
68683
+ metadata: Joi151.object().unknown(true).optional(),
68684
+ createdAt: Joi151.date().optional(),
68685
+ updatedAt: Joi151.date().optional(),
68686
+ deletedAt: Joi151.date().optional()
68463
68687
  }).or("hidUserId", "registration", "cardNo");
68464
- var schemaCreateHidAmicoIdentity = Joi150.object({
68688
+ var schemaCreateHidAmicoIdentity = Joi151.object({
68465
68689
  site: objectIdSchema2.optional(),
68466
- hidUserId: Joi150.alternatives(Joi150.string(), Joi150.number()).optional().allow(null, ""),
68467
- registration: Joi150.string().optional().allow(null, ""),
68468
- cardNo: Joi150.string().optional().allow(null, ""),
68690
+ hidUserId: Joi151.alternatives(Joi151.string(), Joi151.number()).optional().allow(null, ""),
68691
+ registration: Joi151.string().optional().allow(null, ""),
68692
+ cardNo: Joi151.string().optional().allow(null, ""),
68469
68693
  person: objectIdSchema2.optional().allow(null, ""),
68470
68694
  user: objectIdSchema2.optional().allow(null, ""),
68471
68695
  member: objectIdSchema2.optional().allow(null, ""),
68472
68696
  visitor: objectIdSchema2.optional().allow(null, ""),
68473
- type: Joi150.string().valid("resident", "staff", "contractor", "visitor", "admin", "unknown").required(),
68474
- status: Joi150.string().valid("active", "inactive", "deleted").optional(),
68475
- metadata: Joi150.object().unknown(true).optional()
68697
+ type: Joi151.string().valid("resident", "staff", "contractor", "visitor", "admin", "unknown").required(),
68698
+ status: Joi151.string().valid("active", "inactive", "deleted").optional(),
68699
+ metadata: Joi151.object().unknown(true).optional()
68476
68700
  }).or("hidUserId", "registration", "cardNo");
68477
- var schemaUpdateHidAmicoIdentity = Joi150.object({
68478
- hidUserId: Joi150.alternatives(Joi150.string(), Joi150.number()).optional().allow(null, ""),
68479
- registration: Joi150.string().optional().allow(null, ""),
68480
- cardNo: Joi150.string().optional().allow(null, ""),
68701
+ var schemaUpdateHidAmicoIdentity = Joi151.object({
68702
+ hidUserId: Joi151.alternatives(Joi151.string(), Joi151.number()).optional().allow(null, ""),
68703
+ registration: Joi151.string().optional().allow(null, ""),
68704
+ cardNo: Joi151.string().optional().allow(null, ""),
68481
68705
  person: objectIdSchema2.optional().allow(null, ""),
68482
68706
  user: objectIdSchema2.optional().allow(null, ""),
68483
68707
  member: objectIdSchema2.optional().allow(null, ""),
68484
68708
  visitor: objectIdSchema2.optional().allow(null, ""),
68485
- type: Joi150.string().valid("resident", "staff", "contractor", "visitor", "admin", "unknown").optional(),
68486
- status: Joi150.string().valid("active", "inactive", "deleted").optional(),
68487
- metadata: Joi150.object().unknown(true).optional(),
68488
- deletedAt: Joi150.date().optional()
68709
+ type: Joi151.string().valid("resident", "staff", "contractor", "visitor", "admin", "unknown").optional(),
68710
+ status: Joi151.string().valid("active", "inactive", "deleted").optional(),
68711
+ metadata: Joi151.object().unknown(true).optional(),
68712
+ deletedAt: Joi151.date().optional()
68489
68713
  });
68490
- var schemaHidAmicoReaderIdParams = Joi150.object({
68491
- readerId: Joi150.string().hex().length(24).required()
68714
+ var schemaHidAmicoReaderIdParams = Joi151.object({
68715
+ readerId: Joi151.string().hex().length(24).required()
68492
68716
  });
68493
- var schemaHidAmicoUserImageParams = Joi150.object({
68494
- readerId: Joi150.string().hex().length(24).required(),
68495
- hidUserId: Joi150.alternatives().try(Joi150.string(), Joi150.number()).required()
68717
+ var schemaHidAmicoUserImageParams = Joi151.object({
68718
+ readerId: Joi151.string().hex().length(24).required(),
68719
+ hidUserId: Joi151.alternatives().try(Joi151.string(), Joi151.number()).required()
68496
68720
  });
68497
- var schemaHidAmicoIdentityIdParams = Joi150.object({
68498
- identityId: Joi150.string().hex().length(24).required()
68721
+ var schemaHidAmicoIdentityIdParams = Joi151.object({
68722
+ identityId: Joi151.string().hex().length(24).required()
68499
68723
  });
68500
- var schemaHidAmicoReaderListQuery = Joi150.object({
68501
- site: Joi150.string().hex().length(24).optional(),
68502
- page: Joi150.number().min(1).optional(),
68503
- limit: Joi150.number().min(1).optional()
68724
+ var schemaHidAmicoReaderListQuery = Joi151.object({
68725
+ site: Joi151.string().hex().length(24).optional(),
68726
+ page: Joi151.number().min(1).optional(),
68727
+ limit: Joi151.number().min(1).optional()
68504
68728
  });
68505
- var schemaHidAmicoLogQuery = Joi150.object({
68506
- page: Joi150.number().min(1).optional(),
68507
- limit: Joi150.number().min(1).optional(),
68508
- type: Joi150.string().optional()
68729
+ var schemaHidAmicoLogQuery = Joi151.object({
68730
+ page: Joi151.number().min(1).optional(),
68731
+ limit: Joi151.number().min(1).optional(),
68732
+ type: Joi151.string().optional()
68509
68733
  });
68510
- var schemaHidAmicoIdentityQuery = Joi150.object({
68511
- page: Joi150.number().min(1).optional(),
68512
- limit: Joi150.number().min(1).optional(),
68513
- type: Joi150.string().valid("resident", "staff", "contractor", "visitor", "admin", "unknown").optional(),
68514
- status: Joi150.string().valid("active", "inactive", "deleted").optional(),
68515
- search: Joi150.string().allow("").optional()
68734
+ var schemaHidAmicoIdentityQuery = Joi151.object({
68735
+ page: Joi151.number().min(1).optional(),
68736
+ limit: Joi151.number().min(1).optional(),
68737
+ type: Joi151.string().valid("resident", "staff", "contractor", "visitor", "admin", "unknown").optional(),
68738
+ status: Joi151.string().valid("active", "inactive", "deleted").optional(),
68739
+ search: Joi151.string().allow("").optional()
68516
68740
  });
68517
- var schemaHidAmicoSync = Joi150.object({
68518
- objects: Joi150.array().items(
68519
- Joi150.object({
68520
- object: Joi150.string().required(),
68521
- values: Joi150.array().items(Joi150.object().unknown(true)).required()
68741
+ var schemaHidAmicoSync = Joi151.object({
68742
+ objects: Joi151.array().items(
68743
+ Joi151.object({
68744
+ object: Joi151.string().required(),
68745
+ values: Joi151.array().items(Joi151.object().unknown(true)).required()
68522
68746
  }).unknown(true)
68523
68747
  ).optional(),
68524
- users: Joi150.array().items(Joi150.object().unknown(true)).optional(),
68525
- cards: Joi150.array().items(Joi150.object().unknown(true)).optional(),
68526
- qrcodes: Joi150.array().items(Joi150.object().unknown(true)).optional(),
68527
- pins: Joi150.array().items(Joi150.object().unknown(true)).optional()
68748
+ users: Joi151.array().items(Joi151.object().unknown(true)).optional(),
68749
+ cards: Joi151.array().items(Joi151.object().unknown(true)).optional(),
68750
+ qrcodes: Joi151.array().items(Joi151.object().unknown(true)).optional(),
68751
+ pins: Joi151.array().items(Joi151.object().unknown(true)).optional()
68528
68752
  }).unknown(true);
68529
- var schemaHidAmicoExecuteActions = Joi150.object({
68530
- actions: Joi150.array().items(Joi150.object().unknown(true)).min(1).required()
68753
+ var schemaHidAmicoExecuteActions = Joi151.object({
68754
+ actions: Joi151.array().items(Joi151.object().unknown(true)).min(1).required()
68531
68755
  }).unknown(true);
68532
- var schemaHidAmicoConfiguration = Joi150.object().pattern(Joi150.string(), Joi150.array().items(Joi150.string())).min(1).unknown(true);
68533
- var schemaHidAmicoSetConfiguration = Joi150.object().unknown(true);
68534
- var schemaHidAmicoObjectOperation = Joi150.object({
68535
- operation: Joi150.string().valid("load", "create", "modify", "destroy").required(),
68536
- object: Joi150.string().required(),
68537
- values: Joi150.alternatives().try(
68538
- Joi150.array().items(Joi150.object().unknown(true)),
68539
- Joi150.object().unknown(true)
68756
+ var schemaHidAmicoConfiguration = Joi151.object().pattern(Joi151.string(), Joi151.array().items(Joi151.string())).min(1).unknown(true);
68757
+ var schemaHidAmicoSetConfiguration = Joi151.object().unknown(true);
68758
+ var schemaHidAmicoObjectOperation = Joi151.object({
68759
+ operation: Joi151.string().valid("load", "create", "modify", "destroy").required(),
68760
+ object: Joi151.string().required(),
68761
+ values: Joi151.alternatives().try(
68762
+ Joi151.array().items(Joi151.object().unknown(true)),
68763
+ Joi151.object().unknown(true)
68540
68764
  ).optional(),
68541
- where: Joi150.object().unknown(true).optional(),
68542
- fields: Joi150.array().items(Joi150.string()).optional(),
68543
- order: Joi150.array().items(Joi150.string()).optional(),
68544
- limit: Joi150.number().integer().min(1).optional(),
68545
- offset: Joi150.number().integer().min(0).optional()
68765
+ where: Joi151.object().unknown(true).optional(),
68766
+ fields: Joi151.array().items(Joi151.string()).optional(),
68767
+ order: Joi151.array().items(Joi151.string()).optional(),
68768
+ limit: Joi151.number().integer().min(1).optional(),
68769
+ offset: Joi151.number().integer().min(0).optional()
68546
68770
  }).unknown(true);
68547
- var schemaHidAmicoNotificationParams = Joi150.object({
68548
- readerId: Joi150.string().hex().length(24).required(),
68549
- type: Joi150.string().valid(
68771
+ var schemaHidAmicoNotificationParams = Joi151.object({
68772
+ readerId: Joi151.string().hex().length(24).required(),
68773
+ type: Joi151.string().valid(
68550
68774
  "dao",
68551
68775
  "template",
68552
68776
  "user_image",
@@ -68564,7 +68788,7 @@ var schemaHidAmicoNotificationParams = Joi150.object({
68564
68788
  function MHidAmicoReader(value) {
68565
68789
  const { error } = schemaHidAmicoReader.validate(value);
68566
68790
  if (error) {
68567
- logger198.info(`HID Amico reader: ${error.message}`);
68791
+ logger199.info(`HID Amico reader: ${error.message}`);
68568
68792
  throw new BadRequestError228(error.message);
68569
68793
  }
68570
68794
  return {
@@ -68591,7 +68815,7 @@ function MHidAmicoReader(value) {
68591
68815
  function MHidAmicoEvent(value) {
68592
68816
  const { error } = schemaHidAmicoEvent.validate(value);
68593
68817
  if (error) {
68594
- logger198.info(`HID Amico event: ${error.message}`);
68818
+ logger199.info(`HID Amico event: ${error.message}`);
68595
68819
  throw new BadRequestError228(error.message);
68596
68820
  }
68597
68821
  return {
@@ -68610,7 +68834,7 @@ function optionalObjectId(value) {
68610
68834
  function MHidAmicoIdentity(value) {
68611
68835
  const { error } = schemaHidAmicoIdentity.validate(value);
68612
68836
  if (error) {
68613
- logger198.info(`HID Amico identity: ${error.message}`);
68837
+ logger199.info(`HID Amico identity: ${error.message}`);
68614
68838
  throw new BadRequestError228(error.message);
68615
68839
  }
68616
68840
  return {
@@ -68637,7 +68861,7 @@ function MHidAmicoIdentity(value) {
68637
68861
  import {
68638
68862
  BadRequestError as BadRequestError229,
68639
68863
  InternalServerError as InternalServerError85,
68640
- logger as logger199,
68864
+ logger as logger200,
68641
68865
  paginate as paginate65,
68642
68866
  useAtlas as useAtlas131
68643
68867
  } from "@7365admin1/node-server-utils";
@@ -68714,7 +68938,7 @@ function useHidAmicoRepo() {
68714
68938
  ]);
68715
68939
  return "HID Amico indexes created.";
68716
68940
  } catch (error) {
68717
- logger199.error(error.message);
68941
+ logger200.error(error.message);
68718
68942
  throw new Error("Failed to create HID Amico indexes.");
68719
68943
  }
68720
68944
  }
@@ -69849,6 +70073,7 @@ export {
69849
70073
  building_units_namespace_collection,
69850
70074
  buildings_namespace_collection,
69851
70075
  bulletin_boards_namespace_collection,
70076
+ chatPrelovedEvents,
69852
70077
  chatSchema,
69853
70078
  createManpowerRemarksDaily,
69854
70079
  customerSchema,
@@ -70004,6 +70229,7 @@ export {
70004
70229
  useAuthServiceV2,
70005
70230
  useBidPrelovedController,
70006
70231
  useBidPrelovedRepo,
70232
+ useBidPrelovedService,
70007
70233
  useBuildingController,
70008
70234
  useBuildingLevelController,
70009
70235
  useBuildingLevelRepo,