@7365admin1/core 2.31.0 → 2.31.1
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 +6 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.js +181 -236
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +181 -236
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -13112,7 +13112,7 @@ var schemaVisitorTransaction = Joi36.object({
|
|
|
13112
13112
|
arrivalTime: Joi36.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().allow(null, "").messages({
|
|
13113
13113
|
"string.pattern.base": "arrivalTime must be in HH:mm format (e.g. 09:30, 18:45)"
|
|
13114
13114
|
}),
|
|
13115
|
-
duration: Joi36.number().integer().optional().allow(null),
|
|
13115
|
+
duration: Joi36.number().integer().optional().allow(null, ""),
|
|
13116
13116
|
isOvernightParking: Joi36.boolean().optional().default(false),
|
|
13117
13117
|
email: Joi36.string().email().optional().allow(null, ""),
|
|
13118
13118
|
numberOfPassengers: Joi36.number().integer().optional().allow(null, ""),
|
|
@@ -13129,7 +13129,8 @@ var schemaVisitorTransaction = Joi36.object({
|
|
|
13129
13129
|
checkInRemarks: Joi36.string().optional().allow("", null),
|
|
13130
13130
|
checkOutRemarks: Joi36.string().optional().allow("", null),
|
|
13131
13131
|
expectedCheckIn: Joi36.string().isoDate().optional(),
|
|
13132
|
-
purpose: Joi36.string().optional().allow(null, "")
|
|
13132
|
+
purpose: Joi36.string().optional().allow(null, ""),
|
|
13133
|
+
invitedId: Joi36.any().optional().allow(null, "")
|
|
13133
13134
|
});
|
|
13134
13135
|
var schemaUpdateVisTrans = Joi36.object({
|
|
13135
13136
|
_id: Joi36.string().hex().length(24).required(),
|
|
@@ -13273,7 +13274,17 @@ function MVisitorTransaction(value) {
|
|
|
13273
13274
|
expiredAt: value.expiredAt ?? null,
|
|
13274
13275
|
createdAt: value.createdAt ?? newDate,
|
|
13275
13276
|
updatedAt: value.updatedAt ?? "",
|
|
13276
|
-
deletedAt: value.deletedAt ?? ""
|
|
13277
|
+
deletedAt: value.deletedAt ?? "",
|
|
13278
|
+
purpose: value.purpose,
|
|
13279
|
+
numberOfPassengers: value.numberOfPassengers ?? null,
|
|
13280
|
+
email: value.email,
|
|
13281
|
+
isOvernightParking: value.isOvernightParking ?? false,
|
|
13282
|
+
invitedId: new ObjectId39(String(value.invitedId)) ?? null,
|
|
13283
|
+
overnightParking: value.isOvernightParking == true ? {
|
|
13284
|
+
status: "pending approval",
|
|
13285
|
+
remarks: "",
|
|
13286
|
+
updatedBy: new ObjectId39(String(value.invitedId)) ?? null
|
|
13287
|
+
} : null
|
|
13277
13288
|
};
|
|
13278
13289
|
}
|
|
13279
13290
|
|
|
@@ -13405,16 +13416,40 @@ function useVisitorTransactionRepo() {
|
|
|
13405
13416
|
localField: "visitorPass.keyId",
|
|
13406
13417
|
foreignField: "_id",
|
|
13407
13418
|
pipeline: [
|
|
13419
|
+
{
|
|
13420
|
+
$lookup: {
|
|
13421
|
+
from: "qr-code-templates",
|
|
13422
|
+
localField: "template",
|
|
13423
|
+
foreignField: "_id",
|
|
13424
|
+
pipeline: [
|
|
13425
|
+
{
|
|
13426
|
+
$project: {
|
|
13427
|
+
_id: 1,
|
|
13428
|
+
prefixPass: 1,
|
|
13429
|
+
name: 1
|
|
13430
|
+
}
|
|
13431
|
+
}
|
|
13432
|
+
],
|
|
13433
|
+
as: "template"
|
|
13434
|
+
}
|
|
13435
|
+
},
|
|
13408
13436
|
{
|
|
13409
13437
|
$project: {
|
|
13410
13438
|
_id: 0,
|
|
13411
|
-
// remove original _id
|
|
13412
13439
|
keyId: "$_id",
|
|
13413
13440
|
status: 1,
|
|
13414
13441
|
description: 1,
|
|
13442
|
+
templatePrefixPass: {
|
|
13443
|
+
$arrayElemAt: ["$template.prefixPass", 0]
|
|
13444
|
+
},
|
|
13415
13445
|
prefixAndName: {
|
|
13416
13446
|
$concat: [
|
|
13417
|
-
{
|
|
13447
|
+
{
|
|
13448
|
+
$ifNull: [
|
|
13449
|
+
{ $arrayElemAt: ["$template.prefixPass", 0] },
|
|
13450
|
+
""
|
|
13451
|
+
]
|
|
13452
|
+
},
|
|
13418
13453
|
{ $ifNull: ["$name", ""] }
|
|
13419
13454
|
]
|
|
13420
13455
|
}
|
|
@@ -13427,145 +13462,50 @@ function useVisitorTransactionRepo() {
|
|
|
13427
13462
|
{
|
|
13428
13463
|
$lookup: {
|
|
13429
13464
|
from: "keys",
|
|
13430
|
-
localField: "
|
|
13465
|
+
localField: "passKeys.keyId",
|
|
13431
13466
|
foreignField: "_id",
|
|
13432
13467
|
pipeline: [
|
|
13433
13468
|
{
|
|
13434
|
-
$
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
as: "visitorPassDetails"
|
|
13445
|
-
}
|
|
13446
|
-
},
|
|
13447
|
-
{
|
|
13448
|
-
$addFields: {
|
|
13449
|
-
visitorPass: {
|
|
13450
|
-
$map: {
|
|
13451
|
-
input: "$visitorPass",
|
|
13452
|
-
as: "vp",
|
|
13453
|
-
in: {
|
|
13454
|
-
$let: {
|
|
13455
|
-
vars: {
|
|
13456
|
-
matchedKey: {
|
|
13457
|
-
$arrayElemAt: [
|
|
13458
|
-
{
|
|
13459
|
-
$filter: {
|
|
13460
|
-
input: "$visitorPassDetails",
|
|
13461
|
-
as: "kd",
|
|
13462
|
-
cond: { $eq: ["$$kd._id", "$$vp.keyId"] }
|
|
13463
|
-
}
|
|
13464
|
-
},
|
|
13465
|
-
0
|
|
13466
|
-
]
|
|
13467
|
-
}
|
|
13468
|
-
},
|
|
13469
|
-
in: {
|
|
13470
|
-
keyId: "$$vp.keyId",
|
|
13471
|
-
receivedDate: "$$vp.receivedDate",
|
|
13472
|
-
status: "$$vp.status",
|
|
13473
|
-
lastUpdate: {
|
|
13474
|
-
$max: [
|
|
13475
|
-
"$$matchedKey.createdAt",
|
|
13476
|
-
"$$matchedKey.updatedAt"
|
|
13477
|
-
]
|
|
13478
|
-
},
|
|
13479
|
-
remarks: "$$vp.remarks",
|
|
13480
|
-
description: "$$matchedKey.description",
|
|
13481
|
-
prefixAndName: {
|
|
13482
|
-
$concat: [
|
|
13483
|
-
{ $ifNull: ["$$matchedKey.prefix", ""] },
|
|
13484
|
-
{ $ifNull: ["$$matchedKey.name", ""] }
|
|
13485
|
-
]
|
|
13469
|
+
$lookup: {
|
|
13470
|
+
from: "qr-code-templates",
|
|
13471
|
+
localField: "template",
|
|
13472
|
+
foreignField: "_id",
|
|
13473
|
+
pipeline: [
|
|
13474
|
+
{
|
|
13475
|
+
$project: {
|
|
13476
|
+
_id: 1,
|
|
13477
|
+
prefixPass: 1,
|
|
13478
|
+
name: 1
|
|
13486
13479
|
}
|
|
13487
13480
|
}
|
|
13488
|
-
|
|
13481
|
+
],
|
|
13482
|
+
as: "template"
|
|
13489
13483
|
}
|
|
13490
|
-
}
|
|
13491
|
-
}
|
|
13492
|
-
}
|
|
13493
|
-
},
|
|
13494
|
-
{
|
|
13495
|
-
$project: {
|
|
13496
|
-
visitorPassDetails: 0
|
|
13497
|
-
}
|
|
13498
|
-
},
|
|
13499
|
-
{
|
|
13500
|
-
$lookup: {
|
|
13501
|
-
from: "keys",
|
|
13502
|
-
localField: "passKeys.keyId",
|
|
13503
|
-
foreignField: "_id",
|
|
13504
|
-
pipeline: [
|
|
13484
|
+
},
|
|
13505
13485
|
{
|
|
13506
13486
|
$project: {
|
|
13507
|
-
_id:
|
|
13508
|
-
|
|
13509
|
-
|
|
13487
|
+
_id: 0,
|
|
13488
|
+
keyId: "$_id",
|
|
13489
|
+
status: 1,
|
|
13510
13490
|
description: 1,
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
$addFields: {
|
|
13521
|
-
passKeys: {
|
|
13522
|
-
$map: {
|
|
13523
|
-
input: "$passKeys",
|
|
13524
|
-
as: "pk",
|
|
13525
|
-
in: {
|
|
13526
|
-
$let: {
|
|
13527
|
-
vars: {
|
|
13528
|
-
matchedKey: {
|
|
13529
|
-
$arrayElemAt: [
|
|
13530
|
-
{
|
|
13531
|
-
$filter: {
|
|
13532
|
-
input: "$passKeysDetails",
|
|
13533
|
-
as: "kd",
|
|
13534
|
-
cond: { $eq: ["$$kd._id", "$$pk.keyId"] }
|
|
13535
|
-
}
|
|
13536
|
-
},
|
|
13537
|
-
0
|
|
13538
|
-
]
|
|
13539
|
-
}
|
|
13540
|
-
},
|
|
13541
|
-
in: {
|
|
13542
|
-
keyId: "$$pk.keyId",
|
|
13543
|
-
receivedDate: "$$pk.receivedDate",
|
|
13544
|
-
status: "$$pk.status",
|
|
13545
|
-
lastUpdate: {
|
|
13546
|
-
$max: [
|
|
13547
|
-
"$$matchedKey.createdAt",
|
|
13548
|
-
"$$matchedKey.updatedAt"
|
|
13491
|
+
templatePrefixPass: {
|
|
13492
|
+
$arrayElemAt: ["$template.prefixPass", 0]
|
|
13493
|
+
},
|
|
13494
|
+
prefixAndName: {
|
|
13495
|
+
$concat: [
|
|
13496
|
+
{
|
|
13497
|
+
$ifNull: [
|
|
13498
|
+
{ $arrayElemAt: ["$template.prefixPass", 0] },
|
|
13499
|
+
""
|
|
13549
13500
|
]
|
|
13550
13501
|
},
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
prefixAndName: {
|
|
13554
|
-
$concat: [
|
|
13555
|
-
{ $ifNull: ["$$matchedKey.prefix", ""] },
|
|
13556
|
-
{ $ifNull: ["$$matchedKey.name", ""] }
|
|
13557
|
-
]
|
|
13558
|
-
}
|
|
13559
|
-
}
|
|
13502
|
+
{ $ifNull: ["$name", ""] }
|
|
13503
|
+
]
|
|
13560
13504
|
}
|
|
13561
13505
|
}
|
|
13562
13506
|
}
|
|
13563
|
-
|
|
13564
|
-
|
|
13565
|
-
},
|
|
13566
|
-
{
|
|
13567
|
-
$project: {
|
|
13568
|
-
passKeysDetails: 0
|
|
13507
|
+
],
|
|
13508
|
+
as: "passKeys"
|
|
13569
13509
|
}
|
|
13570
13510
|
},
|
|
13571
13511
|
{ $sort: sort },
|
|
@@ -21674,6 +21614,7 @@ function useVisitorTransactionService() {
|
|
|
21674
21614
|
getExpiredCheckedOutTransactionsBySite: _getExpiredCheckedOutTransactionsBySite,
|
|
21675
21615
|
updateManyDahuaSyncStatus: _updateManyDahuaSyncStatus
|
|
21676
21616
|
} = useVisitorTransactionRepo();
|
|
21617
|
+
const { getById } = useBuildingUnitRepo();
|
|
21677
21618
|
const {
|
|
21678
21619
|
add: _addPerson,
|
|
21679
21620
|
getByNRIC,
|
|
@@ -22072,6 +22013,7 @@ function useVisitorTransactionService() {
|
|
|
22072
22013
|
try {
|
|
22073
22014
|
session.startTransaction();
|
|
22074
22015
|
const inviter = await _getByUserId(userId);
|
|
22016
|
+
const unit = await getById(inviter?.unit);
|
|
22075
22017
|
value.checkIn = null;
|
|
22076
22018
|
const dir = __dirname;
|
|
22077
22019
|
const filePath = getDirectory2(dir, "./public/handlebars/visitor-invite");
|
|
@@ -22080,9 +22022,11 @@ function useVisitorTransactionService() {
|
|
|
22080
22022
|
block: inviter?.block,
|
|
22081
22023
|
level: inviter?.level,
|
|
22082
22024
|
unit: inviter?.unit,
|
|
22025
|
+
unitName: unit?.name,
|
|
22083
22026
|
org: inviter?.org.toString(),
|
|
22084
22027
|
site: inviter?.site.toString(),
|
|
22085
|
-
status: "pending" /* PENDING
|
|
22028
|
+
status: "pending" /* PENDING */,
|
|
22029
|
+
invitedId: inviter?._id
|
|
22086
22030
|
};
|
|
22087
22031
|
const result = await _add(payload);
|
|
22088
22032
|
const emailContent = compileHandlebar2({
|
|
@@ -22305,7 +22249,7 @@ function useVisitorTransactionController() {
|
|
|
22305
22249
|
arrivalTime: Joi55.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().allow(null, "").messages({
|
|
22306
22250
|
"string.pattern.base": "arrivalTime must be in HH:mm format (e.g. 09:30, 18:45)"
|
|
22307
22251
|
}),
|
|
22308
|
-
duration: Joi55.number().integer().optional().allow(null),
|
|
22252
|
+
duration: Joi55.number().integer().optional().allow(null, ""),
|
|
22309
22253
|
name: Joi55.string().required(),
|
|
22310
22254
|
contact: Joi55.string().required(),
|
|
22311
22255
|
email: Joi55.string().email().required(),
|
|
@@ -22328,8 +22272,8 @@ function useVisitorTransactionController() {
|
|
|
22328
22272
|
const { expectedCheckIn, arrivalTime, duration, name, contact, email, plateNumber, isOvernightParking, numberOfPassengers, purpose, inviterUserId } = value;
|
|
22329
22273
|
const rest = { expectedCheckIn, arrivalTime, duration, name, contact, email, plateNumber, isOvernightParking, numberOfPassengers, purpose };
|
|
22330
22274
|
try {
|
|
22331
|
-
await _inviteVisitor(rest, inviterUserId);
|
|
22332
|
-
res.status(200).json({
|
|
22275
|
+
const result = await _inviteVisitor(rest, inviterUserId);
|
|
22276
|
+
res.status(200).json({ insertedId: result });
|
|
22333
22277
|
return;
|
|
22334
22278
|
} catch (error2) {
|
|
22335
22279
|
logger78.log({ level: "error", message: error2.message });
|
|
@@ -40071,6 +40015,7 @@ function useNfcPatrolSettingsController() {
|
|
|
40071
40015
|
|
|
40072
40016
|
// src/services/occurrence-entry.service.ts
|
|
40073
40017
|
import { useAtlas as useAtlas93 } from "@7365admin1/node-server-utils";
|
|
40018
|
+
import { ObjectId as ObjectId108 } from "mongodb";
|
|
40074
40019
|
|
|
40075
40020
|
// src/repositories/occurrence-subject.repo.ts
|
|
40076
40021
|
import {
|
|
@@ -40288,22 +40233,11 @@ function useOccurrenceSubjectRepo() {
|
|
|
40288
40233
|
} catch (error) {
|
|
40289
40234
|
throw new BadRequestError169("Invalid occurrence subject ID format.");
|
|
40290
40235
|
}
|
|
40291
|
-
const cacheKey = makeCacheKey54(namespace_collection, { _id });
|
|
40292
|
-
const cachedData = await getCache(cacheKey);
|
|
40293
|
-
if (cachedData) {
|
|
40294
|
-
logger146.info(`Cache hit for key: ${cacheKey}`);
|
|
40295
|
-
return cachedData;
|
|
40296
|
-
}
|
|
40297
40236
|
try {
|
|
40298
40237
|
const data = await collection.findOne({ _id }, { session });
|
|
40299
40238
|
if (!data) {
|
|
40300
40239
|
throw new NotFoundError46("Occurrence subject not found.");
|
|
40301
40240
|
}
|
|
40302
|
-
setCache(cacheKey, data, 15 * 60).then(() => {
|
|
40303
|
-
logger146.info(`Cache set for key: ${cacheKey}`);
|
|
40304
|
-
}).catch((err) => {
|
|
40305
|
-
logger146.error(`Failed to set cache for key: ${cacheKey}`, err);
|
|
40306
|
-
});
|
|
40307
40241
|
return data;
|
|
40308
40242
|
} catch (error) {
|
|
40309
40243
|
throw error;
|
|
@@ -40444,11 +40378,22 @@ function useOccurrenceEntryService() {
|
|
|
40444
40378
|
const updatedSerialNumber = (entrySerialNumber + 0.1).toFixed(1);
|
|
40445
40379
|
const dobId = occurrenceEntry.dailyOccurrenceBookId;
|
|
40446
40380
|
const book = await _getOccurrenceBookById(dobId);
|
|
40447
|
-
const subject = await _getOccurrenceSubjectById(
|
|
40381
|
+
const subject = await _getOccurrenceSubjectById(
|
|
40382
|
+
occurrenceEntry.subject._id
|
|
40383
|
+
);
|
|
40384
|
+
value.subject = value.subject ? value.subject : occurrenceEntry.subject._id;
|
|
40385
|
+
value.subjectName = subject.subject;
|
|
40448
40386
|
value.serialNumber = updatedSerialNumber;
|
|
40449
40387
|
value.site = occurrenceEntry.site;
|
|
40450
40388
|
value.dailyOccurrenceBookId = occurrenceEntry.dailyOccurrenceBookId;
|
|
40451
|
-
value.
|
|
40389
|
+
value.bookEntryCount = value.bookEntryCount ? value.bookEntryCount : occurrenceEntry.bookEntryCount;
|
|
40390
|
+
value.occurrence = value.occurrence ? value.occurrence : occurrenceEntry.occurrence;
|
|
40391
|
+
value.signature = value.signature ? new ObjectId108(value.signature) : occurrenceEntry.signature._id;
|
|
40392
|
+
value.eSignature = value.eSignature ? new ObjectId108(value.eSignature) : occurrenceEntry.eSignature;
|
|
40393
|
+
value.createdAt = /* @__PURE__ */ new Date();
|
|
40394
|
+
value.date = /* @__PURE__ */ new Date();
|
|
40395
|
+
value.userName = value.userName ? value.userName : occurrenceEntry.signature.name;
|
|
40396
|
+
value.createdByName = value.createdByName ? value.createdByName : occurrenceEntry.createdByName;
|
|
40452
40397
|
await _updateOccurrenceBookById(dobId, {
|
|
40453
40398
|
totalInput: book.totalInput + 1
|
|
40454
40399
|
});
|
|
@@ -40644,7 +40589,7 @@ function useOccurrenceEntryController() {
|
|
|
40644
40589
|
|
|
40645
40590
|
// src/models/online-form.model.ts
|
|
40646
40591
|
import Joi105 from "joi";
|
|
40647
|
-
import { ObjectId as
|
|
40592
|
+
import { ObjectId as ObjectId109 } from "mongodb";
|
|
40648
40593
|
var schemaOnlineForm = Joi105.object({
|
|
40649
40594
|
_id: Joi105.string().hex().optional().allow("", null),
|
|
40650
40595
|
name: Joi105.string().required(),
|
|
@@ -40692,21 +40637,21 @@ function MOnlineForm(value) {
|
|
|
40692
40637
|
}
|
|
40693
40638
|
if (value._id && typeof value._id === "string") {
|
|
40694
40639
|
try {
|
|
40695
|
-
value._id = new
|
|
40640
|
+
value._id = new ObjectId109(value._id);
|
|
40696
40641
|
} catch (error2) {
|
|
40697
40642
|
throw new Error("Invalid ID.");
|
|
40698
40643
|
}
|
|
40699
40644
|
}
|
|
40700
40645
|
if (value.org && typeof value.org === "string") {
|
|
40701
40646
|
try {
|
|
40702
|
-
value.org = new
|
|
40647
|
+
value.org = new ObjectId109(value.org);
|
|
40703
40648
|
} catch (error2) {
|
|
40704
40649
|
throw new Error("Invalid org ID.");
|
|
40705
40650
|
}
|
|
40706
40651
|
}
|
|
40707
40652
|
if (value.site && typeof value.site === "string") {
|
|
40708
40653
|
try {
|
|
40709
|
-
value.site = new
|
|
40654
|
+
value.site = new ObjectId109(value.site);
|
|
40710
40655
|
} catch (error2) {
|
|
40711
40656
|
throw new Error("Invalid site ID.");
|
|
40712
40657
|
}
|
|
@@ -40738,7 +40683,7 @@ import {
|
|
|
40738
40683
|
useAtlas as useAtlas94,
|
|
40739
40684
|
useCache as useCache57
|
|
40740
40685
|
} from "@7365admin1/node-server-utils";
|
|
40741
|
-
import { ObjectId as
|
|
40686
|
+
import { ObjectId as ObjectId110 } from "mongodb";
|
|
40742
40687
|
function useOnlineFormRepo() {
|
|
40743
40688
|
const db = useAtlas94.getDb();
|
|
40744
40689
|
if (!db) {
|
|
@@ -40790,7 +40735,7 @@ function useOnlineFormRepo() {
|
|
|
40790
40735
|
}) {
|
|
40791
40736
|
page = page > 0 ? page - 1 : 0;
|
|
40792
40737
|
try {
|
|
40793
|
-
site = new
|
|
40738
|
+
site = new ObjectId110(site);
|
|
40794
40739
|
} catch (error) {
|
|
40795
40740
|
throw new BadRequestError171("Invalid site ID format.");
|
|
40796
40741
|
}
|
|
@@ -40850,7 +40795,7 @@ function useOnlineFormRepo() {
|
|
|
40850
40795
|
}
|
|
40851
40796
|
async function getOnlineFormById(_id) {
|
|
40852
40797
|
try {
|
|
40853
|
-
_id = new
|
|
40798
|
+
_id = new ObjectId110(_id);
|
|
40854
40799
|
} catch (error) {
|
|
40855
40800
|
throw new BadRequestError171("Invalid online form ID format.");
|
|
40856
40801
|
}
|
|
@@ -40893,7 +40838,7 @@ function useOnlineFormRepo() {
|
|
|
40893
40838
|
}
|
|
40894
40839
|
async function updateOnlineFormById(_id, value) {
|
|
40895
40840
|
try {
|
|
40896
|
-
_id = new
|
|
40841
|
+
_id = new ObjectId110(_id);
|
|
40897
40842
|
} catch (error) {
|
|
40898
40843
|
throw new BadRequestError171("Invalid online form ID format.");
|
|
40899
40844
|
}
|
|
@@ -40921,7 +40866,7 @@ function useOnlineFormRepo() {
|
|
|
40921
40866
|
}
|
|
40922
40867
|
async function deleteOnlineFormById(_id, session) {
|
|
40923
40868
|
try {
|
|
40924
|
-
_id = new
|
|
40869
|
+
_id = new ObjectId110(_id);
|
|
40925
40870
|
} catch (error) {
|
|
40926
40871
|
throw new BadRequestError171("Invalid online form ID format.");
|
|
40927
40872
|
}
|
|
@@ -40954,7 +40899,7 @@ function useOnlineFormRepo() {
|
|
|
40954
40899
|
}
|
|
40955
40900
|
async function getOnlineFormsBySiteId(site, { search = "", page = 1, limit = 10, status = "active" }) {
|
|
40956
40901
|
try {
|
|
40957
|
-
site = new
|
|
40902
|
+
site = new ObjectId110(site);
|
|
40958
40903
|
} catch (error) {
|
|
40959
40904
|
throw new BadRequestError171(
|
|
40960
40905
|
"Invalid online form configuration site ID format."
|
|
@@ -41395,7 +41340,7 @@ function useOccurrenceSubjectController() {
|
|
|
41395
41340
|
}
|
|
41396
41341
|
|
|
41397
41342
|
// src/models/nfc-patrol-log.model.ts
|
|
41398
|
-
import { ObjectId as
|
|
41343
|
+
import { ObjectId as ObjectId111 } from "mongodb";
|
|
41399
41344
|
import Joi108 from "joi";
|
|
41400
41345
|
import { BadRequestError as BadRequestError174, logger as logger151 } from "@7365admin1/node-server-utils";
|
|
41401
41346
|
var schemaNfcPatrolLog = Joi108.object({
|
|
@@ -41447,32 +41392,32 @@ function MNfcPatrolLog(valueArg) {
|
|
|
41447
41392
|
}
|
|
41448
41393
|
if (value._id && typeof value._id === "string") {
|
|
41449
41394
|
try {
|
|
41450
|
-
value._id = new
|
|
41395
|
+
value._id = new ObjectId111(value._id);
|
|
41451
41396
|
} catch (error2) {
|
|
41452
41397
|
throw new BadRequestError174("Invalid _id format");
|
|
41453
41398
|
}
|
|
41454
41399
|
}
|
|
41455
41400
|
try {
|
|
41456
|
-
value.site = new
|
|
41401
|
+
value.site = new ObjectId111(value.site);
|
|
41457
41402
|
} catch (error2) {
|
|
41458
41403
|
throw new BadRequestError174("Invalid site format");
|
|
41459
41404
|
}
|
|
41460
41405
|
if (value?.createdBy) {
|
|
41461
41406
|
try {
|
|
41462
|
-
value.createdBy = new
|
|
41407
|
+
value.createdBy = new ObjectId111(value.createdBy);
|
|
41463
41408
|
} catch (error2) {
|
|
41464
41409
|
throw new BadRequestError174("Invalid createdBy format");
|
|
41465
41410
|
}
|
|
41466
41411
|
}
|
|
41467
41412
|
if (value?.route?._id) {
|
|
41468
41413
|
try {
|
|
41469
|
-
value.route._id = new
|
|
41414
|
+
value.route._id = new ObjectId111(value.route._id);
|
|
41470
41415
|
} catch (error2) {
|
|
41471
41416
|
throw new BadRequestError174("Invalid route _id format");
|
|
41472
41417
|
}
|
|
41473
41418
|
}
|
|
41474
41419
|
return {
|
|
41475
|
-
_id: value._id ?? new
|
|
41420
|
+
_id: value._id ?? new ObjectId111(),
|
|
41476
41421
|
site: value.site,
|
|
41477
41422
|
route: value.route,
|
|
41478
41423
|
date: value.date,
|
|
@@ -41494,7 +41439,7 @@ import {
|
|
|
41494
41439
|
useAtlas as useAtlas96,
|
|
41495
41440
|
useCache as useCache58
|
|
41496
41441
|
} from "@7365admin1/node-server-utils";
|
|
41497
|
-
import { ObjectId as
|
|
41442
|
+
import { ObjectId as ObjectId112 } from "mongodb";
|
|
41498
41443
|
function useNfcPatrolLogRepo() {
|
|
41499
41444
|
const db = useAtlas96.getDb();
|
|
41500
41445
|
if (!db) {
|
|
@@ -41547,7 +41492,7 @@ function useNfcPatrolLogRepo() {
|
|
|
41547
41492
|
const pageIndex = page > 0 ? page - 1 : 0;
|
|
41548
41493
|
let siteId;
|
|
41549
41494
|
try {
|
|
41550
|
-
siteId = typeof site === "string" ? new
|
|
41495
|
+
siteId = typeof site === "string" ? new ObjectId112(site) : site;
|
|
41551
41496
|
} catch {
|
|
41552
41497
|
throw new BadRequestError175("Invalid site ID format.");
|
|
41553
41498
|
}
|
|
@@ -41558,7 +41503,7 @@ function useNfcPatrolLogRepo() {
|
|
|
41558
41503
|
query.date = date;
|
|
41559
41504
|
}
|
|
41560
41505
|
if (route?._id) {
|
|
41561
|
-
query["route._id"] = typeof route._id === "string" ? new
|
|
41506
|
+
query["route._id"] = typeof route._id === "string" ? new ObjectId112(route._id) : route._id;
|
|
41562
41507
|
}
|
|
41563
41508
|
if (route?.startTime) {
|
|
41564
41509
|
query["route.startTime"] = route.startTime;
|
|
@@ -42430,7 +42375,7 @@ function useNewDashboardController() {
|
|
|
42430
42375
|
|
|
42431
42376
|
// src/models/manpower-monitoring.model.ts
|
|
42432
42377
|
import Joi111 from "joi";
|
|
42433
|
-
import { ObjectId as
|
|
42378
|
+
import { ObjectId as ObjectId113 } from "mongodb";
|
|
42434
42379
|
var shiftSchema = Joi111.object({
|
|
42435
42380
|
name: Joi111.string().required(),
|
|
42436
42381
|
checkIn: Joi111.string().optional().allow("", null),
|
|
@@ -42455,7 +42400,7 @@ var manpowerMonitoringSchema = Joi111.object({
|
|
|
42455
42400
|
});
|
|
42456
42401
|
var MManpowerMonitoring = class {
|
|
42457
42402
|
constructor(data) {
|
|
42458
|
-
this._id = new
|
|
42403
|
+
this._id = new ObjectId113();
|
|
42459
42404
|
this.serviceProviderId = data.serviceProviderId || "";
|
|
42460
42405
|
this.siteId = data.siteId || "";
|
|
42461
42406
|
this.siteName = data.siteName;
|
|
@@ -42925,7 +42870,7 @@ var hrmlabs_attendance_util_default = {
|
|
|
42925
42870
|
};
|
|
42926
42871
|
|
|
42927
42872
|
// src/repositories/manpower-monitoring.repo.ts
|
|
42928
|
-
import { ObjectId as
|
|
42873
|
+
import { ObjectId as ObjectId114 } from "mongodb";
|
|
42929
42874
|
var { hrmLabsAuthentication: hrmLabsAuthentication2, fetchSites: fetchSites2 } = hrmlabs_attendance_util_default;
|
|
42930
42875
|
function useManpowerMonitoringRepo() {
|
|
42931
42876
|
const db = useAtlas99.getDb();
|
|
@@ -42939,11 +42884,11 @@ function useManpowerMonitoringRepo() {
|
|
|
42939
42884
|
try {
|
|
42940
42885
|
value = new MManpowerMonitoring(value);
|
|
42941
42886
|
if (value.createdBy)
|
|
42942
|
-
value.createdBy = new
|
|
42887
|
+
value.createdBy = new ObjectId114(value.createdBy);
|
|
42943
42888
|
if (value.siteId)
|
|
42944
|
-
value.siteId = new
|
|
42889
|
+
value.siteId = new ObjectId114(value.siteId);
|
|
42945
42890
|
if (value.serviceProviderId)
|
|
42946
|
-
value.serviceProviderId = new
|
|
42891
|
+
value.serviceProviderId = new ObjectId114(value.serviceProviderId);
|
|
42947
42892
|
const result = await collection.insertOne(value, { session });
|
|
42948
42893
|
return result;
|
|
42949
42894
|
} catch (error) {
|
|
@@ -42984,8 +42929,8 @@ function useManpowerMonitoringRepo() {
|
|
|
42984
42929
|
}
|
|
42985
42930
|
async function getManpowerSettingsBySiteId(_id, serviceProviderId) {
|
|
42986
42931
|
try {
|
|
42987
|
-
_id = new
|
|
42988
|
-
serviceProviderId = new
|
|
42932
|
+
_id = new ObjectId114(_id);
|
|
42933
|
+
serviceProviderId = new ObjectId114(serviceProviderId);
|
|
42989
42934
|
} catch (error) {
|
|
42990
42935
|
throw new Error("Invalid Site ID format.");
|
|
42991
42936
|
}
|
|
@@ -43001,7 +42946,7 @@ function useManpowerMonitoringRepo() {
|
|
|
43001
42946
|
}
|
|
43002
42947
|
async function updateManpowerMonitoringSettings(_id, value) {
|
|
43003
42948
|
try {
|
|
43004
|
-
_id = new
|
|
42949
|
+
_id = new ObjectId114(_id);
|
|
43005
42950
|
} catch (error) {
|
|
43006
42951
|
throw new BadRequestError180("Invalid ID format.");
|
|
43007
42952
|
}
|
|
@@ -43028,7 +42973,7 @@ function useManpowerMonitoringRepo() {
|
|
|
43028
42973
|
for (let item of value) {
|
|
43029
42974
|
item = new MManpowerMonitoring(item);
|
|
43030
42975
|
const data = await collection.findOne({
|
|
43031
|
-
siteId: new
|
|
42976
|
+
siteId: new ObjectId114(item.siteId)
|
|
43032
42977
|
});
|
|
43033
42978
|
if (data) {
|
|
43034
42979
|
let updateValue;
|
|
@@ -43053,11 +42998,11 @@ function useManpowerMonitoringRepo() {
|
|
|
43053
42998
|
}
|
|
43054
42999
|
} else {
|
|
43055
43000
|
if (item.createdBy)
|
|
43056
|
-
item.createdBy = new
|
|
43001
|
+
item.createdBy = new ObjectId114(item.createdBy);
|
|
43057
43002
|
if (item.siteId)
|
|
43058
|
-
item.siteId = new
|
|
43003
|
+
item.siteId = new ObjectId114(item.siteId);
|
|
43059
43004
|
if (item.serviceProviderId)
|
|
43060
|
-
item.serviceProviderId = new
|
|
43005
|
+
item.serviceProviderId = new ObjectId114(item.serviceProviderId);
|
|
43061
43006
|
const result = await collection.insertOne(item);
|
|
43062
43007
|
if (result.insertedId) {
|
|
43063
43008
|
results.inserted++;
|
|
@@ -43081,7 +43026,7 @@ function useManpowerMonitoringRepo() {
|
|
|
43081
43026
|
const siteUrl = process.env.HRMLABS_SITE_URL;
|
|
43082
43027
|
try {
|
|
43083
43028
|
const serviceProvider = await serviceProviderCollection.findOne({
|
|
43084
|
-
_id: new
|
|
43029
|
+
_id: new ObjectId114(serviceProviderId)
|
|
43085
43030
|
});
|
|
43086
43031
|
if (!serviceProvider) {
|
|
43087
43032
|
throw new Error("Service Provider not found.");
|
|
@@ -43131,7 +43076,7 @@ import {
|
|
|
43131
43076
|
|
|
43132
43077
|
// src/models/manpower-remarks.model.ts
|
|
43133
43078
|
import Joi112 from "joi";
|
|
43134
|
-
import { ObjectId as
|
|
43079
|
+
import { ObjectId as ObjectId115 } from "mongodb";
|
|
43135
43080
|
var remarksSchema = Joi112.object({
|
|
43136
43081
|
name: Joi112.string().required(),
|
|
43137
43082
|
remark: Joi112.object({
|
|
@@ -43155,7 +43100,7 @@ var manpowerRemarksSchema = Joi112.object({
|
|
|
43155
43100
|
});
|
|
43156
43101
|
var MManpowerRemarks = class {
|
|
43157
43102
|
constructor(data) {
|
|
43158
|
-
this._id = new
|
|
43103
|
+
this._id = new ObjectId115();
|
|
43159
43104
|
this.serviceProviderId = data.serviceProviderId || "";
|
|
43160
43105
|
this.siteId = data.siteId || "";
|
|
43161
43106
|
this.siteName = data.siteName || "";
|
|
@@ -43173,7 +43118,7 @@ var MManpowerRemarks = class {
|
|
|
43173
43118
|
};
|
|
43174
43119
|
|
|
43175
43120
|
// src/repositories/manpower-remarks.repo.ts
|
|
43176
|
-
import { ObjectId as
|
|
43121
|
+
import { ObjectId as ObjectId116 } from "mongodb";
|
|
43177
43122
|
import moment2 from "moment-timezone";
|
|
43178
43123
|
function useManpowerRemarksRepo() {
|
|
43179
43124
|
const db = useAtlas100.getDb();
|
|
@@ -43186,9 +43131,9 @@ function useManpowerRemarksRepo() {
|
|
|
43186
43131
|
try {
|
|
43187
43132
|
value = new MManpowerRemarks(value);
|
|
43188
43133
|
if (value.siteId)
|
|
43189
|
-
value.siteId = new
|
|
43134
|
+
value.siteId = new ObjectId116(value.siteId);
|
|
43190
43135
|
if (value.serviceProviderId)
|
|
43191
|
-
value.serviceProviderId = new
|
|
43136
|
+
value.serviceProviderId = new ObjectId116(value.serviceProviderId);
|
|
43192
43137
|
const result = await collection.insertOne(value, { session });
|
|
43193
43138
|
return result;
|
|
43194
43139
|
} catch (error) {
|
|
@@ -43208,7 +43153,7 @@ function useManpowerRemarksRepo() {
|
|
|
43208
43153
|
limit = limit || 10;
|
|
43209
43154
|
const searchQuery = {};
|
|
43210
43155
|
const nowSGT = moment2().tz("Asia/Singapore");
|
|
43211
|
-
searchQuery.serviceProviderId = new
|
|
43156
|
+
searchQuery.serviceProviderId = new ObjectId116(serviceProviderId);
|
|
43212
43157
|
if (search != "") {
|
|
43213
43158
|
searchQuery.siteName = { $regex: search, $options: "i" };
|
|
43214
43159
|
}
|
|
@@ -43240,8 +43185,8 @@ function useManpowerRemarksRepo() {
|
|
|
43240
43185
|
}
|
|
43241
43186
|
async function getManpowerRemarksBySiteId(_id, date, serviceProviderId) {
|
|
43242
43187
|
try {
|
|
43243
|
-
_id = new
|
|
43244
|
-
serviceProviderId = new
|
|
43188
|
+
_id = new ObjectId116(_id);
|
|
43189
|
+
serviceProviderId = new ObjectId116(serviceProviderId);
|
|
43245
43190
|
} catch (error) {
|
|
43246
43191
|
throw new Error("Invalid Site ID format.");
|
|
43247
43192
|
}
|
|
@@ -43258,13 +43203,13 @@ function useManpowerRemarksRepo() {
|
|
|
43258
43203
|
}
|
|
43259
43204
|
async function updateManpowerRemarks(_id, value) {
|
|
43260
43205
|
try {
|
|
43261
|
-
_id = new
|
|
43206
|
+
_id = new ObjectId116(_id);
|
|
43262
43207
|
} catch (error) {
|
|
43263
43208
|
throw new BadRequestError181("Invalid ID format.");
|
|
43264
43209
|
}
|
|
43265
43210
|
try {
|
|
43266
43211
|
if (value.createdBy) {
|
|
43267
|
-
value.createdBy = new
|
|
43212
|
+
value.createdBy = new ObjectId116(value.createdBy);
|
|
43268
43213
|
}
|
|
43269
43214
|
const updateValue = {
|
|
43270
43215
|
...value,
|
|
@@ -43281,7 +43226,7 @@ function useManpowerRemarksRepo() {
|
|
|
43281
43226
|
}
|
|
43282
43227
|
async function updateRemarksStatus(_id, value) {
|
|
43283
43228
|
try {
|
|
43284
|
-
_id = new
|
|
43229
|
+
_id = new ObjectId116(_id);
|
|
43285
43230
|
} catch (error) {
|
|
43286
43231
|
throw new BadRequestError181("Invalid ID format.");
|
|
43287
43232
|
}
|
|
@@ -43553,7 +43498,7 @@ function useManpowerMonitoringCtrl() {
|
|
|
43553
43498
|
|
|
43554
43499
|
// src/models/manpower-designations.model.ts
|
|
43555
43500
|
import Joi114 from "joi";
|
|
43556
|
-
import { ObjectId as
|
|
43501
|
+
import { ObjectId as ObjectId117 } from "mongodb";
|
|
43557
43502
|
var designationsSchema = Joi114.object({
|
|
43558
43503
|
title: Joi114.string().required(),
|
|
43559
43504
|
shifts: Joi114.object({
|
|
@@ -43572,7 +43517,7 @@ var manpowerDesignationsSchema = Joi114.object({
|
|
|
43572
43517
|
});
|
|
43573
43518
|
var MManpowerDesignations = class {
|
|
43574
43519
|
constructor(data) {
|
|
43575
|
-
this._id = new
|
|
43520
|
+
this._id = new ObjectId117();
|
|
43576
43521
|
this.siteId = data.siteId || "";
|
|
43577
43522
|
this.siteName = data.siteName || "";
|
|
43578
43523
|
this.serviceProviderId = data.serviceProviderId || "";
|
|
@@ -43588,7 +43533,7 @@ var MManpowerDesignations = class {
|
|
|
43588
43533
|
import {
|
|
43589
43534
|
useAtlas as useAtlas102
|
|
43590
43535
|
} from "@7365admin1/node-server-utils";
|
|
43591
|
-
import { ObjectId as
|
|
43536
|
+
import { ObjectId as ObjectId118 } from "mongodb";
|
|
43592
43537
|
function useManpowerDesignationRepo() {
|
|
43593
43538
|
const db = useAtlas102.getDb();
|
|
43594
43539
|
if (!db) {
|
|
@@ -43600,11 +43545,11 @@ function useManpowerDesignationRepo() {
|
|
|
43600
43545
|
try {
|
|
43601
43546
|
value = new MManpowerDesignations(value);
|
|
43602
43547
|
if (value.createdBy)
|
|
43603
|
-
value.createdBy = new
|
|
43548
|
+
value.createdBy = new ObjectId118(value.createdBy);
|
|
43604
43549
|
if (value.siteId)
|
|
43605
|
-
value.siteId = new
|
|
43550
|
+
value.siteId = new ObjectId118(value.siteId);
|
|
43606
43551
|
if (value.serviceProviderId)
|
|
43607
|
-
value.serviceProviderId = new
|
|
43552
|
+
value.serviceProviderId = new ObjectId118(value.serviceProviderId);
|
|
43608
43553
|
const result = await collection.insertOne(value);
|
|
43609
43554
|
return result;
|
|
43610
43555
|
} catch (error) {
|
|
@@ -43613,8 +43558,8 @@ function useManpowerDesignationRepo() {
|
|
|
43613
43558
|
}
|
|
43614
43559
|
async function getManpowerDesignationsBySiteId(_id, serviceProviderId) {
|
|
43615
43560
|
try {
|
|
43616
|
-
_id = new
|
|
43617
|
-
serviceProviderId = new
|
|
43561
|
+
_id = new ObjectId118(_id);
|
|
43562
|
+
serviceProviderId = new ObjectId118(serviceProviderId);
|
|
43618
43563
|
} catch (error) {
|
|
43619
43564
|
throw new Error("Invalid Site ID format.");
|
|
43620
43565
|
}
|
|
@@ -43630,7 +43575,7 @@ function useManpowerDesignationRepo() {
|
|
|
43630
43575
|
}
|
|
43631
43576
|
async function updateManpowerDesignations(_id, value) {
|
|
43632
43577
|
try {
|
|
43633
|
-
_id = new
|
|
43578
|
+
_id = new ObjectId118(_id);
|
|
43634
43579
|
} catch (error) {
|
|
43635
43580
|
throw new Error("Invalid ID format.");
|
|
43636
43581
|
}
|
|
@@ -43733,7 +43678,7 @@ function useManpowerDesignationCtrl() {
|
|
|
43733
43678
|
|
|
43734
43679
|
// src/models/overnight-parking.model.ts
|
|
43735
43680
|
import Joi116 from "joi";
|
|
43736
|
-
import { ObjectId as
|
|
43681
|
+
import { ObjectId as ObjectId119 } from "mongodb";
|
|
43737
43682
|
var dayScheduleSchema = Joi116.object({
|
|
43738
43683
|
isEnabled: Joi116.boolean().required(),
|
|
43739
43684
|
startTime: Joi116.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().allow(null, "").messages({
|
|
@@ -43775,7 +43720,7 @@ function MOvernightParkingApprovalHours(value) {
|
|
|
43775
43720
|
}
|
|
43776
43721
|
if (value.site && typeof value.site === "string") {
|
|
43777
43722
|
try {
|
|
43778
|
-
value.site = new
|
|
43723
|
+
value.site = new ObjectId119(value.site);
|
|
43779
43724
|
} catch {
|
|
43780
43725
|
throw new Error("Invalid site ID.");
|
|
43781
43726
|
}
|
|
@@ -45399,7 +45344,7 @@ function useManpowerRemarkCtrl() {
|
|
|
45399
45344
|
|
|
45400
45345
|
// src/models/manpower-sites.model.ts
|
|
45401
45346
|
import Joi122 from "joi";
|
|
45402
|
-
import { ObjectId as
|
|
45347
|
+
import { ObjectId as ObjectId120 } from "mongodb";
|
|
45403
45348
|
var manpowerSitesSchema = Joi122.object({
|
|
45404
45349
|
id: Joi122.string().hex().required(),
|
|
45405
45350
|
text: Joi122.string().hex().optional().allow("", null),
|
|
@@ -45410,7 +45355,7 @@ var manpowerSitesSchema = Joi122.object({
|
|
|
45410
45355
|
});
|
|
45411
45356
|
var MManpowerSites = class {
|
|
45412
45357
|
constructor(data) {
|
|
45413
|
-
this._id = new
|
|
45358
|
+
this._id = new ObjectId120();
|
|
45414
45359
|
this.id = data.id || "";
|
|
45415
45360
|
this.text = data.text || "";
|
|
45416
45361
|
this.contractID = data.contractID || "";
|
|
@@ -45632,7 +45577,7 @@ import {
|
|
|
45632
45577
|
getDirectory as getDirectory3,
|
|
45633
45578
|
logger as logger174
|
|
45634
45579
|
} from "@7365admin1/node-server-utils";
|
|
45635
|
-
import { ObjectId as
|
|
45580
|
+
import { ObjectId as ObjectId121 } from "mongodb";
|
|
45636
45581
|
import moment4 from "moment-timezone";
|
|
45637
45582
|
var createManpowerRemarksDaily = async () => {
|
|
45638
45583
|
const db = useAtlas108.getDb();
|
|
@@ -45792,7 +45737,7 @@ var updateRemarksisAcknowledged = async () => {
|
|
|
45792
45737
|
for (const id of updatedIds) {
|
|
45793
45738
|
const doc = await remarks.findOne({ _id: id });
|
|
45794
45739
|
const setting = await settings.findOne(
|
|
45795
|
-
{ siteId: new
|
|
45740
|
+
{ siteId: new ObjectId121(doc?.siteId) },
|
|
45796
45741
|
{ projection: { emails: 1 } }
|
|
45797
45742
|
);
|
|
45798
45743
|
const payload = {
|
|
@@ -45878,7 +45823,7 @@ var updateRemarksStatusEod = async () => {
|
|
|
45878
45823
|
for (const doc of docs) {
|
|
45879
45824
|
let shiftsToCheck = [];
|
|
45880
45825
|
const endShiftTime = await settings.findOne(
|
|
45881
|
-
{ siteId: new
|
|
45826
|
+
{ siteId: new ObjectId121(doc.siteId) },
|
|
45882
45827
|
{ projection: { shifts: 1, shiftType: 1 } }
|
|
45883
45828
|
);
|
|
45884
45829
|
if (doc.createdAtSGT === nowSGT) {
|
|
@@ -45984,7 +45929,7 @@ var isWithinHour = (alertTime, timeNow) => {
|
|
|
45984
45929
|
|
|
45985
45930
|
// src/events/manpower.event.ts
|
|
45986
45931
|
import { useAtlas as useAtlas109 } from "@7365admin1/node-server-utils";
|
|
45987
|
-
import { ObjectId as
|
|
45932
|
+
import { ObjectId as ObjectId122 } from "mongodb";
|
|
45988
45933
|
import moment5 from "moment-timezone";
|
|
45989
45934
|
async function manpowerEvents(io) {
|
|
45990
45935
|
let intervalId = null;
|
|
@@ -46010,7 +45955,7 @@ async function manpowerEvents(io) {
|
|
|
46010
45955
|
}).toArray();
|
|
46011
45956
|
for (const doc of docs) {
|
|
46012
45957
|
const siteSettings = await settings.findOne(
|
|
46013
|
-
{ siteId: new
|
|
45958
|
+
{ siteId: new ObjectId122(doc.siteId), enabled: true },
|
|
46014
45959
|
{ projection: { shifts: 1, shiftType: 1 } }
|
|
46015
45960
|
);
|
|
46016
45961
|
const shiftType = siteSettings?.shiftType || "2-shifts";
|
|
@@ -46129,7 +46074,7 @@ function genericSignature(params, secretKey) {
|
|
|
46129
46074
|
}
|
|
46130
46075
|
|
|
46131
46076
|
// src/repositories/reddot-payment.repository.ts
|
|
46132
|
-
import { ObjectId as
|
|
46077
|
+
import { ObjectId as ObjectId126 } from "mongodb";
|
|
46133
46078
|
|
|
46134
46079
|
// src/utils/date-format.util.ts
|
|
46135
46080
|
import moment6 from "moment-timezone";
|
|
@@ -46154,11 +46099,11 @@ function formatDateString(today, format, dateRange) {
|
|
|
46154
46099
|
}
|
|
46155
46100
|
|
|
46156
46101
|
// src/models/credit-card.model.ts
|
|
46157
|
-
import { ObjectId as
|
|
46102
|
+
import { ObjectId as ObjectId123 } from "mongodb";
|
|
46158
46103
|
var MCardInfo = class {
|
|
46159
46104
|
// this is coming from RDP transaction
|
|
46160
46105
|
constructor({
|
|
46161
|
-
_id = new
|
|
46106
|
+
_id = new ObjectId123(),
|
|
46162
46107
|
userId,
|
|
46163
46108
|
cardType,
|
|
46164
46109
|
cardNumber,
|
|
@@ -46193,11 +46138,11 @@ var MCardInfo = class {
|
|
|
46193
46138
|
};
|
|
46194
46139
|
|
|
46195
46140
|
// src/models/cart.model.ts
|
|
46196
|
-
import { ObjectId as
|
|
46141
|
+
import { ObjectId as ObjectId124 } from "mongodb";
|
|
46197
46142
|
var MUnitBillings = class {
|
|
46198
46143
|
// transaction response messages
|
|
46199
46144
|
constructor({
|
|
46200
|
-
_id = new
|
|
46145
|
+
_id = new ObjectId124(),
|
|
46201
46146
|
unit,
|
|
46202
46147
|
unitId,
|
|
46203
46148
|
unitBill,
|
|
@@ -46238,7 +46183,7 @@ var MUnitBillings = class {
|
|
|
46238
46183
|
};
|
|
46239
46184
|
|
|
46240
46185
|
// src/repositories/payment.repository.ts
|
|
46241
|
-
import { ObjectId as
|
|
46186
|
+
import { ObjectId as ObjectId125 } from "mongodb";
|
|
46242
46187
|
import {
|
|
46243
46188
|
InternalServerError as InternalServerError66,
|
|
46244
46189
|
useAtlas as useAtlas110
|
|
@@ -46275,7 +46220,7 @@ var PaymentBillRepo = () => {
|
|
|
46275
46220
|
if (unitBillInfo?.status === "Inactive" /* inactive */) {
|
|
46276
46221
|
throw new Error("This Bill is Inactive!");
|
|
46277
46222
|
}
|
|
46278
|
-
const billId = new
|
|
46223
|
+
const billId = new ObjectId125(unitBillInfo?.billId);
|
|
46279
46224
|
const billInfo = await billCollection().findOne({ _id: billId });
|
|
46280
46225
|
if (!billInfo) {
|
|
46281
46226
|
throw new Error("Bill info not found");
|
|
@@ -46314,13 +46259,13 @@ var PaymentBillRepo = () => {
|
|
|
46314
46259
|
const saveCreditCardInfo = async (payload) => {
|
|
46315
46260
|
try {
|
|
46316
46261
|
if (payload.userId)
|
|
46317
|
-
payload.userId = new
|
|
46262
|
+
payload.userId = new ObjectId125(payload.userId);
|
|
46318
46263
|
if (payload.site)
|
|
46319
|
-
payload.site = new
|
|
46264
|
+
payload.site = new ObjectId125(payload.site);
|
|
46320
46265
|
if (payload.organization)
|
|
46321
|
-
payload.organization = new
|
|
46266
|
+
payload.organization = new ObjectId125(payload.organization);
|
|
46322
46267
|
if (payload.createdBy)
|
|
46323
|
-
payload.createdBy = new
|
|
46268
|
+
payload.createdBy = new ObjectId125(payload.createdBy);
|
|
46324
46269
|
const createdAt = formatDateString(/* @__PURE__ */ new Date(), "mm-dd-yyyy");
|
|
46325
46270
|
payload.createdAt = createdAt;
|
|
46326
46271
|
const result = await creditCollection().insertOne(new MCardInfo(payload));
|
|
@@ -46332,19 +46277,19 @@ var PaymentBillRepo = () => {
|
|
|
46332
46277
|
const checkOutUnitBills = async (payload) => {
|
|
46333
46278
|
try {
|
|
46334
46279
|
if (payload.unitId)
|
|
46335
|
-
payload.unitId = new
|
|
46280
|
+
payload.unitId = new ObjectId125(payload.unitId);
|
|
46336
46281
|
if (payload.site)
|
|
46337
|
-
payload.site = new
|
|
46282
|
+
payload.site = new ObjectId125(payload.site);
|
|
46338
46283
|
if (payload.organization)
|
|
46339
|
-
payload.organization = new
|
|
46284
|
+
payload.organization = new ObjectId125(payload.organization);
|
|
46340
46285
|
payload.createdAt = await formatDateString(/* @__PURE__ */ new Date(), "mm-dd-yyyy");
|
|
46341
46286
|
const addToCart = await cartCollection().insertOne(new MUnitBillings(payload));
|
|
46342
46287
|
const unitId = payload.unitId;
|
|
46343
46288
|
const dateFormatted = formatDateString(/* @__PURE__ */ new Date(), "for-ref");
|
|
46344
46289
|
const unit = unitId?.toString().slice(-4);
|
|
46345
|
-
const newId = new
|
|
46290
|
+
const newId = new ObjectId125(addToCart?.insertedId).toString().slice(-4);
|
|
46346
46291
|
const referenceNumber = `CRT${unit}${newId}${dateFormatted}`;
|
|
46347
|
-
const result = await cartCollection().findOneAndUpdate({ _id: new
|
|
46292
|
+
const result = await cartCollection().findOneAndUpdate({ _id: new ObjectId125(addToCart.insertedId) }, { $set: { referenceNumber } }, { returnDocument: "after" });
|
|
46348
46293
|
return result;
|
|
46349
46294
|
} catch (error) {
|
|
46350
46295
|
throw new Error(error.message || error || "Server Internal Error");
|
|
@@ -46375,7 +46320,7 @@ var PaymentBillRepo = () => {
|
|
|
46375
46320
|
for (const ref of refNumber) {
|
|
46376
46321
|
const unitBillInfo = await collection().findOne({ referenceNumber: ref });
|
|
46377
46322
|
const billId = unitBillInfo?.billId;
|
|
46378
|
-
const billInfo = await billCollection().findOne({ _id: new
|
|
46323
|
+
const billInfo = await billCollection().findOne({ _id: new ObjectId125(billId) });
|
|
46379
46324
|
const billAmount = billInfo?.price;
|
|
46380
46325
|
payload.updatedAt = updatedAt;
|
|
46381
46326
|
payload.amountPaid = billAmount;
|
|
@@ -46529,7 +46474,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
46529
46474
|
throw new Error("Failed to Add Merchant Details");
|
|
46530
46475
|
}
|
|
46531
46476
|
const merchantId = merchant?.insertedId;
|
|
46532
|
-
const orgId = new
|
|
46477
|
+
const orgId = new ObjectId126(_id);
|
|
46533
46478
|
const result = await orgCollection().findOneAndUpdate({ _id: orgId }, { $push: { merchant: merchantId } }, {
|
|
46534
46479
|
returnDocument: "after"
|
|
46535
46480
|
});
|
|
@@ -46558,7 +46503,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
46558
46503
|
const getMerchantDetailsById = async (_id) => {
|
|
46559
46504
|
try {
|
|
46560
46505
|
if (_id)
|
|
46561
|
-
_id = new
|
|
46506
|
+
_id = new ObjectId126(_id);
|
|
46562
46507
|
const result = await redDotMerchantCollection().aggregate([
|
|
46563
46508
|
{
|
|
46564
46509
|
$match: {
|
|
@@ -46821,7 +46766,7 @@ import {
|
|
|
46821
46766
|
useAtlas as useAtlas112,
|
|
46822
46767
|
useCache as useCache66
|
|
46823
46768
|
} from "@7365admin1/node-server-utils";
|
|
46824
|
-
import { ObjectId as
|
|
46769
|
+
import { ObjectId as ObjectId127 } from "mongodb";
|
|
46825
46770
|
function useVerificationRepoV2() {
|
|
46826
46771
|
const db = useAtlas112.getDb();
|
|
46827
46772
|
if (!db) {
|
|
@@ -46874,7 +46819,7 @@ function useVerificationRepoV2() {
|
|
|
46874
46819
|
}
|
|
46875
46820
|
async function updateVerificationStatusById(_id, status, session) {
|
|
46876
46821
|
try {
|
|
46877
|
-
_id = new
|
|
46822
|
+
_id = new ObjectId127(_id);
|
|
46878
46823
|
} catch (error) {
|
|
46879
46824
|
throw new BadRequestError195("Invalid verification ID format.");
|
|
46880
46825
|
}
|
|
@@ -47442,7 +47387,7 @@ import {
|
|
|
47442
47387
|
import { v4 as uuidv42 } from "uuid";
|
|
47443
47388
|
|
|
47444
47389
|
// src/repositories/user-v2.repo.ts
|
|
47445
|
-
import { ObjectId as
|
|
47390
|
+
import { ObjectId as ObjectId128 } from "mongodb";
|
|
47446
47391
|
import {
|
|
47447
47392
|
useAtlas as useAtlas114,
|
|
47448
47393
|
InternalServerError as InternalServerError70,
|
|
@@ -47654,7 +47599,7 @@ function useUserRepoV2() {
|
|
|
47654
47599
|
}
|
|
47655
47600
|
if (organization) {
|
|
47656
47601
|
try {
|
|
47657
|
-
query.defaultOrg = new
|
|
47602
|
+
query.defaultOrg = new ObjectId128(organization);
|
|
47658
47603
|
cacheOptions.organization = organization.toString();
|
|
47659
47604
|
} catch (error) {
|
|
47660
47605
|
throw new BadRequestError198("Invalid organization ID format.");
|
|
@@ -47793,13 +47738,13 @@ function useUserRepoV2() {
|
|
|
47793
47738
|
);
|
|
47794
47739
|
}
|
|
47795
47740
|
try {
|
|
47796
|
-
_id = new
|
|
47741
|
+
_id = new ObjectId128(_id);
|
|
47797
47742
|
} catch (error) {
|
|
47798
47743
|
throw new BadRequestError198("Invalid ID.");
|
|
47799
47744
|
}
|
|
47800
47745
|
if (field === "defaultOrg") {
|
|
47801
47746
|
try {
|
|
47802
|
-
value = new
|
|
47747
|
+
value = new ObjectId128(value);
|
|
47803
47748
|
} catch (error) {
|
|
47804
47749
|
throw new BadRequestError198("Invalid organization ID.");
|
|
47805
47750
|
}
|
|
@@ -47840,7 +47785,7 @@ function useUserRepoV2() {
|
|
|
47840
47785
|
year
|
|
47841
47786
|
}, session) {
|
|
47842
47787
|
try {
|
|
47843
|
-
_id = new
|
|
47788
|
+
_id = new ObjectId128(_id);
|
|
47844
47789
|
} catch (error) {
|
|
47845
47790
|
throw new BadRequestError198("Invalid user ID format.");
|
|
47846
47791
|
}
|
|
@@ -47870,7 +47815,7 @@ function useUserRepoV2() {
|
|
|
47870
47815
|
}
|
|
47871
47816
|
async function updatePassword({ _id, password }, session) {
|
|
47872
47817
|
try {
|
|
47873
|
-
_id = new
|
|
47818
|
+
_id = new ObjectId128(_id);
|
|
47874
47819
|
} catch (error) {
|
|
47875
47820
|
throw new BadRequestError198("Invalid user ID format.");
|
|
47876
47821
|
}
|