@7365admin1/core 2.32.0 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +14 -3
- package/dist/index.js +484 -170
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +483 -170
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5547,6 +5547,7 @@ function useRoleRepo() {
|
|
|
5547
5547
|
}).catch((err) => {
|
|
5548
5548
|
logger14.error(`Failed to clear cache for namespace: dashboard`, err);
|
|
5549
5549
|
});
|
|
5550
|
+
return "Successfully deleted role permission.";
|
|
5550
5551
|
} catch (error) {
|
|
5551
5552
|
throw new InternalServerError12("Failed to delete role.");
|
|
5552
5553
|
}
|
|
@@ -13456,7 +13457,8 @@ function useVisitorTransactionRepo() {
|
|
|
13456
13457
|
$project: {
|
|
13457
13458
|
_id: 1,
|
|
13458
13459
|
prefixPass: 1,
|
|
13459
|
-
name: 1
|
|
13460
|
+
name: 1,
|
|
13461
|
+
remarks: 1
|
|
13460
13462
|
}
|
|
13461
13463
|
}
|
|
13462
13464
|
],
|
|
@@ -13469,6 +13471,9 @@ function useVisitorTransactionRepo() {
|
|
|
13469
13471
|
keyId: "$_id",
|
|
13470
13472
|
status: 1,
|
|
13471
13473
|
description: 1,
|
|
13474
|
+
remarks: {
|
|
13475
|
+
$arrayElemAt: ["$template.remarks", 0]
|
|
13476
|
+
},
|
|
13472
13477
|
templatePrefixPass: {
|
|
13473
13478
|
$arrayElemAt: ["$template.prefixPass", 0]
|
|
13474
13479
|
},
|
|
@@ -13505,7 +13510,8 @@ function useVisitorTransactionRepo() {
|
|
|
13505
13510
|
$project: {
|
|
13506
13511
|
_id: 1,
|
|
13507
13512
|
prefixPass: 1,
|
|
13508
|
-
name: 1
|
|
13513
|
+
name: 1,
|
|
13514
|
+
remarks: 1
|
|
13509
13515
|
}
|
|
13510
13516
|
}
|
|
13511
13517
|
],
|
|
@@ -13518,6 +13524,9 @@ function useVisitorTransactionRepo() {
|
|
|
13518
13524
|
keyId: "$_id",
|
|
13519
13525
|
status: 1,
|
|
13520
13526
|
description: 1,
|
|
13527
|
+
remarks: {
|
|
13528
|
+
$arrayElemAt: ["$template.remarks", 0]
|
|
13529
|
+
},
|
|
13521
13530
|
templatePrefixPass: {
|
|
13522
13531
|
$arrayElemAt: ["$template.prefixPass", 0]
|
|
13523
13532
|
},
|
|
@@ -19276,16 +19285,30 @@ function useCustomerSiteRepo() {
|
|
|
19276
19285
|
return cachedData;
|
|
19277
19286
|
}
|
|
19278
19287
|
try {
|
|
19288
|
+
const distinctPipeline = [
|
|
19289
|
+
{ $match: query },
|
|
19290
|
+
{ $sort: sort },
|
|
19291
|
+
{ $group: { _id: { name: "$name", site: "$site" }, doc: { $first: "$$ROOT" } } },
|
|
19292
|
+
{ $replaceRoot: { newRoot: "$doc" } },
|
|
19293
|
+
{ $sort: sort }
|
|
19294
|
+
];
|
|
19279
19295
|
const items = await collection.aggregate(
|
|
19280
19296
|
[
|
|
19281
|
-
|
|
19282
|
-
{ $sort: sort },
|
|
19297
|
+
...distinctPipeline,
|
|
19283
19298
|
{ $skip: page * limit },
|
|
19284
19299
|
{ $limit: limit }
|
|
19285
19300
|
],
|
|
19286
19301
|
{ session }
|
|
19287
19302
|
).toArray();
|
|
19288
|
-
const
|
|
19303
|
+
const countResult = await collection.aggregate(
|
|
19304
|
+
[
|
|
19305
|
+
{ $match: query },
|
|
19306
|
+
{ $group: { _id: { name: "$name", site: "$site" } } },
|
|
19307
|
+
{ $count: "total" }
|
|
19308
|
+
],
|
|
19309
|
+
{ session }
|
|
19310
|
+
).toArray();
|
|
19311
|
+
const length = countResult[0]?.total ?? 0;
|
|
19289
19312
|
const data = paginate22(items, page, limit, length);
|
|
19290
19313
|
setCache(cacheKey, data, 15 * 60).then(() => {
|
|
19291
19314
|
logger67.info(`Cache set for key: ${cacheKey}`);
|
|
@@ -21402,7 +21425,8 @@ var KeyRepo = class {
|
|
|
21402
21425
|
location: 1,
|
|
21403
21426
|
prefix: 1,
|
|
21404
21427
|
keyNo: 1,
|
|
21405
|
-
parentId: 1
|
|
21428
|
+
parentId: 1,
|
|
21429
|
+
status: 1
|
|
21406
21430
|
}
|
|
21407
21431
|
}
|
|
21408
21432
|
]).toArray();
|
|
@@ -21645,7 +21669,8 @@ function useVisitorTransactionService() {
|
|
|
21645
21669
|
add: _add,
|
|
21646
21670
|
updateById: _updateVisitorTansactionById,
|
|
21647
21671
|
getExpiredCheckedOutTransactionsBySite: _getExpiredCheckedOutTransactionsBySite,
|
|
21648
|
-
updateManyDahuaSyncStatus: _updateManyDahuaSyncStatus
|
|
21672
|
+
updateManyDahuaSyncStatus: _updateManyDahuaSyncStatus,
|
|
21673
|
+
getVisitorTransactionById: _getVisitorTransactionById
|
|
21649
21674
|
} = useVisitorTransactionRepo();
|
|
21650
21675
|
const { getById } = useBuildingUnitRepo();
|
|
21651
21676
|
const {
|
|
@@ -21664,6 +21689,70 @@ function useVisitorTransactionService() {
|
|
|
21664
21689
|
const { getAllSites: _getAllSites } = useSiteRepo();
|
|
21665
21690
|
const { getByUserId: _getByUserId } = usePersonRepo();
|
|
21666
21691
|
const { add: addVehicle } = useVehicleRepo();
|
|
21692
|
+
function extractKeyId(item) {
|
|
21693
|
+
if (!item)
|
|
21694
|
+
return null;
|
|
21695
|
+
if (typeof item === "string") {
|
|
21696
|
+
return ObjectId58.isValid(item) ? item : null;
|
|
21697
|
+
}
|
|
21698
|
+
if (typeof item === "object" && item !== null) {
|
|
21699
|
+
if ("keyId" in item) {
|
|
21700
|
+
const keyId = String(item.keyId);
|
|
21701
|
+
return ObjectId58.isValid(keyId) ? keyId : null;
|
|
21702
|
+
}
|
|
21703
|
+
const value = String(item);
|
|
21704
|
+
return ObjectId58.isValid(value) ? value : null;
|
|
21705
|
+
}
|
|
21706
|
+
return null;
|
|
21707
|
+
}
|
|
21708
|
+
function normalizeKeyRefs(items) {
|
|
21709
|
+
if (!Array.isArray(items))
|
|
21710
|
+
return [];
|
|
21711
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21712
|
+
const normalized = [];
|
|
21713
|
+
for (const item of items) {
|
|
21714
|
+
const keyId = extractKeyId(item);
|
|
21715
|
+
if (!keyId || seen.has(keyId))
|
|
21716
|
+
continue;
|
|
21717
|
+
seen.add(keyId);
|
|
21718
|
+
normalized.push({ keyId: new ObjectId58(keyId) });
|
|
21719
|
+
}
|
|
21720
|
+
return normalized;
|
|
21721
|
+
}
|
|
21722
|
+
async function syncTransactionKeys({
|
|
21723
|
+
current,
|
|
21724
|
+
incoming,
|
|
21725
|
+
site,
|
|
21726
|
+
session
|
|
21727
|
+
}) {
|
|
21728
|
+
const currentIds = current.map((item) => item.keyId.toString());
|
|
21729
|
+
const incomingIds = incoming.map((item) => item.keyId.toString());
|
|
21730
|
+
const currentSet = new Set(currentIds);
|
|
21731
|
+
const incomingSet = new Set(incomingIds);
|
|
21732
|
+
const removedIds = currentIds.filter((id) => !incomingSet.has(id));
|
|
21733
|
+
const addedIds = incomingIds.filter((id) => !currentSet.has(id));
|
|
21734
|
+
for (const keyId of removedIds) {
|
|
21735
|
+
const existingKey = await KeyRepo.getById(keyId);
|
|
21736
|
+
if (!existingKey)
|
|
21737
|
+
continue;
|
|
21738
|
+
if (existingKey.status === "In Use" /* IN_USE */) {
|
|
21739
|
+
await KeyRepo.updateKeyById(
|
|
21740
|
+
keyId,
|
|
21741
|
+
{ status: "Available" /* AVAILABLE */ },
|
|
21742
|
+
site,
|
|
21743
|
+
session
|
|
21744
|
+
);
|
|
21745
|
+
}
|
|
21746
|
+
}
|
|
21747
|
+
for (const keyId of addedIds) {
|
|
21748
|
+
await KeyRepo.updateKeyById(
|
|
21749
|
+
keyId,
|
|
21750
|
+
{ status: "In Use" /* IN_USE */ },
|
|
21751
|
+
site,
|
|
21752
|
+
session
|
|
21753
|
+
);
|
|
21754
|
+
}
|
|
21755
|
+
}
|
|
21667
21756
|
async function add(value) {
|
|
21668
21757
|
const session = useAtlas48.getClient()?.startSession();
|
|
21669
21758
|
const allowedPersonTypes = [
|
|
@@ -21908,7 +21997,7 @@ function useVisitorTransactionService() {
|
|
|
21908
21997
|
session?.endSession();
|
|
21909
21998
|
}
|
|
21910
21999
|
}
|
|
21911
|
-
async function
|
|
22000
|
+
async function updateVisitorTransactionById(id, value) {
|
|
21912
22001
|
const session = useAtlas48.getClient()?.startSession();
|
|
21913
22002
|
session?.startTransaction();
|
|
21914
22003
|
try {
|
|
@@ -22084,18 +22173,70 @@ function useVisitorTransactionService() {
|
|
|
22084
22173
|
await session?.commitTransaction();
|
|
22085
22174
|
return result;
|
|
22086
22175
|
} catch (error) {
|
|
22087
|
-
logger77.error("Error in
|
|
22176
|
+
logger77.error("Error in visitor transaction invite visitor:", error);
|
|
22088
22177
|
await session.abortTransaction();
|
|
22089
22178
|
throw error;
|
|
22090
22179
|
} finally {
|
|
22091
22180
|
session?.endSession();
|
|
22092
22181
|
}
|
|
22093
22182
|
}
|
|
22183
|
+
async function changeVisitorTransactionKeysById(id, visitorPass, passKeys) {
|
|
22184
|
+
const session = useAtlas48.getClient()?.startSession();
|
|
22185
|
+
if (!session) {
|
|
22186
|
+
throw new Error(
|
|
22187
|
+
"Unable to start session for visitor transaction service."
|
|
22188
|
+
);
|
|
22189
|
+
}
|
|
22190
|
+
try {
|
|
22191
|
+
session.startTransaction();
|
|
22192
|
+
const visitorTransaction = await _getVisitorTransactionById(id);
|
|
22193
|
+
if (!visitorTransaction) {
|
|
22194
|
+
throw new Error("Visitor transaction not found.");
|
|
22195
|
+
}
|
|
22196
|
+
const updatePayload = {};
|
|
22197
|
+
if (visitorPass !== void 0) {
|
|
22198
|
+
const currentVisitorPass = normalizeKeyRefs(
|
|
22199
|
+
visitorTransaction.visitorPass
|
|
22200
|
+
);
|
|
22201
|
+
const incomingVisitorPass = normalizeKeyRefs(visitorPass);
|
|
22202
|
+
await syncTransactionKeys({
|
|
22203
|
+
current: currentVisitorPass,
|
|
22204
|
+
incoming: incomingVisitorPass,
|
|
22205
|
+
site: visitorTransaction.site,
|
|
22206
|
+
session
|
|
22207
|
+
});
|
|
22208
|
+
updatePayload.visitorPass = incomingVisitorPass;
|
|
22209
|
+
}
|
|
22210
|
+
if (passKeys !== void 0) {
|
|
22211
|
+
const currentPassKeys = normalizeKeyRefs(visitorTransaction.passKeys);
|
|
22212
|
+
const incomingPassKeys = normalizeKeyRefs(passKeys);
|
|
22213
|
+
await syncTransactionKeys({
|
|
22214
|
+
current: currentPassKeys,
|
|
22215
|
+
incoming: incomingPassKeys,
|
|
22216
|
+
site: visitorTransaction.site,
|
|
22217
|
+
session
|
|
22218
|
+
});
|
|
22219
|
+
updatePayload.passKeys = incomingPassKeys;
|
|
22220
|
+
}
|
|
22221
|
+
if (Object.keys(updatePayload).length > 0) {
|
|
22222
|
+
await _updateVisitorTansactionById(id, updatePayload, session);
|
|
22223
|
+
}
|
|
22224
|
+
await session.commitTransaction();
|
|
22225
|
+
return "Successfully changed visitor transaction keys.";
|
|
22226
|
+
} catch (error) {
|
|
22227
|
+
await session.abortTransaction();
|
|
22228
|
+
logger77.error("Error in visitor transaction change keys by id:", error);
|
|
22229
|
+
throw error;
|
|
22230
|
+
} finally {
|
|
22231
|
+
session.endSession();
|
|
22232
|
+
}
|
|
22233
|
+
}
|
|
22094
22234
|
return {
|
|
22095
22235
|
add,
|
|
22096
|
-
|
|
22236
|
+
updateVisitorTransactionById,
|
|
22097
22237
|
processTransactionDahuaStatus,
|
|
22098
|
-
inviteVisitor
|
|
22238
|
+
inviteVisitor,
|
|
22239
|
+
changeVisitorTransactionKeysById
|
|
22099
22240
|
};
|
|
22100
22241
|
}
|
|
22101
22242
|
|
|
@@ -22105,8 +22246,9 @@ import { BadRequestError as BadRequestError97, logger as logger78 } from "@7365a
|
|
|
22105
22246
|
function useVisitorTransactionController() {
|
|
22106
22247
|
const {
|
|
22107
22248
|
add: _add,
|
|
22108
|
-
|
|
22109
|
-
inviteVisitor: _inviteVisitor
|
|
22249
|
+
updateVisitorTransactionById: _updateVisitorTransactionById,
|
|
22250
|
+
inviteVisitor: _inviteVisitor,
|
|
22251
|
+
changeVisitorTransactionKeysById: _changeVisitorTransactionKeysById
|
|
22110
22252
|
} = useVisitorTransactionService();
|
|
22111
22253
|
const {
|
|
22112
22254
|
getAll: _getAll,
|
|
@@ -22248,7 +22390,7 @@ function useVisitorTransactionController() {
|
|
|
22248
22390
|
return;
|
|
22249
22391
|
}
|
|
22250
22392
|
try {
|
|
22251
|
-
await
|
|
22393
|
+
await _updateVisitorTransactionById(_id, req.body);
|
|
22252
22394
|
res.status(200).json({ message: "Successfully updated visitor transaction." });
|
|
22253
22395
|
return;
|
|
22254
22396
|
} catch (error2) {
|
|
@@ -22302,8 +22444,31 @@ function useVisitorTransactionController() {
|
|
|
22302
22444
|
next(new BadRequestError97(messages));
|
|
22303
22445
|
return;
|
|
22304
22446
|
}
|
|
22305
|
-
const {
|
|
22306
|
-
|
|
22447
|
+
const {
|
|
22448
|
+
expectedCheckIn,
|
|
22449
|
+
arrivalTime,
|
|
22450
|
+
duration,
|
|
22451
|
+
name,
|
|
22452
|
+
contact,
|
|
22453
|
+
email,
|
|
22454
|
+
plateNumber,
|
|
22455
|
+
isOvernightParking,
|
|
22456
|
+
numberOfPassengers,
|
|
22457
|
+
purpose,
|
|
22458
|
+
inviterUserId
|
|
22459
|
+
} = value;
|
|
22460
|
+
const rest = {
|
|
22461
|
+
expectedCheckIn,
|
|
22462
|
+
arrivalTime,
|
|
22463
|
+
duration,
|
|
22464
|
+
name,
|
|
22465
|
+
contact,
|
|
22466
|
+
email,
|
|
22467
|
+
plateNumber,
|
|
22468
|
+
isOvernightParking,
|
|
22469
|
+
numberOfPassengers,
|
|
22470
|
+
purpose
|
|
22471
|
+
};
|
|
22307
22472
|
try {
|
|
22308
22473
|
const result = await _inviteVisitor(rest, inviterUserId);
|
|
22309
22474
|
res.status(200).json({ insertedId: result });
|
|
@@ -22314,13 +22479,61 @@ function useVisitorTransactionController() {
|
|
|
22314
22479
|
return;
|
|
22315
22480
|
}
|
|
22316
22481
|
}
|
|
22482
|
+
async function changeVisitorTransactionKeysById(req, res, next) {
|
|
22483
|
+
const idValidation = Joi55.string().hex().length(24).required();
|
|
22484
|
+
const bodyValidation = Joi55.object({
|
|
22485
|
+
visitorPass: Joi55.array().items(
|
|
22486
|
+
Joi55.object({
|
|
22487
|
+
keyId: Joi55.string().hex().length(24).required()
|
|
22488
|
+
})
|
|
22489
|
+
).optional(),
|
|
22490
|
+
passKeys: Joi55.array().items(
|
|
22491
|
+
Joi55.object({
|
|
22492
|
+
keyId: Joi55.string().hex().length(24).required()
|
|
22493
|
+
})
|
|
22494
|
+
).optional()
|
|
22495
|
+
}).or("visitorPass", "passKeys");
|
|
22496
|
+
const _id = req.params.id;
|
|
22497
|
+
const { error: idError } = idValidation.validate(_id);
|
|
22498
|
+
if (idError) {
|
|
22499
|
+
logger78.log({ level: "error", message: idError.message });
|
|
22500
|
+
next(new BadRequestError97(idError.message));
|
|
22501
|
+
return;
|
|
22502
|
+
}
|
|
22503
|
+
const { error, value } = bodyValidation.validate(req.body, {
|
|
22504
|
+
abortEarly: false
|
|
22505
|
+
});
|
|
22506
|
+
if (error) {
|
|
22507
|
+
const message = error.details.map((d) => d.message).join(", ");
|
|
22508
|
+
logger78.log({ level: "error", message });
|
|
22509
|
+
next(new BadRequestError97(message));
|
|
22510
|
+
return;
|
|
22511
|
+
}
|
|
22512
|
+
try {
|
|
22513
|
+
const { visitorPass, passKeys } = value;
|
|
22514
|
+
const result = await _changeVisitorTransactionKeysById(
|
|
22515
|
+
_id,
|
|
22516
|
+
visitorPass,
|
|
22517
|
+
passKeys
|
|
22518
|
+
);
|
|
22519
|
+
res.status(200).json({
|
|
22520
|
+
message: result || "Successfully changed visitor transaction keys."
|
|
22521
|
+
});
|
|
22522
|
+
return;
|
|
22523
|
+
} catch (error2) {
|
|
22524
|
+
logger78.log({ level: "error", message: error2.message });
|
|
22525
|
+
next(error2);
|
|
22526
|
+
return;
|
|
22527
|
+
}
|
|
22528
|
+
}
|
|
22317
22529
|
return {
|
|
22318
22530
|
add,
|
|
22319
22531
|
getAll,
|
|
22320
22532
|
updateVisitorTansactionById,
|
|
22321
22533
|
deleteVisitorTransaction,
|
|
22322
22534
|
inviteVisitor,
|
|
22323
|
-
getVisitorTransactionById
|
|
22535
|
+
getVisitorTransactionById,
|
|
22536
|
+
changeVisitorTransactionKeysById
|
|
22324
22537
|
};
|
|
22325
22538
|
}
|
|
22326
22539
|
|
|
@@ -36517,6 +36730,10 @@ var schemaSOABillingItem = Joi92.object({
|
|
|
36517
36730
|
taxPercentage: Joi92.number().optional().allow(null),
|
|
36518
36731
|
taxAmount: Joi92.number().optional().allow(null)
|
|
36519
36732
|
});
|
|
36733
|
+
var schemaApprovedBy = Joi92.object({
|
|
36734
|
+
_id: Joi92.string().hex().optional().allow(null, ""),
|
|
36735
|
+
name: Joi92.string().optional().allow(null, "")
|
|
36736
|
+
});
|
|
36520
36737
|
var schemaStatementOfAccount = Joi92.object({
|
|
36521
36738
|
_id: Joi92.string().hex().optional(),
|
|
36522
36739
|
site: Joi92.string().hex().required(),
|
|
@@ -36530,6 +36747,7 @@ var schemaStatementOfAccount = Joi92.object({
|
|
|
36530
36747
|
category: Joi92.string().optional().allow(null, ""),
|
|
36531
36748
|
status: Joi92.string().valid("pending", "approved", "rejected", "deleted").optional().allow(null, ""),
|
|
36532
36749
|
billing: Joi92.array().items(schemaSOABillingItem).optional().allow(null, ""),
|
|
36750
|
+
approvedBy: schemaApprovedBy.optional().allow(null, ""),
|
|
36533
36751
|
createdBy: Joi92.string().hex().required(),
|
|
36534
36752
|
createdByName: Joi92.string().optional().allow(null, ""),
|
|
36535
36753
|
createdAt: Joi92.date().optional(),
|
|
@@ -36549,6 +36767,7 @@ var schemaUpdateStatementOfAccount = Joi92.object({
|
|
|
36549
36767
|
category: Joi92.string().optional().allow(null, ""),
|
|
36550
36768
|
status: Joi92.string().valid("pending", "approved", "rejected", "deleted").optional().allow(null, ""),
|
|
36551
36769
|
billing: Joi92.array().items(schemaSOABillingItem).optional().allow(null, ""),
|
|
36770
|
+
approvedBy: schemaApprovedBy.optional().allow(null, ""),
|
|
36552
36771
|
createdBy: Joi92.string().optional().allow(null, ""),
|
|
36553
36772
|
createdByName: Joi92.string().optional().allow(null, "")
|
|
36554
36773
|
});
|
|
@@ -36613,6 +36832,7 @@ function MStatementOfAccount(value) {
|
|
|
36613
36832
|
status: value.status ?? "pending",
|
|
36614
36833
|
createdBy: value.createdBy,
|
|
36615
36834
|
createdByName: value.createdByName ?? "",
|
|
36835
|
+
approvedBy: value.approvedBy,
|
|
36616
36836
|
createdAt: value.createdAt ?? /* @__PURE__ */ new Date(),
|
|
36617
36837
|
updatedAt: value.updatedAt ?? "",
|
|
36618
36838
|
deletedAt: value.deletedAt ?? ""
|
|
@@ -36951,6 +37171,35 @@ function useStatementOfAccountRepo() {
|
|
|
36951
37171
|
});
|
|
36952
37172
|
});
|
|
36953
37173
|
}
|
|
37174
|
+
async function reviewSOA(_id, value, session) {
|
|
37175
|
+
value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
37176
|
+
try {
|
|
37177
|
+
_id = new ObjectId97(_id);
|
|
37178
|
+
} catch (error) {
|
|
37179
|
+
throw new BadRequestError151("Invalid ID format.");
|
|
37180
|
+
}
|
|
37181
|
+
try {
|
|
37182
|
+
const res = await collection.updateOne(
|
|
37183
|
+
{ _id },
|
|
37184
|
+
{ $set: value },
|
|
37185
|
+
{ session }
|
|
37186
|
+
);
|
|
37187
|
+
if (res.modifiedCount === 0) {
|
|
37188
|
+
throw new InternalServerError50(`Unable to ${value.status} soa.`);
|
|
37189
|
+
}
|
|
37190
|
+
delNamespace().then(() => {
|
|
37191
|
+
logger128.info(`Cache cleared for namespace: ${namespace_collection}`);
|
|
37192
|
+
}).catch((err) => {
|
|
37193
|
+
logger128.error(
|
|
37194
|
+
`Failed to clear cache for namespace: ${namespace_collection}`,
|
|
37195
|
+
err
|
|
37196
|
+
);
|
|
37197
|
+
});
|
|
37198
|
+
return res;
|
|
37199
|
+
} catch (error) {
|
|
37200
|
+
throw error;
|
|
37201
|
+
}
|
|
37202
|
+
}
|
|
36954
37203
|
return {
|
|
36955
37204
|
createTextIndex,
|
|
36956
37205
|
add,
|
|
@@ -36959,7 +37208,8 @@ function useStatementOfAccountRepo() {
|
|
|
36959
37208
|
updateById,
|
|
36960
37209
|
deleteById,
|
|
36961
37210
|
updateStatusById,
|
|
36962
|
-
getResidentUserSoa
|
|
37211
|
+
getResidentUserSoa,
|
|
37212
|
+
reviewSOA
|
|
36963
37213
|
};
|
|
36964
37214
|
}
|
|
36965
37215
|
|
|
@@ -36972,9 +37222,10 @@ import {
|
|
|
36972
37222
|
logger as logger129,
|
|
36973
37223
|
useAtlas as useAtlas83
|
|
36974
37224
|
} from "@7365admin1/node-server-utils";
|
|
37225
|
+
import { ObjectId as ObjectId98 } from "mongodb";
|
|
36975
37226
|
import { launch } from "puppeteer";
|
|
36976
37227
|
function useStatementOfAccountService() {
|
|
36977
|
-
const { add: _add } = useStatementOfAccountRepo();
|
|
37228
|
+
const { add: _add, reviewSOA: _reviewSOA } = useStatementOfAccountRepo();
|
|
36978
37229
|
const { getUnitBillingBySite } = useSiteUnitBillingRepo();
|
|
36979
37230
|
const { getUserById } = useUserRepo();
|
|
36980
37231
|
async function add(value, dateFrom, dateTo) {
|
|
@@ -37102,9 +37353,31 @@ function useStatementOfAccountService() {
|
|
|
37102
37353
|
throw error;
|
|
37103
37354
|
}
|
|
37104
37355
|
}
|
|
37356
|
+
async function reviewSOA(id, value) {
|
|
37357
|
+
const session = useAtlas83.getClient()?.startSession();
|
|
37358
|
+
session?.startTransaction();
|
|
37359
|
+
try {
|
|
37360
|
+
if (value?.approvedBy?._id) {
|
|
37361
|
+
const approvedBy = await getUserById(value?.approvedBy?._id);
|
|
37362
|
+
if (!approvedBy || !approvedBy.name)
|
|
37363
|
+
throw new BadRequestError152("Created by not found.");
|
|
37364
|
+
value.approvedBy.name = approvedBy.name;
|
|
37365
|
+
value.approvedBy._id = new ObjectId98(approvedBy._id);
|
|
37366
|
+
}
|
|
37367
|
+
await _reviewSOA(id, value, session);
|
|
37368
|
+
await session?.commitTransaction();
|
|
37369
|
+
return `Successfully ${value.status} soa.`;
|
|
37370
|
+
} catch (error) {
|
|
37371
|
+
await session?.abortTransaction();
|
|
37372
|
+
throw error;
|
|
37373
|
+
} finally {
|
|
37374
|
+
session?.endSession();
|
|
37375
|
+
}
|
|
37376
|
+
}
|
|
37105
37377
|
return {
|
|
37106
37378
|
add,
|
|
37107
|
-
generatePDF
|
|
37379
|
+
generatePDF,
|
|
37380
|
+
reviewSOA
|
|
37108
37381
|
};
|
|
37109
37382
|
}
|
|
37110
37383
|
|
|
@@ -37119,7 +37392,11 @@ function useStatementOfAccountController() {
|
|
|
37119
37392
|
updateStatusById: _updateStatusById,
|
|
37120
37393
|
getResidentUserSoa: _getResidentUserSoa
|
|
37121
37394
|
} = useStatementOfAccountRepo();
|
|
37122
|
-
const {
|
|
37395
|
+
const {
|
|
37396
|
+
add: _add,
|
|
37397
|
+
generatePDF: _generatePDF,
|
|
37398
|
+
reviewSOA: _reviewSOA
|
|
37399
|
+
} = useStatementOfAccountService();
|
|
37123
37400
|
async function add(req, res, next) {
|
|
37124
37401
|
const cookies = req.headers.cookie?.split(";").map((cookie) => cookie.trim().split("=")).reduce(
|
|
37125
37402
|
(acc, [key, value]) => ({ ...acc, [key]: value }),
|
|
@@ -37419,6 +37696,40 @@ function useStatementOfAccountController() {
|
|
|
37419
37696
|
return;
|
|
37420
37697
|
}
|
|
37421
37698
|
}
|
|
37699
|
+
async function reviewSOA(req, res, next) {
|
|
37700
|
+
const cookies = req.headers.cookie?.split(";").map((cookie) => cookie.trim().split("=")).reduce(
|
|
37701
|
+
(acc, [key, value]) => ({ ...acc, [key]: value }),
|
|
37702
|
+
{}
|
|
37703
|
+
);
|
|
37704
|
+
req.body.approvedBy = {
|
|
37705
|
+
_id: "",
|
|
37706
|
+
name: ""
|
|
37707
|
+
};
|
|
37708
|
+
req.body.approvedBy._id = cookies?.["user"] ? cookies["user"].toString() : req.body.approvedBy._id;
|
|
37709
|
+
const _id = req.params.id;
|
|
37710
|
+
const payload = { _id, ...req.body };
|
|
37711
|
+
const schema2 = Joi93.object({
|
|
37712
|
+
_id: Joi93.string().hex().required(),
|
|
37713
|
+
status: Joi93.string().valid("approved", "rejected").required(),
|
|
37714
|
+
approvedBy: schemaApprovedBy
|
|
37715
|
+
});
|
|
37716
|
+
const { error } = schema2.validate(payload);
|
|
37717
|
+
if (error) {
|
|
37718
|
+
const messages = error.details.map((d) => d.message).join(", ");
|
|
37719
|
+
logger130.log({ level: "error", message: messages });
|
|
37720
|
+
next(new BadRequestError153(messages));
|
|
37721
|
+
return;
|
|
37722
|
+
}
|
|
37723
|
+
try {
|
|
37724
|
+
const result = await _reviewSOA(_id, req.body);
|
|
37725
|
+
res.status(200).json({ message: result });
|
|
37726
|
+
return;
|
|
37727
|
+
} catch (error2) {
|
|
37728
|
+
logger130.log({ level: "error", message: error2.message });
|
|
37729
|
+
next(error2);
|
|
37730
|
+
return;
|
|
37731
|
+
}
|
|
37732
|
+
}
|
|
37422
37733
|
return {
|
|
37423
37734
|
add,
|
|
37424
37735
|
getAll,
|
|
@@ -37427,13 +37738,14 @@ function useStatementOfAccountController() {
|
|
|
37427
37738
|
deleteById,
|
|
37428
37739
|
generatePDF,
|
|
37429
37740
|
updateStatusById,
|
|
37430
|
-
getResidentUserSoa
|
|
37741
|
+
getResidentUserSoa,
|
|
37742
|
+
reviewSOA
|
|
37431
37743
|
};
|
|
37432
37744
|
}
|
|
37433
37745
|
|
|
37434
37746
|
// src/models/site-entrypass-settings.model.ts
|
|
37435
37747
|
import { BadRequestError as BadRequestError154, logger as logger131 } from "@7365admin1/node-server-utils";
|
|
37436
|
-
import { ObjectId as
|
|
37748
|
+
import { ObjectId as ObjectId99 } from "mongodb";
|
|
37437
37749
|
import Joi94 from "joi";
|
|
37438
37750
|
var schemaEntryPassSettings = Joi94.object({
|
|
37439
37751
|
_id: Joi94.string().hex().optional().allow("", null),
|
|
@@ -37481,21 +37793,21 @@ function MEntryPassSettings(value) {
|
|
|
37481
37793
|
}
|
|
37482
37794
|
if (value._id && typeof value._id === "string") {
|
|
37483
37795
|
try {
|
|
37484
|
-
value._id = new
|
|
37796
|
+
value._id = new ObjectId99(value._id);
|
|
37485
37797
|
} catch {
|
|
37486
37798
|
throw new BadRequestError154("Invalid _id format");
|
|
37487
37799
|
}
|
|
37488
37800
|
}
|
|
37489
37801
|
if (value.site && typeof value.site === "string") {
|
|
37490
37802
|
try {
|
|
37491
|
-
value.site = new
|
|
37803
|
+
value.site = new ObjectId99(value.site);
|
|
37492
37804
|
} catch {
|
|
37493
37805
|
throw new BadRequestError154("Invalid site format");
|
|
37494
37806
|
}
|
|
37495
37807
|
}
|
|
37496
37808
|
if (value.org && typeof value.org === "string") {
|
|
37497
37809
|
try {
|
|
37498
|
-
value.org = new
|
|
37810
|
+
value.org = new ObjectId99(value.org);
|
|
37499
37811
|
} catch {
|
|
37500
37812
|
throw new BadRequestError154("Invalid org format");
|
|
37501
37813
|
}
|
|
@@ -37534,7 +37846,7 @@ import {
|
|
|
37534
37846
|
useAtlas as useAtlas84,
|
|
37535
37847
|
useCache as useCache51
|
|
37536
37848
|
} from "@7365admin1/node-server-utils";
|
|
37537
|
-
import { ObjectId as
|
|
37849
|
+
import { ObjectId as ObjectId100 } from "mongodb";
|
|
37538
37850
|
function useEntryPassSettingsRepo() {
|
|
37539
37851
|
const db = useAtlas84.getDb();
|
|
37540
37852
|
if (!db) {
|
|
@@ -37644,7 +37956,7 @@ function useEntryPassSettingsRepo() {
|
|
|
37644
37956
|
}
|
|
37645
37957
|
async function getEntryPassSettingsById(_id) {
|
|
37646
37958
|
try {
|
|
37647
|
-
_id = new
|
|
37959
|
+
_id = new ObjectId100(_id);
|
|
37648
37960
|
} catch (error) {
|
|
37649
37961
|
throw new BadRequestError155("Invalid entry pass settings ID format.");
|
|
37650
37962
|
}
|
|
@@ -37711,7 +38023,7 @@ function useEntryPassSettingsRepo() {
|
|
|
37711
38023
|
}
|
|
37712
38024
|
async function updateEntryPassSettingsById(_id, value) {
|
|
37713
38025
|
try {
|
|
37714
|
-
_id = new
|
|
38026
|
+
_id = new ObjectId100(_id);
|
|
37715
38027
|
} catch (error) {
|
|
37716
38028
|
throw new BadRequestError155("Invalid entry pass settings ID format.");
|
|
37717
38029
|
}
|
|
@@ -37739,7 +38051,7 @@ function useEntryPassSettingsRepo() {
|
|
|
37739
38051
|
}
|
|
37740
38052
|
async function deleteEntryPassSettingsById(_id, session) {
|
|
37741
38053
|
try {
|
|
37742
|
-
_id = new
|
|
38054
|
+
_id = new ObjectId100(_id);
|
|
37743
38055
|
} catch (error) {
|
|
37744
38056
|
throw new BadRequestError155("Invalid card ID format.");
|
|
37745
38057
|
}
|
|
@@ -37772,7 +38084,7 @@ function useEntryPassSettingsRepo() {
|
|
|
37772
38084
|
}
|
|
37773
38085
|
async function getEntryPassSettingsBySiteId(site) {
|
|
37774
38086
|
try {
|
|
37775
|
-
site = new
|
|
38087
|
+
site = new ObjectId100(site);
|
|
37776
38088
|
} catch (error) {
|
|
37777
38089
|
throw new BadRequestError155("Invalid entry pass settings ID format.");
|
|
37778
38090
|
}
|
|
@@ -37839,7 +38151,7 @@ function useEntryPassSettingsRepo() {
|
|
|
37839
38151
|
}
|
|
37840
38152
|
async function updateEntryPassSettingsBySiteId(site, value) {
|
|
37841
38153
|
try {
|
|
37842
|
-
site = new
|
|
38154
|
+
site = new ObjectId100(site);
|
|
37843
38155
|
} catch (error) {
|
|
37844
38156
|
throw new BadRequestError155("Invalid entry pass settings ID format.");
|
|
37845
38157
|
}
|
|
@@ -38204,7 +38516,7 @@ function useDashboardController() {
|
|
|
38204
38516
|
}
|
|
38205
38517
|
|
|
38206
38518
|
// src/models/nfc-patrol-route.model.ts
|
|
38207
|
-
import { ObjectId as
|
|
38519
|
+
import { ObjectId as ObjectId101 } from "mongodb";
|
|
38208
38520
|
import Joi97 from "joi";
|
|
38209
38521
|
import { BadRequestError as BadRequestError158, logger as logger136 } from "@7365admin1/node-server-utils";
|
|
38210
38522
|
var schemaNfcPatrolRoute = Joi97.object({
|
|
@@ -38240,23 +38552,23 @@ function MNfcPatrolRoute(value) {
|
|
|
38240
38552
|
}
|
|
38241
38553
|
if (value._id && typeof value._id === "string") {
|
|
38242
38554
|
try {
|
|
38243
|
-
value._id = new
|
|
38555
|
+
value._id = new ObjectId101(value._id);
|
|
38244
38556
|
} catch (error2) {
|
|
38245
38557
|
throw new BadRequestError158("Invalid _id format");
|
|
38246
38558
|
}
|
|
38247
38559
|
}
|
|
38248
38560
|
try {
|
|
38249
|
-
value.site = new
|
|
38561
|
+
value.site = new ObjectId101(value.site);
|
|
38250
38562
|
} catch (error2) {
|
|
38251
38563
|
throw new BadRequestError158("Invalid site format");
|
|
38252
38564
|
}
|
|
38253
38565
|
try {
|
|
38254
|
-
value.createdBy = new
|
|
38566
|
+
value.createdBy = new ObjectId101(value.createdBy);
|
|
38255
38567
|
} catch (error2) {
|
|
38256
38568
|
throw new BadRequestError158("Invalid createdBy format");
|
|
38257
38569
|
}
|
|
38258
38570
|
return {
|
|
38259
|
-
_id: value._id ?? new
|
|
38571
|
+
_id: value._id ?? new ObjectId101(),
|
|
38260
38572
|
site: value.site,
|
|
38261
38573
|
name: value.name,
|
|
38262
38574
|
checkPointNumber: value.checkPointNumber,
|
|
@@ -38281,7 +38593,7 @@ import {
|
|
|
38281
38593
|
useAtlas as useAtlas86,
|
|
38282
38594
|
useCache as useCache53
|
|
38283
38595
|
} from "@7365admin1/node-server-utils";
|
|
38284
|
-
import { ObjectId as
|
|
38596
|
+
import { ObjectId as ObjectId102 } from "mongodb";
|
|
38285
38597
|
function useNfcPatrolRouteRepo() {
|
|
38286
38598
|
const db = useAtlas86.getDb();
|
|
38287
38599
|
if (!db) {
|
|
@@ -38325,7 +38637,7 @@ function useNfcPatrolRouteRepo() {
|
|
|
38325
38637
|
}, session) {
|
|
38326
38638
|
page = page > 0 ? page - 1 : 0;
|
|
38327
38639
|
try {
|
|
38328
|
-
site = new
|
|
38640
|
+
site = new ObjectId102(site);
|
|
38329
38641
|
} catch (error) {
|
|
38330
38642
|
throw new BadRequestError159("Invalid site ID format.");
|
|
38331
38643
|
}
|
|
@@ -38396,7 +38708,7 @@ function useNfcPatrolRouteRepo() {
|
|
|
38396
38708
|
}
|
|
38397
38709
|
async function getById(_id, isStart) {
|
|
38398
38710
|
try {
|
|
38399
|
-
_id = new
|
|
38711
|
+
_id = new ObjectId102(_id);
|
|
38400
38712
|
} catch (error) {
|
|
38401
38713
|
throw new BadRequestError159("Invalid ID.");
|
|
38402
38714
|
}
|
|
@@ -38506,18 +38818,18 @@ function useNfcPatrolRouteRepo() {
|
|
|
38506
38818
|
throw new BadRequestError159(error.message);
|
|
38507
38819
|
}
|
|
38508
38820
|
try {
|
|
38509
|
-
_id = new
|
|
38821
|
+
_id = new ObjectId102(_id);
|
|
38510
38822
|
} catch (error2) {
|
|
38511
38823
|
throw new BadRequestError159("Invalid ID.");
|
|
38512
38824
|
}
|
|
38513
38825
|
try {
|
|
38514
|
-
value.site = new
|
|
38826
|
+
value.site = new ObjectId102(value.site);
|
|
38515
38827
|
} catch (error2) {
|
|
38516
38828
|
throw new BadRequestError159("Invalid site format");
|
|
38517
38829
|
}
|
|
38518
38830
|
if (value.updatedBy) {
|
|
38519
38831
|
try {
|
|
38520
|
-
value.updatedBy = new
|
|
38832
|
+
value.updatedBy = new ObjectId102(value.updatedBy);
|
|
38521
38833
|
} catch (error2) {
|
|
38522
38834
|
throw new BadRequestError159("Invalid createdBy format");
|
|
38523
38835
|
}
|
|
@@ -38750,7 +39062,7 @@ function useNfcPatrolRouteController() {
|
|
|
38750
39062
|
}
|
|
38751
39063
|
|
|
38752
39064
|
// src/models/incident-report.model.ts
|
|
38753
|
-
import { ObjectId as
|
|
39065
|
+
import { ObjectId as ObjectId103 } from "mongodb";
|
|
38754
39066
|
import Joi99 from "joi";
|
|
38755
39067
|
var residentSchema = Joi99.object({
|
|
38756
39068
|
_id: Joi99.string().hex().optional().allow(null, ""),
|
|
@@ -38954,28 +39266,28 @@ var schemaUpdateIncidentReport = Joi99.object({
|
|
|
38954
39266
|
function MIncidentReport(value) {
|
|
38955
39267
|
if (value._id && typeof value._id === "string") {
|
|
38956
39268
|
try {
|
|
38957
|
-
value._id = new
|
|
39269
|
+
value._id = new ObjectId103(value._id);
|
|
38958
39270
|
} catch {
|
|
38959
39271
|
throw new Error("Invalid incident report ID.");
|
|
38960
39272
|
}
|
|
38961
39273
|
}
|
|
38962
39274
|
if (value.organization && typeof value.organization === "string") {
|
|
38963
39275
|
try {
|
|
38964
|
-
value.organization = new
|
|
39276
|
+
value.organization = new ObjectId103(value.organization);
|
|
38965
39277
|
} catch {
|
|
38966
39278
|
throw new Error("Invalid organization ID.");
|
|
38967
39279
|
}
|
|
38968
39280
|
}
|
|
38969
39281
|
if (value.site && typeof value.site === "string") {
|
|
38970
39282
|
try {
|
|
38971
|
-
value.site = new
|
|
39283
|
+
value.site = new ObjectId103(value.site);
|
|
38972
39284
|
} catch {
|
|
38973
39285
|
throw new Error("Invalid site ID.");
|
|
38974
39286
|
}
|
|
38975
39287
|
}
|
|
38976
39288
|
if (value.approvedBy && typeof value.approvedBy === "string") {
|
|
38977
39289
|
try {
|
|
38978
|
-
value.approvedBy = new
|
|
39290
|
+
value.approvedBy = new ObjectId103(value.approvedBy);
|
|
38979
39291
|
} catch {
|
|
38980
39292
|
throw new Error("Invalid approvedBy ID.");
|
|
38981
39293
|
}
|
|
@@ -38983,7 +39295,7 @@ function MIncidentReport(value) {
|
|
|
38983
39295
|
const { incidentInformation } = value;
|
|
38984
39296
|
if (incidentInformation?.siteInfo?.site && typeof incidentInformation.siteInfo.site === "string") {
|
|
38985
39297
|
try {
|
|
38986
|
-
incidentInformation.siteInfo.site = new
|
|
39298
|
+
incidentInformation.siteInfo.site = new ObjectId103(
|
|
38987
39299
|
incidentInformation.siteInfo.site
|
|
38988
39300
|
);
|
|
38989
39301
|
} catch {
|
|
@@ -38997,7 +39309,7 @@ function MIncidentReport(value) {
|
|
|
38997
39309
|
incidentInformation.submissionForm.dateOfReport = incidentInformation.submissionForm.dateOfReport.toISOString();
|
|
38998
39310
|
}
|
|
38999
39311
|
return {
|
|
39000
|
-
_id: value._id ?? new
|
|
39312
|
+
_id: value._id ?? new ObjectId103(),
|
|
39001
39313
|
reportId: value.reportId,
|
|
39002
39314
|
incidentInformation: value.incidentInformation,
|
|
39003
39315
|
affectedEntities: value.affectedEntities,
|
|
@@ -39034,7 +39346,7 @@ import {
|
|
|
39034
39346
|
useAtlas as useAtlas88,
|
|
39035
39347
|
useCache as useCache54
|
|
39036
39348
|
} from "@7365admin1/node-server-utils";
|
|
39037
|
-
import { ObjectId as
|
|
39349
|
+
import { ObjectId as ObjectId104 } from "mongodb";
|
|
39038
39350
|
var incidents_namespace_collection = "incident-reports";
|
|
39039
39351
|
function useIncidentReportRepo() {
|
|
39040
39352
|
const db = useAtlas88.getDb();
|
|
@@ -39101,7 +39413,7 @@ function useIncidentReportRepo() {
|
|
|
39101
39413
|
page = page > 0 ? page - 1 : 0;
|
|
39102
39414
|
let dateExpr = {};
|
|
39103
39415
|
try {
|
|
39104
|
-
site = new
|
|
39416
|
+
site = new ObjectId104(site);
|
|
39105
39417
|
} catch (error) {
|
|
39106
39418
|
throw new BadRequestError162("Invalid site ID format.");
|
|
39107
39419
|
}
|
|
@@ -39202,7 +39514,7 @@ function useIncidentReportRepo() {
|
|
|
39202
39514
|
page = page > 0 ? page - 1 : 0;
|
|
39203
39515
|
let dateExpr = {};
|
|
39204
39516
|
try {
|
|
39205
|
-
site = new
|
|
39517
|
+
site = new ObjectId104(site);
|
|
39206
39518
|
} catch (error) {
|
|
39207
39519
|
throw new BadRequestError162("Invalid site ID format.");
|
|
39208
39520
|
}
|
|
@@ -39271,7 +39583,7 @@ function useIncidentReportRepo() {
|
|
|
39271
39583
|
}
|
|
39272
39584
|
async function getIncidentReportById(_id, session) {
|
|
39273
39585
|
try {
|
|
39274
|
-
_id = new
|
|
39586
|
+
_id = new ObjectId104(_id);
|
|
39275
39587
|
} catch (error) {
|
|
39276
39588
|
throw new BadRequestError162("Invalid incident report ID format.");
|
|
39277
39589
|
}
|
|
@@ -39302,27 +39614,27 @@ function useIncidentReportRepo() {
|
|
|
39302
39614
|
async function updateIncidentReportById(_id, value, session) {
|
|
39303
39615
|
value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
39304
39616
|
try {
|
|
39305
|
-
_id = new
|
|
39617
|
+
_id = new ObjectId104(_id);
|
|
39306
39618
|
} catch (error) {
|
|
39307
39619
|
throw new BadRequestError162("Invalid ID format.");
|
|
39308
39620
|
}
|
|
39309
39621
|
if (value.organization && typeof value.organization === "string") {
|
|
39310
39622
|
try {
|
|
39311
|
-
value.organization = new
|
|
39623
|
+
value.organization = new ObjectId104(value.organization);
|
|
39312
39624
|
} catch {
|
|
39313
39625
|
throw new Error("Invalid organization ID.");
|
|
39314
39626
|
}
|
|
39315
39627
|
}
|
|
39316
39628
|
if (value.site && typeof value.site === "string") {
|
|
39317
39629
|
try {
|
|
39318
|
-
value.site = new
|
|
39630
|
+
value.site = new ObjectId104(value.site);
|
|
39319
39631
|
} catch {
|
|
39320
39632
|
throw new Error("Invalid site ID.");
|
|
39321
39633
|
}
|
|
39322
39634
|
}
|
|
39323
39635
|
if (value.approvedBy && typeof value.approvedBy === "string") {
|
|
39324
39636
|
try {
|
|
39325
|
-
value.approvedBy = new
|
|
39637
|
+
value.approvedBy = new ObjectId104(value.approvedBy);
|
|
39326
39638
|
} catch {
|
|
39327
39639
|
throw new Error("Invalid approvedBy ID.");
|
|
39328
39640
|
}
|
|
@@ -39330,7 +39642,7 @@ function useIncidentReportRepo() {
|
|
|
39330
39642
|
const { incidentInformation } = value;
|
|
39331
39643
|
if (incidentInformation?.siteInfo?.site && typeof incidentInformation.siteInfo.site === "string") {
|
|
39332
39644
|
try {
|
|
39333
|
-
incidentInformation.siteInfo.site = new
|
|
39645
|
+
incidentInformation.siteInfo.site = new ObjectId104(
|
|
39334
39646
|
incidentInformation.siteInfo.site
|
|
39335
39647
|
);
|
|
39336
39648
|
} catch {
|
|
@@ -39365,7 +39677,7 @@ function useIncidentReportRepo() {
|
|
|
39365
39677
|
}
|
|
39366
39678
|
async function deleteIncidentReportById(_id) {
|
|
39367
39679
|
try {
|
|
39368
|
-
_id = new
|
|
39680
|
+
_id = new ObjectId104(_id);
|
|
39369
39681
|
} catch (error) {
|
|
39370
39682
|
throw new BadRequestError162("Invalid occurrence subject ID format.");
|
|
39371
39683
|
}
|
|
@@ -39397,7 +39709,7 @@ function useIncidentReportRepo() {
|
|
|
39397
39709
|
async function reviewIncidentReport(_id, value, session) {
|
|
39398
39710
|
value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
39399
39711
|
try {
|
|
39400
|
-
_id = new
|
|
39712
|
+
_id = new ObjectId104(_id);
|
|
39401
39713
|
} catch (error) {
|
|
39402
39714
|
throw new BadRequestError162("Invalid ID format.");
|
|
39403
39715
|
}
|
|
@@ -39889,7 +40201,7 @@ function useIncidentReportController() {
|
|
|
39889
40201
|
}
|
|
39890
40202
|
|
|
39891
40203
|
// src/models/nfc-patrol-settings.model.ts
|
|
39892
|
-
import { ObjectId as
|
|
40204
|
+
import { ObjectId as ObjectId105 } from "mongodb";
|
|
39893
40205
|
import Joi101 from "joi";
|
|
39894
40206
|
import { BadRequestError as BadRequestError165, logger as logger142 } from "@7365admin1/node-server-utils";
|
|
39895
40207
|
var objectId = Joi101.string().hex().length(24);
|
|
@@ -39915,7 +40227,7 @@ function MNfcPatrolSettings(value) {
|
|
|
39915
40227
|
}
|
|
39916
40228
|
if (value.site) {
|
|
39917
40229
|
try {
|
|
39918
|
-
value.site = new
|
|
40230
|
+
value.site = new ObjectId105(value.site);
|
|
39919
40231
|
} catch (error2) {
|
|
39920
40232
|
throw new BadRequestError165("Invalid site ID format.");
|
|
39921
40233
|
}
|
|
@@ -39935,7 +40247,7 @@ function MNfcPatrolSettingsUpdate(value) {
|
|
|
39935
40247
|
}
|
|
39936
40248
|
if (value.updatedBy) {
|
|
39937
40249
|
try {
|
|
39938
|
-
value.updatedBy = new
|
|
40250
|
+
value.updatedBy = new ObjectId105(value.updatedBy);
|
|
39939
40251
|
} catch (error2) {
|
|
39940
40252
|
throw new BadRequestError165("Invalid updatedBy ID format.");
|
|
39941
40253
|
}
|
|
@@ -39957,7 +40269,7 @@ import {
|
|
|
39957
40269
|
useAtlas as useAtlas90,
|
|
39958
40270
|
useCache as useCache55
|
|
39959
40271
|
} from "@7365admin1/node-server-utils";
|
|
39960
|
-
import { ObjectId as
|
|
40272
|
+
import { ObjectId as ObjectId106 } from "mongodb";
|
|
39961
40273
|
function useNfcPatrolSettingsRepository() {
|
|
39962
40274
|
const db = useAtlas90.getDb();
|
|
39963
40275
|
if (!db) {
|
|
@@ -39987,7 +40299,7 @@ function useNfcPatrolSettingsRepository() {
|
|
|
39987
40299
|
}
|
|
39988
40300
|
async function getNfcPatrolSettingsBySite(site, session) {
|
|
39989
40301
|
try {
|
|
39990
|
-
site = new
|
|
40302
|
+
site = new ObjectId106(site);
|
|
39991
40303
|
} catch (error) {
|
|
39992
40304
|
throw new BadRequestError166("Invalid nfc patrol settings site ID format.");
|
|
39993
40305
|
}
|
|
@@ -40031,7 +40343,7 @@ function useNfcPatrolSettingsRepository() {
|
|
|
40031
40343
|
}
|
|
40032
40344
|
async function updateNfcPatrolSettings(site, value, session) {
|
|
40033
40345
|
try {
|
|
40034
|
-
site = new
|
|
40346
|
+
site = new ObjectId106(site);
|
|
40035
40347
|
} catch (error) {
|
|
40036
40348
|
throw new BadRequestError166("Invalid attendance settings ID format.");
|
|
40037
40349
|
}
|
|
@@ -40200,7 +40512,7 @@ function useNfcPatrolSettingsController() {
|
|
|
40200
40512
|
|
|
40201
40513
|
// src/services/occurrence-entry.service.ts
|
|
40202
40514
|
import { useAtlas as useAtlas93 } from "@7365admin1/node-server-utils";
|
|
40203
|
-
import { ObjectId as
|
|
40515
|
+
import { ObjectId as ObjectId109 } from "mongodb";
|
|
40204
40516
|
|
|
40205
40517
|
// src/repositories/occurrence-subject.repo.ts
|
|
40206
40518
|
import {
|
|
@@ -40215,7 +40527,7 @@ import {
|
|
|
40215
40527
|
} from "@7365admin1/node-server-utils";
|
|
40216
40528
|
|
|
40217
40529
|
// src/models/occurrence-subject.model.ts
|
|
40218
|
-
import { ObjectId as
|
|
40530
|
+
import { ObjectId as ObjectId107 } from "mongodb";
|
|
40219
40531
|
import Joi103 from "joi";
|
|
40220
40532
|
var schemaOccurrenceSubject = Joi103.object({
|
|
40221
40533
|
site: Joi103.string().hex().required(),
|
|
@@ -40229,27 +40541,27 @@ var schemaUpdateOccurrenceSubject = Joi103.object({
|
|
|
40229
40541
|
function MOccurrenceSubject(value) {
|
|
40230
40542
|
if (value._id && typeof value._id === "string") {
|
|
40231
40543
|
try {
|
|
40232
|
-
value._id = new
|
|
40544
|
+
value._id = new ObjectId107(value._id);
|
|
40233
40545
|
} catch {
|
|
40234
40546
|
throw new Error("Invalid ID.");
|
|
40235
40547
|
}
|
|
40236
40548
|
}
|
|
40237
40549
|
if (value.site && typeof value.site === "string") {
|
|
40238
40550
|
try {
|
|
40239
|
-
value.site = new
|
|
40551
|
+
value.site = new ObjectId107(value.site);
|
|
40240
40552
|
} catch {
|
|
40241
40553
|
throw new Error("Invalid site ID.");
|
|
40242
40554
|
}
|
|
40243
40555
|
}
|
|
40244
40556
|
if (value.addedBy && typeof value.addedBy === "string") {
|
|
40245
40557
|
try {
|
|
40246
|
-
value.addedBy = new
|
|
40558
|
+
value.addedBy = new ObjectId107(value.addedBy);
|
|
40247
40559
|
} catch {
|
|
40248
40560
|
throw new Error("Invalid addedBy ID.");
|
|
40249
40561
|
}
|
|
40250
40562
|
}
|
|
40251
40563
|
return {
|
|
40252
|
-
_id: value._id ?? new
|
|
40564
|
+
_id: value._id ?? new ObjectId107(),
|
|
40253
40565
|
site: value.site,
|
|
40254
40566
|
subject: value.subject,
|
|
40255
40567
|
addedBy: value.addedBy ?? "",
|
|
@@ -40260,7 +40572,7 @@ function MOccurrenceSubject(value) {
|
|
|
40260
40572
|
}
|
|
40261
40573
|
|
|
40262
40574
|
// src/repositories/occurrence-subject.repo.ts
|
|
40263
|
-
import { ObjectId as
|
|
40575
|
+
import { ObjectId as ObjectId108 } from "mongodb";
|
|
40264
40576
|
function useOccurrenceSubjectRepo() {
|
|
40265
40577
|
const db = useAtlas92.getDb();
|
|
40266
40578
|
if (!db) {
|
|
@@ -40319,7 +40631,7 @@ function useOccurrenceSubjectRepo() {
|
|
|
40319
40631
|
}, session) {
|
|
40320
40632
|
page = page > 0 ? page - 1 : 0;
|
|
40321
40633
|
try {
|
|
40322
|
-
site = new
|
|
40634
|
+
site = new ObjectId108(site);
|
|
40323
40635
|
} catch (error) {
|
|
40324
40636
|
throw new BadRequestError169("Invalid site ID format.");
|
|
40325
40637
|
}
|
|
@@ -40414,7 +40726,7 @@ function useOccurrenceSubjectRepo() {
|
|
|
40414
40726
|
}
|
|
40415
40727
|
async function getOccurrenceSubjectById(_id, session) {
|
|
40416
40728
|
try {
|
|
40417
|
-
_id = new
|
|
40729
|
+
_id = new ObjectId108(_id);
|
|
40418
40730
|
} catch (error) {
|
|
40419
40731
|
throw new BadRequestError169("Invalid occurrence subject ID format.");
|
|
40420
40732
|
}
|
|
@@ -40431,7 +40743,7 @@ function useOccurrenceSubjectRepo() {
|
|
|
40431
40743
|
async function updateOccurrenceSubjectById(_id, value, session) {
|
|
40432
40744
|
value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
40433
40745
|
try {
|
|
40434
|
-
_id = new
|
|
40746
|
+
_id = new ObjectId108(_id);
|
|
40435
40747
|
} catch (error) {
|
|
40436
40748
|
throw new BadRequestError169("Invalid ID format.");
|
|
40437
40749
|
}
|
|
@@ -40461,7 +40773,7 @@ function useOccurrenceSubjectRepo() {
|
|
|
40461
40773
|
}
|
|
40462
40774
|
async function deleteOccurrenceSubjectById(_id) {
|
|
40463
40775
|
try {
|
|
40464
|
-
_id = new
|
|
40776
|
+
_id = new ObjectId108(_id);
|
|
40465
40777
|
} catch (error) {
|
|
40466
40778
|
throw new BadRequestError169("Invalid occurrence subject ID format.");
|
|
40467
40779
|
}
|
|
@@ -40573,8 +40885,8 @@ function useOccurrenceEntryService() {
|
|
|
40573
40885
|
value.dailyOccurrenceBookId = occurrenceEntry.dailyOccurrenceBookId;
|
|
40574
40886
|
value.bookEntryCount = value.bookEntryCount ? value.bookEntryCount : occurrenceEntry.bookEntryCount;
|
|
40575
40887
|
value.occurrence = value.occurrence ? value.occurrence : occurrenceEntry.occurrence;
|
|
40576
|
-
value.signature = value.signature ? new
|
|
40577
|
-
value.eSignature = value.eSignature ? new
|
|
40888
|
+
value.signature = value.signature ? new ObjectId109(value.signature) : occurrenceEntry.signature._id;
|
|
40889
|
+
value.eSignature = value.eSignature ? new ObjectId109(value.eSignature) : occurrenceEntry.eSignature;
|
|
40578
40890
|
value.createdAt = /* @__PURE__ */ new Date();
|
|
40579
40891
|
value.date = value.date ? value.date : occurrenceEntry.date;
|
|
40580
40892
|
value.userName = value.userName ? value.userName : occurrenceEntry.signature.name;
|
|
@@ -40774,7 +41086,7 @@ function useOccurrenceEntryController() {
|
|
|
40774
41086
|
|
|
40775
41087
|
// src/models/online-form.model.ts
|
|
40776
41088
|
import Joi105 from "joi";
|
|
40777
|
-
import { ObjectId as
|
|
41089
|
+
import { ObjectId as ObjectId110 } from "mongodb";
|
|
40778
41090
|
var schemaOnlineForm = Joi105.object({
|
|
40779
41091
|
_id: Joi105.string().hex().optional().allow("", null),
|
|
40780
41092
|
name: Joi105.string().required(),
|
|
@@ -40822,21 +41134,21 @@ function MOnlineForm(value) {
|
|
|
40822
41134
|
}
|
|
40823
41135
|
if (value._id && typeof value._id === "string") {
|
|
40824
41136
|
try {
|
|
40825
|
-
value._id = new
|
|
41137
|
+
value._id = new ObjectId110(value._id);
|
|
40826
41138
|
} catch (error2) {
|
|
40827
41139
|
throw new Error("Invalid ID.");
|
|
40828
41140
|
}
|
|
40829
41141
|
}
|
|
40830
41142
|
if (value.org && typeof value.org === "string") {
|
|
40831
41143
|
try {
|
|
40832
|
-
value.org = new
|
|
41144
|
+
value.org = new ObjectId110(value.org);
|
|
40833
41145
|
} catch (error2) {
|
|
40834
41146
|
throw new Error("Invalid org ID.");
|
|
40835
41147
|
}
|
|
40836
41148
|
}
|
|
40837
41149
|
if (value.site && typeof value.site === "string") {
|
|
40838
41150
|
try {
|
|
40839
|
-
value.site = new
|
|
41151
|
+
value.site = new ObjectId110(value.site);
|
|
40840
41152
|
} catch (error2) {
|
|
40841
41153
|
throw new Error("Invalid site ID.");
|
|
40842
41154
|
}
|
|
@@ -40868,7 +41180,7 @@ import {
|
|
|
40868
41180
|
useAtlas as useAtlas94,
|
|
40869
41181
|
useCache as useCache57
|
|
40870
41182
|
} from "@7365admin1/node-server-utils";
|
|
40871
|
-
import { ObjectId as
|
|
41183
|
+
import { ObjectId as ObjectId111 } from "mongodb";
|
|
40872
41184
|
function useOnlineFormRepo() {
|
|
40873
41185
|
const db = useAtlas94.getDb();
|
|
40874
41186
|
if (!db) {
|
|
@@ -40920,7 +41232,7 @@ function useOnlineFormRepo() {
|
|
|
40920
41232
|
}) {
|
|
40921
41233
|
page = page > 0 ? page - 1 : 0;
|
|
40922
41234
|
try {
|
|
40923
|
-
site = new
|
|
41235
|
+
site = new ObjectId111(site);
|
|
40924
41236
|
} catch (error) {
|
|
40925
41237
|
throw new BadRequestError171("Invalid site ID format.");
|
|
40926
41238
|
}
|
|
@@ -40980,7 +41292,7 @@ function useOnlineFormRepo() {
|
|
|
40980
41292
|
}
|
|
40981
41293
|
async function getOnlineFormById(_id) {
|
|
40982
41294
|
try {
|
|
40983
|
-
_id = new
|
|
41295
|
+
_id = new ObjectId111(_id);
|
|
40984
41296
|
} catch (error) {
|
|
40985
41297
|
throw new BadRequestError171("Invalid online form ID format.");
|
|
40986
41298
|
}
|
|
@@ -41023,7 +41335,7 @@ function useOnlineFormRepo() {
|
|
|
41023
41335
|
}
|
|
41024
41336
|
async function updateOnlineFormById(_id, value) {
|
|
41025
41337
|
try {
|
|
41026
|
-
_id = new
|
|
41338
|
+
_id = new ObjectId111(_id);
|
|
41027
41339
|
} catch (error) {
|
|
41028
41340
|
throw new BadRequestError171("Invalid online form ID format.");
|
|
41029
41341
|
}
|
|
@@ -41051,7 +41363,7 @@ function useOnlineFormRepo() {
|
|
|
41051
41363
|
}
|
|
41052
41364
|
async function deleteOnlineFormById(_id, session) {
|
|
41053
41365
|
try {
|
|
41054
|
-
_id = new
|
|
41366
|
+
_id = new ObjectId111(_id);
|
|
41055
41367
|
} catch (error) {
|
|
41056
41368
|
throw new BadRequestError171("Invalid online form ID format.");
|
|
41057
41369
|
}
|
|
@@ -41084,7 +41396,7 @@ function useOnlineFormRepo() {
|
|
|
41084
41396
|
}
|
|
41085
41397
|
async function getOnlineFormsBySiteId(site, { search = "", page = 1, limit = 10, status = "active" }) {
|
|
41086
41398
|
try {
|
|
41087
|
-
site = new
|
|
41399
|
+
site = new ObjectId111(site);
|
|
41088
41400
|
} catch (error) {
|
|
41089
41401
|
throw new BadRequestError171(
|
|
41090
41402
|
"Invalid online form configuration site ID format."
|
|
@@ -41525,7 +41837,7 @@ function useOccurrenceSubjectController() {
|
|
|
41525
41837
|
}
|
|
41526
41838
|
|
|
41527
41839
|
// src/models/nfc-patrol-log.model.ts
|
|
41528
|
-
import { ObjectId as
|
|
41840
|
+
import { ObjectId as ObjectId112 } from "mongodb";
|
|
41529
41841
|
import Joi108 from "joi";
|
|
41530
41842
|
import { BadRequestError as BadRequestError174, logger as logger151 } from "@7365admin1/node-server-utils";
|
|
41531
41843
|
var schemaNfcPatrolLog = Joi108.object({
|
|
@@ -41577,32 +41889,32 @@ function MNfcPatrolLog(valueArg) {
|
|
|
41577
41889
|
}
|
|
41578
41890
|
if (value._id && typeof value._id === "string") {
|
|
41579
41891
|
try {
|
|
41580
|
-
value._id = new
|
|
41892
|
+
value._id = new ObjectId112(value._id);
|
|
41581
41893
|
} catch (error2) {
|
|
41582
41894
|
throw new BadRequestError174("Invalid _id format");
|
|
41583
41895
|
}
|
|
41584
41896
|
}
|
|
41585
41897
|
try {
|
|
41586
|
-
value.site = new
|
|
41898
|
+
value.site = new ObjectId112(value.site);
|
|
41587
41899
|
} catch (error2) {
|
|
41588
41900
|
throw new BadRequestError174("Invalid site format");
|
|
41589
41901
|
}
|
|
41590
41902
|
if (value?.createdBy) {
|
|
41591
41903
|
try {
|
|
41592
|
-
value.createdBy = new
|
|
41904
|
+
value.createdBy = new ObjectId112(value.createdBy);
|
|
41593
41905
|
} catch (error2) {
|
|
41594
41906
|
throw new BadRequestError174("Invalid createdBy format");
|
|
41595
41907
|
}
|
|
41596
41908
|
}
|
|
41597
41909
|
if (value?.route?._id) {
|
|
41598
41910
|
try {
|
|
41599
|
-
value.route._id = new
|
|
41911
|
+
value.route._id = new ObjectId112(value.route._id);
|
|
41600
41912
|
} catch (error2) {
|
|
41601
41913
|
throw new BadRequestError174("Invalid route _id format");
|
|
41602
41914
|
}
|
|
41603
41915
|
}
|
|
41604
41916
|
return {
|
|
41605
|
-
_id: value._id ?? new
|
|
41917
|
+
_id: value._id ?? new ObjectId112(),
|
|
41606
41918
|
site: value.site,
|
|
41607
41919
|
route: value.route,
|
|
41608
41920
|
date: value.date,
|
|
@@ -41624,7 +41936,7 @@ import {
|
|
|
41624
41936
|
useAtlas as useAtlas96,
|
|
41625
41937
|
useCache as useCache58
|
|
41626
41938
|
} from "@7365admin1/node-server-utils";
|
|
41627
|
-
import { ObjectId as
|
|
41939
|
+
import { ObjectId as ObjectId113 } from "mongodb";
|
|
41628
41940
|
function useNfcPatrolLogRepo() {
|
|
41629
41941
|
const db = useAtlas96.getDb();
|
|
41630
41942
|
if (!db) {
|
|
@@ -41677,7 +41989,7 @@ function useNfcPatrolLogRepo() {
|
|
|
41677
41989
|
const pageIndex = page > 0 ? page - 1 : 0;
|
|
41678
41990
|
let siteId;
|
|
41679
41991
|
try {
|
|
41680
|
-
siteId = typeof site === "string" ? new
|
|
41992
|
+
siteId = typeof site === "string" ? new ObjectId113(site) : site;
|
|
41681
41993
|
} catch {
|
|
41682
41994
|
throw new BadRequestError175("Invalid site ID format.");
|
|
41683
41995
|
}
|
|
@@ -41688,7 +42000,7 @@ function useNfcPatrolLogRepo() {
|
|
|
41688
42000
|
query.date = date;
|
|
41689
42001
|
}
|
|
41690
42002
|
if (route?._id) {
|
|
41691
|
-
query["route._id"] = typeof route._id === "string" ? new
|
|
42003
|
+
query["route._id"] = typeof route._id === "string" ? new ObjectId113(route._id) : route._id;
|
|
41692
42004
|
}
|
|
41693
42005
|
if (route?.startTime) {
|
|
41694
42006
|
query["route.startTime"] = route.startTime;
|
|
@@ -42560,7 +42872,7 @@ function useNewDashboardController() {
|
|
|
42560
42872
|
|
|
42561
42873
|
// src/models/manpower-monitoring.model.ts
|
|
42562
42874
|
import Joi111 from "joi";
|
|
42563
|
-
import { ObjectId as
|
|
42875
|
+
import { ObjectId as ObjectId114 } from "mongodb";
|
|
42564
42876
|
var shiftSchema = Joi111.object({
|
|
42565
42877
|
name: Joi111.string().required(),
|
|
42566
42878
|
checkIn: Joi111.string().optional().allow("", null),
|
|
@@ -42585,7 +42897,7 @@ var manpowerMonitoringSchema = Joi111.object({
|
|
|
42585
42897
|
});
|
|
42586
42898
|
var MManpowerMonitoring = class {
|
|
42587
42899
|
constructor(data) {
|
|
42588
|
-
this._id = new
|
|
42900
|
+
this._id = new ObjectId114();
|
|
42589
42901
|
this.serviceProviderId = data.serviceProviderId || "";
|
|
42590
42902
|
this.siteId = data.siteId || "";
|
|
42591
42903
|
this.siteName = data.siteName;
|
|
@@ -43055,7 +43367,7 @@ var hrmlabs_attendance_util_default = {
|
|
|
43055
43367
|
};
|
|
43056
43368
|
|
|
43057
43369
|
// src/repositories/manpower-monitoring.repo.ts
|
|
43058
|
-
import { ObjectId as
|
|
43370
|
+
import { ObjectId as ObjectId115 } from "mongodb";
|
|
43059
43371
|
var { hrmLabsAuthentication: hrmLabsAuthentication2, fetchSites: fetchSites2 } = hrmlabs_attendance_util_default;
|
|
43060
43372
|
function useManpowerMonitoringRepo() {
|
|
43061
43373
|
const db = useAtlas99.getDb();
|
|
@@ -43069,11 +43381,11 @@ function useManpowerMonitoringRepo() {
|
|
|
43069
43381
|
try {
|
|
43070
43382
|
value = new MManpowerMonitoring(value);
|
|
43071
43383
|
if (value.createdBy)
|
|
43072
|
-
value.createdBy = new
|
|
43384
|
+
value.createdBy = new ObjectId115(value.createdBy);
|
|
43073
43385
|
if (value.siteId)
|
|
43074
|
-
value.siteId = new
|
|
43386
|
+
value.siteId = new ObjectId115(value.siteId);
|
|
43075
43387
|
if (value.serviceProviderId)
|
|
43076
|
-
value.serviceProviderId = new
|
|
43388
|
+
value.serviceProviderId = new ObjectId115(value.serviceProviderId);
|
|
43077
43389
|
const result = await collection.insertOne(value, { session });
|
|
43078
43390
|
return result;
|
|
43079
43391
|
} catch (error) {
|
|
@@ -43114,8 +43426,8 @@ function useManpowerMonitoringRepo() {
|
|
|
43114
43426
|
}
|
|
43115
43427
|
async function getManpowerSettingsBySiteId(_id, serviceProviderId) {
|
|
43116
43428
|
try {
|
|
43117
|
-
_id = new
|
|
43118
|
-
serviceProviderId = new
|
|
43429
|
+
_id = new ObjectId115(_id);
|
|
43430
|
+
serviceProviderId = new ObjectId115(serviceProviderId);
|
|
43119
43431
|
} catch (error) {
|
|
43120
43432
|
throw new Error("Invalid Site ID format.");
|
|
43121
43433
|
}
|
|
@@ -43131,7 +43443,7 @@ function useManpowerMonitoringRepo() {
|
|
|
43131
43443
|
}
|
|
43132
43444
|
async function updateManpowerMonitoringSettings(_id, value) {
|
|
43133
43445
|
try {
|
|
43134
|
-
_id = new
|
|
43446
|
+
_id = new ObjectId115(_id);
|
|
43135
43447
|
} catch (error) {
|
|
43136
43448
|
throw new BadRequestError180("Invalid ID format.");
|
|
43137
43449
|
}
|
|
@@ -43158,7 +43470,7 @@ function useManpowerMonitoringRepo() {
|
|
|
43158
43470
|
for (let item of value) {
|
|
43159
43471
|
item = new MManpowerMonitoring(item);
|
|
43160
43472
|
const data = await collection.findOne({
|
|
43161
|
-
siteId: new
|
|
43473
|
+
siteId: new ObjectId115(item.siteId)
|
|
43162
43474
|
});
|
|
43163
43475
|
if (data) {
|
|
43164
43476
|
let updateValue;
|
|
@@ -43183,11 +43495,11 @@ function useManpowerMonitoringRepo() {
|
|
|
43183
43495
|
}
|
|
43184
43496
|
} else {
|
|
43185
43497
|
if (item.createdBy)
|
|
43186
|
-
item.createdBy = new
|
|
43498
|
+
item.createdBy = new ObjectId115(item.createdBy);
|
|
43187
43499
|
if (item.siteId)
|
|
43188
|
-
item.siteId = new
|
|
43500
|
+
item.siteId = new ObjectId115(item.siteId);
|
|
43189
43501
|
if (item.serviceProviderId)
|
|
43190
|
-
item.serviceProviderId = new
|
|
43502
|
+
item.serviceProviderId = new ObjectId115(item.serviceProviderId);
|
|
43191
43503
|
const result = await collection.insertOne(item);
|
|
43192
43504
|
if (result.insertedId) {
|
|
43193
43505
|
results.inserted++;
|
|
@@ -43211,7 +43523,7 @@ function useManpowerMonitoringRepo() {
|
|
|
43211
43523
|
const siteUrl = process.env.HRMLABS_SITE_URL;
|
|
43212
43524
|
try {
|
|
43213
43525
|
const serviceProvider = await serviceProviderCollection.findOne({
|
|
43214
|
-
_id: new
|
|
43526
|
+
_id: new ObjectId115(serviceProviderId)
|
|
43215
43527
|
});
|
|
43216
43528
|
if (!serviceProvider) {
|
|
43217
43529
|
throw new Error("Service Provider not found.");
|
|
@@ -43261,7 +43573,7 @@ import {
|
|
|
43261
43573
|
|
|
43262
43574
|
// src/models/manpower-remarks.model.ts
|
|
43263
43575
|
import Joi112 from "joi";
|
|
43264
|
-
import { ObjectId as
|
|
43576
|
+
import { ObjectId as ObjectId116 } from "mongodb";
|
|
43265
43577
|
var remarksSchema = Joi112.object({
|
|
43266
43578
|
name: Joi112.string().required(),
|
|
43267
43579
|
remark: Joi112.object({
|
|
@@ -43285,7 +43597,7 @@ var manpowerRemarksSchema = Joi112.object({
|
|
|
43285
43597
|
});
|
|
43286
43598
|
var MManpowerRemarks = class {
|
|
43287
43599
|
constructor(data) {
|
|
43288
|
-
this._id = new
|
|
43600
|
+
this._id = new ObjectId116();
|
|
43289
43601
|
this.serviceProviderId = data.serviceProviderId || "";
|
|
43290
43602
|
this.siteId = data.siteId || "";
|
|
43291
43603
|
this.siteName = data.siteName || "";
|
|
@@ -43303,7 +43615,7 @@ var MManpowerRemarks = class {
|
|
|
43303
43615
|
};
|
|
43304
43616
|
|
|
43305
43617
|
// src/repositories/manpower-remarks.repo.ts
|
|
43306
|
-
import { ObjectId as
|
|
43618
|
+
import { ObjectId as ObjectId117 } from "mongodb";
|
|
43307
43619
|
import moment2 from "moment-timezone";
|
|
43308
43620
|
function useManpowerRemarksRepo() {
|
|
43309
43621
|
const db = useAtlas100.getDb();
|
|
@@ -43316,9 +43628,9 @@ function useManpowerRemarksRepo() {
|
|
|
43316
43628
|
try {
|
|
43317
43629
|
value = new MManpowerRemarks(value);
|
|
43318
43630
|
if (value.siteId)
|
|
43319
|
-
value.siteId = new
|
|
43631
|
+
value.siteId = new ObjectId117(value.siteId);
|
|
43320
43632
|
if (value.serviceProviderId)
|
|
43321
|
-
value.serviceProviderId = new
|
|
43633
|
+
value.serviceProviderId = new ObjectId117(value.serviceProviderId);
|
|
43322
43634
|
const result = await collection.insertOne(value, { session });
|
|
43323
43635
|
return result;
|
|
43324
43636
|
} catch (error) {
|
|
@@ -43338,7 +43650,7 @@ function useManpowerRemarksRepo() {
|
|
|
43338
43650
|
limit = limit || 10;
|
|
43339
43651
|
const searchQuery = {};
|
|
43340
43652
|
const nowSGT = moment2().tz("Asia/Singapore");
|
|
43341
|
-
searchQuery.serviceProviderId = new
|
|
43653
|
+
searchQuery.serviceProviderId = new ObjectId117(serviceProviderId);
|
|
43342
43654
|
if (search != "") {
|
|
43343
43655
|
searchQuery.siteName = { $regex: search, $options: "i" };
|
|
43344
43656
|
}
|
|
@@ -43370,8 +43682,8 @@ function useManpowerRemarksRepo() {
|
|
|
43370
43682
|
}
|
|
43371
43683
|
async function getManpowerRemarksBySiteId(_id, date, serviceProviderId) {
|
|
43372
43684
|
try {
|
|
43373
|
-
_id = new
|
|
43374
|
-
serviceProviderId = new
|
|
43685
|
+
_id = new ObjectId117(_id);
|
|
43686
|
+
serviceProviderId = new ObjectId117(serviceProviderId);
|
|
43375
43687
|
} catch (error) {
|
|
43376
43688
|
throw new Error("Invalid Site ID format.");
|
|
43377
43689
|
}
|
|
@@ -43388,13 +43700,13 @@ function useManpowerRemarksRepo() {
|
|
|
43388
43700
|
}
|
|
43389
43701
|
async function updateManpowerRemarks(_id, value) {
|
|
43390
43702
|
try {
|
|
43391
|
-
_id = new
|
|
43703
|
+
_id = new ObjectId117(_id);
|
|
43392
43704
|
} catch (error) {
|
|
43393
43705
|
throw new BadRequestError181("Invalid ID format.");
|
|
43394
43706
|
}
|
|
43395
43707
|
try {
|
|
43396
43708
|
if (value.createdBy) {
|
|
43397
|
-
value.createdBy = new
|
|
43709
|
+
value.createdBy = new ObjectId117(value.createdBy);
|
|
43398
43710
|
}
|
|
43399
43711
|
const updateValue = {
|
|
43400
43712
|
...value,
|
|
@@ -43411,7 +43723,7 @@ function useManpowerRemarksRepo() {
|
|
|
43411
43723
|
}
|
|
43412
43724
|
async function updateRemarksStatus(_id, value) {
|
|
43413
43725
|
try {
|
|
43414
|
-
_id = new
|
|
43726
|
+
_id = new ObjectId117(_id);
|
|
43415
43727
|
} catch (error) {
|
|
43416
43728
|
throw new BadRequestError181("Invalid ID format.");
|
|
43417
43729
|
}
|
|
@@ -43683,7 +43995,7 @@ function useManpowerMonitoringCtrl() {
|
|
|
43683
43995
|
|
|
43684
43996
|
// src/models/manpower-designations.model.ts
|
|
43685
43997
|
import Joi114 from "joi";
|
|
43686
|
-
import { ObjectId as
|
|
43998
|
+
import { ObjectId as ObjectId118 } from "mongodb";
|
|
43687
43999
|
var designationsSchema = Joi114.object({
|
|
43688
44000
|
title: Joi114.string().required(),
|
|
43689
44001
|
shifts: Joi114.object({
|
|
@@ -43702,7 +44014,7 @@ var manpowerDesignationsSchema = Joi114.object({
|
|
|
43702
44014
|
});
|
|
43703
44015
|
var MManpowerDesignations = class {
|
|
43704
44016
|
constructor(data) {
|
|
43705
|
-
this._id = new
|
|
44017
|
+
this._id = new ObjectId118();
|
|
43706
44018
|
this.siteId = data.siteId || "";
|
|
43707
44019
|
this.siteName = data.siteName || "";
|
|
43708
44020
|
this.serviceProviderId = data.serviceProviderId || "";
|
|
@@ -43718,7 +44030,7 @@ var MManpowerDesignations = class {
|
|
|
43718
44030
|
import {
|
|
43719
44031
|
useAtlas as useAtlas102
|
|
43720
44032
|
} from "@7365admin1/node-server-utils";
|
|
43721
|
-
import { ObjectId as
|
|
44033
|
+
import { ObjectId as ObjectId119 } from "mongodb";
|
|
43722
44034
|
function useManpowerDesignationRepo() {
|
|
43723
44035
|
const db = useAtlas102.getDb();
|
|
43724
44036
|
if (!db) {
|
|
@@ -43730,11 +44042,11 @@ function useManpowerDesignationRepo() {
|
|
|
43730
44042
|
try {
|
|
43731
44043
|
value = new MManpowerDesignations(value);
|
|
43732
44044
|
if (value.createdBy)
|
|
43733
|
-
value.createdBy = new
|
|
44045
|
+
value.createdBy = new ObjectId119(value.createdBy);
|
|
43734
44046
|
if (value.siteId)
|
|
43735
|
-
value.siteId = new
|
|
44047
|
+
value.siteId = new ObjectId119(value.siteId);
|
|
43736
44048
|
if (value.serviceProviderId)
|
|
43737
|
-
value.serviceProviderId = new
|
|
44049
|
+
value.serviceProviderId = new ObjectId119(value.serviceProviderId);
|
|
43738
44050
|
const result = await collection.insertOne(value);
|
|
43739
44051
|
return result;
|
|
43740
44052
|
} catch (error) {
|
|
@@ -43743,8 +44055,8 @@ function useManpowerDesignationRepo() {
|
|
|
43743
44055
|
}
|
|
43744
44056
|
async function getManpowerDesignationsBySiteId(_id, serviceProviderId) {
|
|
43745
44057
|
try {
|
|
43746
|
-
_id = new
|
|
43747
|
-
serviceProviderId = new
|
|
44058
|
+
_id = new ObjectId119(_id);
|
|
44059
|
+
serviceProviderId = new ObjectId119(serviceProviderId);
|
|
43748
44060
|
} catch (error) {
|
|
43749
44061
|
throw new Error("Invalid Site ID format.");
|
|
43750
44062
|
}
|
|
@@ -43760,7 +44072,7 @@ function useManpowerDesignationRepo() {
|
|
|
43760
44072
|
}
|
|
43761
44073
|
async function updateManpowerDesignations(_id, value) {
|
|
43762
44074
|
try {
|
|
43763
|
-
_id = new
|
|
44075
|
+
_id = new ObjectId119(_id);
|
|
43764
44076
|
} catch (error) {
|
|
43765
44077
|
throw new Error("Invalid ID format.");
|
|
43766
44078
|
}
|
|
@@ -43863,7 +44175,7 @@ function useManpowerDesignationCtrl() {
|
|
|
43863
44175
|
|
|
43864
44176
|
// src/models/overnight-parking.model.ts
|
|
43865
44177
|
import Joi116 from "joi";
|
|
43866
|
-
import { ObjectId as
|
|
44178
|
+
import { ObjectId as ObjectId120 } from "mongodb";
|
|
43867
44179
|
var dayScheduleSchema = Joi116.object({
|
|
43868
44180
|
isEnabled: Joi116.boolean().required(),
|
|
43869
44181
|
startTime: Joi116.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().allow(null, "").messages({
|
|
@@ -43905,7 +44217,7 @@ function MOvernightParkingApprovalHours(value) {
|
|
|
43905
44217
|
}
|
|
43906
44218
|
if (value.site && typeof value.site === "string") {
|
|
43907
44219
|
try {
|
|
43908
|
-
value.site = new
|
|
44220
|
+
value.site = new ObjectId120(value.site);
|
|
43909
44221
|
} catch {
|
|
43910
44222
|
throw new Error("Invalid site ID.");
|
|
43911
44223
|
}
|
|
@@ -45529,7 +45841,7 @@ function useManpowerRemarkCtrl() {
|
|
|
45529
45841
|
|
|
45530
45842
|
// src/models/manpower-sites.model.ts
|
|
45531
45843
|
import Joi122 from "joi";
|
|
45532
|
-
import { ObjectId as
|
|
45844
|
+
import { ObjectId as ObjectId121 } from "mongodb";
|
|
45533
45845
|
var manpowerSitesSchema = Joi122.object({
|
|
45534
45846
|
id: Joi122.string().hex().required(),
|
|
45535
45847
|
text: Joi122.string().hex().optional().allow("", null),
|
|
@@ -45540,7 +45852,7 @@ var manpowerSitesSchema = Joi122.object({
|
|
|
45540
45852
|
});
|
|
45541
45853
|
var MManpowerSites = class {
|
|
45542
45854
|
constructor(data) {
|
|
45543
|
-
this._id = new
|
|
45855
|
+
this._id = new ObjectId121();
|
|
45544
45856
|
this.id = data.id || "";
|
|
45545
45857
|
this.text = data.text || "";
|
|
45546
45858
|
this.contractID = data.contractID || "";
|
|
@@ -45762,7 +46074,7 @@ import {
|
|
|
45762
46074
|
getDirectory as getDirectory3,
|
|
45763
46075
|
logger as logger174
|
|
45764
46076
|
} from "@7365admin1/node-server-utils";
|
|
45765
|
-
import { ObjectId as
|
|
46077
|
+
import { ObjectId as ObjectId122 } from "mongodb";
|
|
45766
46078
|
import moment4 from "moment-timezone";
|
|
45767
46079
|
var createManpowerRemarksDaily = async () => {
|
|
45768
46080
|
const db = useAtlas108.getDb();
|
|
@@ -45922,7 +46234,7 @@ var updateRemarksisAcknowledged = async () => {
|
|
|
45922
46234
|
for (const id of updatedIds) {
|
|
45923
46235
|
const doc = await remarks.findOne({ _id: id });
|
|
45924
46236
|
const setting = await settings.findOne(
|
|
45925
|
-
{ siteId: new
|
|
46237
|
+
{ siteId: new ObjectId122(doc?.siteId) },
|
|
45926
46238
|
{ projection: { emails: 1 } }
|
|
45927
46239
|
);
|
|
45928
46240
|
const payload = {
|
|
@@ -46008,7 +46320,7 @@ var updateRemarksStatusEod = async () => {
|
|
|
46008
46320
|
for (const doc of docs) {
|
|
46009
46321
|
let shiftsToCheck = [];
|
|
46010
46322
|
const endShiftTime = await settings.findOne(
|
|
46011
|
-
{ siteId: new
|
|
46323
|
+
{ siteId: new ObjectId122(doc.siteId) },
|
|
46012
46324
|
{ projection: { shifts: 1, shiftType: 1 } }
|
|
46013
46325
|
);
|
|
46014
46326
|
if (doc.createdAtSGT === nowSGT) {
|
|
@@ -46114,7 +46426,7 @@ var isWithinHour = (alertTime, timeNow) => {
|
|
|
46114
46426
|
|
|
46115
46427
|
// src/events/manpower.event.ts
|
|
46116
46428
|
import { useAtlas as useAtlas109 } from "@7365admin1/node-server-utils";
|
|
46117
|
-
import { ObjectId as
|
|
46429
|
+
import { ObjectId as ObjectId123 } from "mongodb";
|
|
46118
46430
|
import moment5 from "moment-timezone";
|
|
46119
46431
|
async function manpowerEvents(io) {
|
|
46120
46432
|
let intervalId = null;
|
|
@@ -46140,7 +46452,7 @@ async function manpowerEvents(io) {
|
|
|
46140
46452
|
}).toArray();
|
|
46141
46453
|
for (const doc of docs) {
|
|
46142
46454
|
const siteSettings = await settings.findOne(
|
|
46143
|
-
{ siteId: new
|
|
46455
|
+
{ siteId: new ObjectId123(doc.siteId), enabled: true },
|
|
46144
46456
|
{ projection: { shifts: 1, shiftType: 1 } }
|
|
46145
46457
|
);
|
|
46146
46458
|
const shiftType = siteSettings?.shiftType || "2-shifts";
|
|
@@ -46259,7 +46571,7 @@ function genericSignature(params, secretKey) {
|
|
|
46259
46571
|
}
|
|
46260
46572
|
|
|
46261
46573
|
// src/repositories/reddot-payment.repository.ts
|
|
46262
|
-
import { ObjectId as
|
|
46574
|
+
import { ObjectId as ObjectId127 } from "mongodb";
|
|
46263
46575
|
|
|
46264
46576
|
// src/utils/date-format.util.ts
|
|
46265
46577
|
import moment6 from "moment-timezone";
|
|
@@ -46284,11 +46596,11 @@ function formatDateString(today, format, dateRange) {
|
|
|
46284
46596
|
}
|
|
46285
46597
|
|
|
46286
46598
|
// src/models/credit-card.model.ts
|
|
46287
|
-
import { ObjectId as
|
|
46599
|
+
import { ObjectId as ObjectId124 } from "mongodb";
|
|
46288
46600
|
var MCardInfo = class {
|
|
46289
46601
|
// this is coming from RDP transaction
|
|
46290
46602
|
constructor({
|
|
46291
|
-
_id = new
|
|
46603
|
+
_id = new ObjectId124(),
|
|
46292
46604
|
userId,
|
|
46293
46605
|
cardType,
|
|
46294
46606
|
cardNumber,
|
|
@@ -46323,11 +46635,11 @@ var MCardInfo = class {
|
|
|
46323
46635
|
};
|
|
46324
46636
|
|
|
46325
46637
|
// src/models/cart.model.ts
|
|
46326
|
-
import { ObjectId as
|
|
46638
|
+
import { ObjectId as ObjectId125 } from "mongodb";
|
|
46327
46639
|
var MUnitBillings = class {
|
|
46328
46640
|
// transaction response messages
|
|
46329
46641
|
constructor({
|
|
46330
|
-
_id = new
|
|
46642
|
+
_id = new ObjectId125(),
|
|
46331
46643
|
unit,
|
|
46332
46644
|
unitId,
|
|
46333
46645
|
unitBill,
|
|
@@ -46368,7 +46680,7 @@ var MUnitBillings = class {
|
|
|
46368
46680
|
};
|
|
46369
46681
|
|
|
46370
46682
|
// src/repositories/payment.repository.ts
|
|
46371
|
-
import { ObjectId as
|
|
46683
|
+
import { ObjectId as ObjectId126 } from "mongodb";
|
|
46372
46684
|
import {
|
|
46373
46685
|
InternalServerError as InternalServerError66,
|
|
46374
46686
|
useAtlas as useAtlas110
|
|
@@ -46405,7 +46717,7 @@ var PaymentBillRepo = () => {
|
|
|
46405
46717
|
if (unitBillInfo?.status === "Inactive" /* inactive */) {
|
|
46406
46718
|
throw new Error("This Bill is Inactive!");
|
|
46407
46719
|
}
|
|
46408
|
-
const billId = new
|
|
46720
|
+
const billId = new ObjectId126(unitBillInfo?.billId);
|
|
46409
46721
|
const billInfo = await billCollection().findOne({ _id: billId });
|
|
46410
46722
|
if (!billInfo) {
|
|
46411
46723
|
throw new Error("Bill info not found");
|
|
@@ -46444,13 +46756,13 @@ var PaymentBillRepo = () => {
|
|
|
46444
46756
|
const saveCreditCardInfo = async (payload) => {
|
|
46445
46757
|
try {
|
|
46446
46758
|
if (payload.userId)
|
|
46447
|
-
payload.userId = new
|
|
46759
|
+
payload.userId = new ObjectId126(payload.userId);
|
|
46448
46760
|
if (payload.site)
|
|
46449
|
-
payload.site = new
|
|
46761
|
+
payload.site = new ObjectId126(payload.site);
|
|
46450
46762
|
if (payload.organization)
|
|
46451
|
-
payload.organization = new
|
|
46763
|
+
payload.organization = new ObjectId126(payload.organization);
|
|
46452
46764
|
if (payload.createdBy)
|
|
46453
|
-
payload.createdBy = new
|
|
46765
|
+
payload.createdBy = new ObjectId126(payload.createdBy);
|
|
46454
46766
|
const createdAt = formatDateString(/* @__PURE__ */ new Date(), "mm-dd-yyyy");
|
|
46455
46767
|
payload.createdAt = createdAt;
|
|
46456
46768
|
const result = await creditCollection().insertOne(new MCardInfo(payload));
|
|
@@ -46462,19 +46774,19 @@ var PaymentBillRepo = () => {
|
|
|
46462
46774
|
const checkOutUnitBills = async (payload) => {
|
|
46463
46775
|
try {
|
|
46464
46776
|
if (payload.unitId)
|
|
46465
|
-
payload.unitId = new
|
|
46777
|
+
payload.unitId = new ObjectId126(payload.unitId);
|
|
46466
46778
|
if (payload.site)
|
|
46467
|
-
payload.site = new
|
|
46779
|
+
payload.site = new ObjectId126(payload.site);
|
|
46468
46780
|
if (payload.organization)
|
|
46469
|
-
payload.organization = new
|
|
46781
|
+
payload.organization = new ObjectId126(payload.organization);
|
|
46470
46782
|
payload.createdAt = await formatDateString(/* @__PURE__ */ new Date(), "mm-dd-yyyy");
|
|
46471
46783
|
const addToCart = await cartCollection().insertOne(new MUnitBillings(payload));
|
|
46472
46784
|
const unitId = payload.unitId;
|
|
46473
46785
|
const dateFormatted = formatDateString(/* @__PURE__ */ new Date(), "for-ref");
|
|
46474
46786
|
const unit = unitId?.toString().slice(-4);
|
|
46475
|
-
const newId = new
|
|
46787
|
+
const newId = new ObjectId126(addToCart?.insertedId).toString().slice(-4);
|
|
46476
46788
|
const referenceNumber = `CRT${unit}${newId}${dateFormatted}`;
|
|
46477
|
-
const result = await cartCollection().findOneAndUpdate({ _id: new
|
|
46789
|
+
const result = await cartCollection().findOneAndUpdate({ _id: new ObjectId126(addToCart.insertedId) }, { $set: { referenceNumber } }, { returnDocument: "after" });
|
|
46478
46790
|
return result;
|
|
46479
46791
|
} catch (error) {
|
|
46480
46792
|
throw new Error(error.message || error || "Server Internal Error");
|
|
@@ -46505,7 +46817,7 @@ var PaymentBillRepo = () => {
|
|
|
46505
46817
|
for (const ref of refNumber) {
|
|
46506
46818
|
const unitBillInfo = await collection().findOne({ referenceNumber: ref });
|
|
46507
46819
|
const billId = unitBillInfo?.billId;
|
|
46508
|
-
const billInfo = await billCollection().findOne({ _id: new
|
|
46820
|
+
const billInfo = await billCollection().findOne({ _id: new ObjectId126(billId) });
|
|
46509
46821
|
const billAmount = billInfo?.price;
|
|
46510
46822
|
payload.updatedAt = updatedAt;
|
|
46511
46823
|
payload.amountPaid = billAmount;
|
|
@@ -46659,7 +46971,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
46659
46971
|
throw new Error("Failed to Add Merchant Details");
|
|
46660
46972
|
}
|
|
46661
46973
|
const merchantId = merchant?.insertedId;
|
|
46662
|
-
const orgId = new
|
|
46974
|
+
const orgId = new ObjectId127(_id);
|
|
46663
46975
|
const result = await orgCollection().findOneAndUpdate({ _id: orgId }, { $push: { merchant: merchantId } }, {
|
|
46664
46976
|
returnDocument: "after"
|
|
46665
46977
|
});
|
|
@@ -46688,7 +47000,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
46688
47000
|
const getMerchantDetailsById = async (_id) => {
|
|
46689
47001
|
try {
|
|
46690
47002
|
if (_id)
|
|
46691
|
-
_id = new
|
|
47003
|
+
_id = new ObjectId127(_id);
|
|
46692
47004
|
const result = await redDotMerchantCollection().aggregate([
|
|
46693
47005
|
{
|
|
46694
47006
|
$match: {
|
|
@@ -46952,7 +47264,7 @@ import {
|
|
|
46952
47264
|
useAtlas as useAtlas112,
|
|
46953
47265
|
useCache as useCache66
|
|
46954
47266
|
} from "@7365admin1/node-server-utils";
|
|
46955
|
-
import { ObjectId as
|
|
47267
|
+
import { ObjectId as ObjectId128 } from "mongodb";
|
|
46956
47268
|
function useVerificationRepoV2() {
|
|
46957
47269
|
const db = useAtlas112.getDb();
|
|
46958
47270
|
if (!db) {
|
|
@@ -47005,7 +47317,7 @@ function useVerificationRepoV2() {
|
|
|
47005
47317
|
}
|
|
47006
47318
|
async function updateVerificationStatusById(_id, status, session) {
|
|
47007
47319
|
try {
|
|
47008
|
-
_id = new
|
|
47320
|
+
_id = new ObjectId128(_id);
|
|
47009
47321
|
} catch (error) {
|
|
47010
47322
|
throw new BadRequestError195("Invalid verification ID format.");
|
|
47011
47323
|
}
|
|
@@ -47148,7 +47460,7 @@ function useVerificationRepoV2() {
|
|
|
47148
47460
|
}
|
|
47149
47461
|
async function updateStatusById(_id, status, session) {
|
|
47150
47462
|
try {
|
|
47151
|
-
_id = new
|
|
47463
|
+
_id = new ObjectId128(_id);
|
|
47152
47464
|
} catch (error) {
|
|
47153
47465
|
throw new BadRequestError195("Invalid verification ID format.");
|
|
47154
47466
|
}
|
|
@@ -47750,7 +48062,7 @@ import {
|
|
|
47750
48062
|
import { v4 as uuidv42 } from "uuid";
|
|
47751
48063
|
|
|
47752
48064
|
// src/repositories/user-v2.repo.ts
|
|
47753
|
-
import { ObjectId as
|
|
48065
|
+
import { ObjectId as ObjectId129 } from "mongodb";
|
|
47754
48066
|
import {
|
|
47755
48067
|
useAtlas as useAtlas114,
|
|
47756
48068
|
InternalServerError as InternalServerError70,
|
|
@@ -47962,7 +48274,7 @@ function useUserRepoV2() {
|
|
|
47962
48274
|
}
|
|
47963
48275
|
if (organization) {
|
|
47964
48276
|
try {
|
|
47965
|
-
query.defaultOrg = new
|
|
48277
|
+
query.defaultOrg = new ObjectId129(organization);
|
|
47966
48278
|
cacheOptions.organization = organization.toString();
|
|
47967
48279
|
} catch (error) {
|
|
47968
48280
|
throw new BadRequestError198("Invalid organization ID format.");
|
|
@@ -48101,13 +48413,13 @@ function useUserRepoV2() {
|
|
|
48101
48413
|
);
|
|
48102
48414
|
}
|
|
48103
48415
|
try {
|
|
48104
|
-
_id = new
|
|
48416
|
+
_id = new ObjectId129(_id);
|
|
48105
48417
|
} catch (error) {
|
|
48106
48418
|
throw new BadRequestError198("Invalid ID.");
|
|
48107
48419
|
}
|
|
48108
48420
|
if (field === "defaultOrg") {
|
|
48109
48421
|
try {
|
|
48110
|
-
value = new
|
|
48422
|
+
value = new ObjectId129(value);
|
|
48111
48423
|
} catch (error) {
|
|
48112
48424
|
throw new BadRequestError198("Invalid organization ID.");
|
|
48113
48425
|
}
|
|
@@ -48148,7 +48460,7 @@ function useUserRepoV2() {
|
|
|
48148
48460
|
year
|
|
48149
48461
|
}, session) {
|
|
48150
48462
|
try {
|
|
48151
|
-
_id = new
|
|
48463
|
+
_id = new ObjectId129(_id);
|
|
48152
48464
|
} catch (error) {
|
|
48153
48465
|
throw new BadRequestError198("Invalid user ID format.");
|
|
48154
48466
|
}
|
|
@@ -48178,7 +48490,7 @@ function useUserRepoV2() {
|
|
|
48178
48490
|
}
|
|
48179
48491
|
async function updatePassword({ _id, password }, session) {
|
|
48180
48492
|
try {
|
|
48181
|
-
_id = new
|
|
48493
|
+
_id = new ObjectId129(_id);
|
|
48182
48494
|
} catch (error) {
|
|
48183
48495
|
throw new BadRequestError198("Invalid user ID format.");
|
|
48184
48496
|
}
|
|
@@ -49032,6 +49344,7 @@ export {
|
|
|
49032
49344
|
remarksSchema,
|
|
49033
49345
|
robotSchema,
|
|
49034
49346
|
schema,
|
|
49347
|
+
schemaApprovedBy,
|
|
49035
49348
|
schemaBilling,
|
|
49036
49349
|
schemaBillingConfiguration,
|
|
49037
49350
|
schemaBillingItem,
|