@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.js
CHANGED
|
@@ -13314,7 +13314,7 @@ var schemaVisitorTransaction = import_joi36.default.object({
|
|
|
13314
13314
|
arrivalTime: import_joi36.default.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().allow(null, "").messages({
|
|
13315
13315
|
"string.pattern.base": "arrivalTime must be in HH:mm format (e.g. 09:30, 18:45)"
|
|
13316
13316
|
}),
|
|
13317
|
-
duration: import_joi36.default.number().integer().optional().allow(null),
|
|
13317
|
+
duration: import_joi36.default.number().integer().optional().allow(null, ""),
|
|
13318
13318
|
isOvernightParking: import_joi36.default.boolean().optional().default(false),
|
|
13319
13319
|
email: import_joi36.default.string().email().optional().allow(null, ""),
|
|
13320
13320
|
numberOfPassengers: import_joi36.default.number().integer().optional().allow(null, ""),
|
|
@@ -13331,7 +13331,8 @@ var schemaVisitorTransaction = import_joi36.default.object({
|
|
|
13331
13331
|
checkInRemarks: import_joi36.default.string().optional().allow("", null),
|
|
13332
13332
|
checkOutRemarks: import_joi36.default.string().optional().allow("", null),
|
|
13333
13333
|
expectedCheckIn: import_joi36.default.string().isoDate().optional(),
|
|
13334
|
-
purpose: import_joi36.default.string().optional().allow(null, "")
|
|
13334
|
+
purpose: import_joi36.default.string().optional().allow(null, ""),
|
|
13335
|
+
invitedId: import_joi36.default.any().optional().allow(null, "")
|
|
13335
13336
|
});
|
|
13336
13337
|
var schemaUpdateVisTrans = import_joi36.default.object({
|
|
13337
13338
|
_id: import_joi36.default.string().hex().length(24).required(),
|
|
@@ -13475,7 +13476,17 @@ function MVisitorTransaction(value) {
|
|
|
13475
13476
|
expiredAt: value.expiredAt ?? null,
|
|
13476
13477
|
createdAt: value.createdAt ?? newDate,
|
|
13477
13478
|
updatedAt: value.updatedAt ?? "",
|
|
13478
|
-
deletedAt: value.deletedAt ?? ""
|
|
13479
|
+
deletedAt: value.deletedAt ?? "",
|
|
13480
|
+
purpose: value.purpose,
|
|
13481
|
+
numberOfPassengers: value.numberOfPassengers ?? null,
|
|
13482
|
+
email: value.email,
|
|
13483
|
+
isOvernightParking: value.isOvernightParking ?? false,
|
|
13484
|
+
invitedId: new import_mongodb39.ObjectId(String(value.invitedId)) ?? null,
|
|
13485
|
+
overnightParking: value.isOvernightParking == true ? {
|
|
13486
|
+
status: "pending approval",
|
|
13487
|
+
remarks: "",
|
|
13488
|
+
updatedBy: new import_mongodb39.ObjectId(String(value.invitedId)) ?? null
|
|
13489
|
+
} : null
|
|
13479
13490
|
};
|
|
13480
13491
|
}
|
|
13481
13492
|
|
|
@@ -13607,16 +13618,40 @@ function useVisitorTransactionRepo() {
|
|
|
13607
13618
|
localField: "visitorPass.keyId",
|
|
13608
13619
|
foreignField: "_id",
|
|
13609
13620
|
pipeline: [
|
|
13621
|
+
{
|
|
13622
|
+
$lookup: {
|
|
13623
|
+
from: "qr-code-templates",
|
|
13624
|
+
localField: "template",
|
|
13625
|
+
foreignField: "_id",
|
|
13626
|
+
pipeline: [
|
|
13627
|
+
{
|
|
13628
|
+
$project: {
|
|
13629
|
+
_id: 1,
|
|
13630
|
+
prefixPass: 1,
|
|
13631
|
+
name: 1
|
|
13632
|
+
}
|
|
13633
|
+
}
|
|
13634
|
+
],
|
|
13635
|
+
as: "template"
|
|
13636
|
+
}
|
|
13637
|
+
},
|
|
13610
13638
|
{
|
|
13611
13639
|
$project: {
|
|
13612
13640
|
_id: 0,
|
|
13613
|
-
// remove original _id
|
|
13614
13641
|
keyId: "$_id",
|
|
13615
13642
|
status: 1,
|
|
13616
13643
|
description: 1,
|
|
13644
|
+
templatePrefixPass: {
|
|
13645
|
+
$arrayElemAt: ["$template.prefixPass", 0]
|
|
13646
|
+
},
|
|
13617
13647
|
prefixAndName: {
|
|
13618
13648
|
$concat: [
|
|
13619
|
-
{
|
|
13649
|
+
{
|
|
13650
|
+
$ifNull: [
|
|
13651
|
+
{ $arrayElemAt: ["$template.prefixPass", 0] },
|
|
13652
|
+
""
|
|
13653
|
+
]
|
|
13654
|
+
},
|
|
13620
13655
|
{ $ifNull: ["$name", ""] }
|
|
13621
13656
|
]
|
|
13622
13657
|
}
|
|
@@ -13629,145 +13664,50 @@ function useVisitorTransactionRepo() {
|
|
|
13629
13664
|
{
|
|
13630
13665
|
$lookup: {
|
|
13631
13666
|
from: "keys",
|
|
13632
|
-
localField: "
|
|
13667
|
+
localField: "passKeys.keyId",
|
|
13633
13668
|
foreignField: "_id",
|
|
13634
13669
|
pipeline: [
|
|
13635
13670
|
{
|
|
13636
|
-
$
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
as: "visitorPassDetails"
|
|
13647
|
-
}
|
|
13648
|
-
},
|
|
13649
|
-
{
|
|
13650
|
-
$addFields: {
|
|
13651
|
-
visitorPass: {
|
|
13652
|
-
$map: {
|
|
13653
|
-
input: "$visitorPass",
|
|
13654
|
-
as: "vp",
|
|
13655
|
-
in: {
|
|
13656
|
-
$let: {
|
|
13657
|
-
vars: {
|
|
13658
|
-
matchedKey: {
|
|
13659
|
-
$arrayElemAt: [
|
|
13660
|
-
{
|
|
13661
|
-
$filter: {
|
|
13662
|
-
input: "$visitorPassDetails",
|
|
13663
|
-
as: "kd",
|
|
13664
|
-
cond: { $eq: ["$$kd._id", "$$vp.keyId"] }
|
|
13665
|
-
}
|
|
13666
|
-
},
|
|
13667
|
-
0
|
|
13668
|
-
]
|
|
13669
|
-
}
|
|
13670
|
-
},
|
|
13671
|
-
in: {
|
|
13672
|
-
keyId: "$$vp.keyId",
|
|
13673
|
-
receivedDate: "$$vp.receivedDate",
|
|
13674
|
-
status: "$$vp.status",
|
|
13675
|
-
lastUpdate: {
|
|
13676
|
-
$max: [
|
|
13677
|
-
"$$matchedKey.createdAt",
|
|
13678
|
-
"$$matchedKey.updatedAt"
|
|
13679
|
-
]
|
|
13680
|
-
},
|
|
13681
|
-
remarks: "$$vp.remarks",
|
|
13682
|
-
description: "$$matchedKey.description",
|
|
13683
|
-
prefixAndName: {
|
|
13684
|
-
$concat: [
|
|
13685
|
-
{ $ifNull: ["$$matchedKey.prefix", ""] },
|
|
13686
|
-
{ $ifNull: ["$$matchedKey.name", ""] }
|
|
13687
|
-
]
|
|
13671
|
+
$lookup: {
|
|
13672
|
+
from: "qr-code-templates",
|
|
13673
|
+
localField: "template",
|
|
13674
|
+
foreignField: "_id",
|
|
13675
|
+
pipeline: [
|
|
13676
|
+
{
|
|
13677
|
+
$project: {
|
|
13678
|
+
_id: 1,
|
|
13679
|
+
prefixPass: 1,
|
|
13680
|
+
name: 1
|
|
13688
13681
|
}
|
|
13689
13682
|
}
|
|
13690
|
-
|
|
13683
|
+
],
|
|
13684
|
+
as: "template"
|
|
13691
13685
|
}
|
|
13692
|
-
}
|
|
13693
|
-
}
|
|
13694
|
-
}
|
|
13695
|
-
},
|
|
13696
|
-
{
|
|
13697
|
-
$project: {
|
|
13698
|
-
visitorPassDetails: 0
|
|
13699
|
-
}
|
|
13700
|
-
},
|
|
13701
|
-
{
|
|
13702
|
-
$lookup: {
|
|
13703
|
-
from: "keys",
|
|
13704
|
-
localField: "passKeys.keyId",
|
|
13705
|
-
foreignField: "_id",
|
|
13706
|
-
pipeline: [
|
|
13686
|
+
},
|
|
13707
13687
|
{
|
|
13708
13688
|
$project: {
|
|
13709
|
-
_id:
|
|
13710
|
-
|
|
13711
|
-
|
|
13689
|
+
_id: 0,
|
|
13690
|
+
keyId: "$_id",
|
|
13691
|
+
status: 1,
|
|
13712
13692
|
description: 1,
|
|
13713
|
-
|
|
13714
|
-
|
|
13715
|
-
|
|
13716
|
-
|
|
13717
|
-
|
|
13718
|
-
|
|
13719
|
-
|
|
13720
|
-
|
|
13721
|
-
|
|
13722
|
-
$addFields: {
|
|
13723
|
-
passKeys: {
|
|
13724
|
-
$map: {
|
|
13725
|
-
input: "$passKeys",
|
|
13726
|
-
as: "pk",
|
|
13727
|
-
in: {
|
|
13728
|
-
$let: {
|
|
13729
|
-
vars: {
|
|
13730
|
-
matchedKey: {
|
|
13731
|
-
$arrayElemAt: [
|
|
13732
|
-
{
|
|
13733
|
-
$filter: {
|
|
13734
|
-
input: "$passKeysDetails",
|
|
13735
|
-
as: "kd",
|
|
13736
|
-
cond: { $eq: ["$$kd._id", "$$pk.keyId"] }
|
|
13737
|
-
}
|
|
13738
|
-
},
|
|
13739
|
-
0
|
|
13740
|
-
]
|
|
13741
|
-
}
|
|
13742
|
-
},
|
|
13743
|
-
in: {
|
|
13744
|
-
keyId: "$$pk.keyId",
|
|
13745
|
-
receivedDate: "$$pk.receivedDate",
|
|
13746
|
-
status: "$$pk.status",
|
|
13747
|
-
lastUpdate: {
|
|
13748
|
-
$max: [
|
|
13749
|
-
"$$matchedKey.createdAt",
|
|
13750
|
-
"$$matchedKey.updatedAt"
|
|
13693
|
+
templatePrefixPass: {
|
|
13694
|
+
$arrayElemAt: ["$template.prefixPass", 0]
|
|
13695
|
+
},
|
|
13696
|
+
prefixAndName: {
|
|
13697
|
+
$concat: [
|
|
13698
|
+
{
|
|
13699
|
+
$ifNull: [
|
|
13700
|
+
{ $arrayElemAt: ["$template.prefixPass", 0] },
|
|
13701
|
+
""
|
|
13751
13702
|
]
|
|
13752
13703
|
},
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
prefixAndName: {
|
|
13756
|
-
$concat: [
|
|
13757
|
-
{ $ifNull: ["$$matchedKey.prefix", ""] },
|
|
13758
|
-
{ $ifNull: ["$$matchedKey.name", ""] }
|
|
13759
|
-
]
|
|
13760
|
-
}
|
|
13761
|
-
}
|
|
13704
|
+
{ $ifNull: ["$name", ""] }
|
|
13705
|
+
]
|
|
13762
13706
|
}
|
|
13763
13707
|
}
|
|
13764
13708
|
}
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
},
|
|
13768
|
-
{
|
|
13769
|
-
$project: {
|
|
13770
|
-
passKeysDetails: 0
|
|
13709
|
+
],
|
|
13710
|
+
as: "passKeys"
|
|
13771
13711
|
}
|
|
13772
13712
|
},
|
|
13773
13713
|
{ $sort: sort },
|
|
@@ -21776,6 +21716,7 @@ function useVisitorTransactionService() {
|
|
|
21776
21716
|
getExpiredCheckedOutTransactionsBySite: _getExpiredCheckedOutTransactionsBySite,
|
|
21777
21717
|
updateManyDahuaSyncStatus: _updateManyDahuaSyncStatus
|
|
21778
21718
|
} = useVisitorTransactionRepo();
|
|
21719
|
+
const { getById } = useBuildingUnitRepo();
|
|
21779
21720
|
const {
|
|
21780
21721
|
add: _addPerson,
|
|
21781
21722
|
getByNRIC,
|
|
@@ -22174,6 +22115,7 @@ function useVisitorTransactionService() {
|
|
|
22174
22115
|
try {
|
|
22175
22116
|
session.startTransaction();
|
|
22176
22117
|
const inviter = await _getByUserId(userId);
|
|
22118
|
+
const unit = await getById(inviter?.unit);
|
|
22177
22119
|
value.checkIn = null;
|
|
22178
22120
|
const dir = __dirname;
|
|
22179
22121
|
const filePath = (0, import_node_server_utils101.getDirectory)(dir, "./public/handlebars/visitor-invite");
|
|
@@ -22182,9 +22124,11 @@ function useVisitorTransactionService() {
|
|
|
22182
22124
|
block: inviter?.block,
|
|
22183
22125
|
level: inviter?.level,
|
|
22184
22126
|
unit: inviter?.unit,
|
|
22127
|
+
unitName: unit?.name,
|
|
22185
22128
|
org: inviter?.org.toString(),
|
|
22186
22129
|
site: inviter?.site.toString(),
|
|
22187
|
-
status: "pending" /* PENDING
|
|
22130
|
+
status: "pending" /* PENDING */,
|
|
22131
|
+
invitedId: inviter?._id
|
|
22188
22132
|
};
|
|
22189
22133
|
const result = await _add(payload);
|
|
22190
22134
|
const emailContent = (0, import_node_server_utils101.compileHandlebar)({
|
|
@@ -22407,7 +22351,7 @@ function useVisitorTransactionController() {
|
|
|
22407
22351
|
arrivalTime: import_joi55.default.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().allow(null, "").messages({
|
|
22408
22352
|
"string.pattern.base": "arrivalTime must be in HH:mm format (e.g. 09:30, 18:45)"
|
|
22409
22353
|
}),
|
|
22410
|
-
duration: import_joi55.default.number().integer().optional().allow(null),
|
|
22354
|
+
duration: import_joi55.default.number().integer().optional().allow(null, ""),
|
|
22411
22355
|
name: import_joi55.default.string().required(),
|
|
22412
22356
|
contact: import_joi55.default.string().required(),
|
|
22413
22357
|
email: import_joi55.default.string().email().required(),
|
|
@@ -22430,8 +22374,8 @@ function useVisitorTransactionController() {
|
|
|
22430
22374
|
const { expectedCheckIn, arrivalTime, duration, name, contact, email, plateNumber, isOvernightParking, numberOfPassengers, purpose, inviterUserId } = value;
|
|
22431
22375
|
const rest = { expectedCheckIn, arrivalTime, duration, name, contact, email, plateNumber, isOvernightParking, numberOfPassengers, purpose };
|
|
22432
22376
|
try {
|
|
22433
|
-
await _inviteVisitor(rest, inviterUserId);
|
|
22434
|
-
res.status(200).json({
|
|
22377
|
+
const result = await _inviteVisitor(rest, inviterUserId);
|
|
22378
|
+
res.status(200).json({ insertedId: result });
|
|
22435
22379
|
return;
|
|
22436
22380
|
} catch (error2) {
|
|
22437
22381
|
import_node_server_utils102.logger.log({ level: "error", message: error2.message });
|
|
@@ -39920,6 +39864,7 @@ function useNfcPatrolSettingsController() {
|
|
|
39920
39864
|
|
|
39921
39865
|
// src/services/occurrence-entry.service.ts
|
|
39922
39866
|
var import_node_server_utils184 = require("@7365admin1/node-server-utils");
|
|
39867
|
+
var import_mongodb108 = require("mongodb");
|
|
39923
39868
|
|
|
39924
39869
|
// src/repositories/occurrence-subject.repo.ts
|
|
39925
39870
|
var import_node_server_utils183 = require("@7365admin1/node-server-utils");
|
|
@@ -40128,22 +40073,11 @@ function useOccurrenceSubjectRepo() {
|
|
|
40128
40073
|
} catch (error) {
|
|
40129
40074
|
throw new import_node_server_utils183.BadRequestError("Invalid occurrence subject ID format.");
|
|
40130
40075
|
}
|
|
40131
|
-
const cacheKey = (0, import_node_server_utils183.makeCacheKey)(namespace_collection, { _id });
|
|
40132
|
-
const cachedData = await getCache(cacheKey);
|
|
40133
|
-
if (cachedData) {
|
|
40134
|
-
import_node_server_utils183.logger.info(`Cache hit for key: ${cacheKey}`);
|
|
40135
|
-
return cachedData;
|
|
40136
|
-
}
|
|
40137
40076
|
try {
|
|
40138
40077
|
const data = await collection.findOne({ _id }, { session });
|
|
40139
40078
|
if (!data) {
|
|
40140
40079
|
throw new import_node_server_utils183.NotFoundError("Occurrence subject not found.");
|
|
40141
40080
|
}
|
|
40142
|
-
setCache(cacheKey, data, 15 * 60).then(() => {
|
|
40143
|
-
import_node_server_utils183.logger.info(`Cache set for key: ${cacheKey}`);
|
|
40144
|
-
}).catch((err) => {
|
|
40145
|
-
import_node_server_utils183.logger.error(`Failed to set cache for key: ${cacheKey}`, err);
|
|
40146
|
-
});
|
|
40147
40081
|
return data;
|
|
40148
40082
|
} catch (error) {
|
|
40149
40083
|
throw error;
|
|
@@ -40284,11 +40218,22 @@ function useOccurrenceEntryService() {
|
|
|
40284
40218
|
const updatedSerialNumber = (entrySerialNumber + 0.1).toFixed(1);
|
|
40285
40219
|
const dobId = occurrenceEntry.dailyOccurrenceBookId;
|
|
40286
40220
|
const book = await _getOccurrenceBookById(dobId);
|
|
40287
|
-
const subject = await _getOccurrenceSubjectById(
|
|
40221
|
+
const subject = await _getOccurrenceSubjectById(
|
|
40222
|
+
occurrenceEntry.subject._id
|
|
40223
|
+
);
|
|
40224
|
+
value.subject = value.subject ? value.subject : occurrenceEntry.subject._id;
|
|
40225
|
+
value.subjectName = subject.subject;
|
|
40288
40226
|
value.serialNumber = updatedSerialNumber;
|
|
40289
40227
|
value.site = occurrenceEntry.site;
|
|
40290
40228
|
value.dailyOccurrenceBookId = occurrenceEntry.dailyOccurrenceBookId;
|
|
40291
|
-
value.
|
|
40229
|
+
value.bookEntryCount = value.bookEntryCount ? value.bookEntryCount : occurrenceEntry.bookEntryCount;
|
|
40230
|
+
value.occurrence = value.occurrence ? value.occurrence : occurrenceEntry.occurrence;
|
|
40231
|
+
value.signature = value.signature ? new import_mongodb108.ObjectId(value.signature) : occurrenceEntry.signature._id;
|
|
40232
|
+
value.eSignature = value.eSignature ? new import_mongodb108.ObjectId(value.eSignature) : occurrenceEntry.eSignature;
|
|
40233
|
+
value.createdAt = /* @__PURE__ */ new Date();
|
|
40234
|
+
value.date = /* @__PURE__ */ new Date();
|
|
40235
|
+
value.userName = value.userName ? value.userName : occurrenceEntry.signature.name;
|
|
40236
|
+
value.createdByName = value.createdByName ? value.createdByName : occurrenceEntry.createdByName;
|
|
40292
40237
|
await _updateOccurrenceBookById(dobId, {
|
|
40293
40238
|
totalInput: book.totalInput + 1
|
|
40294
40239
|
});
|
|
@@ -40484,7 +40429,7 @@ function useOccurrenceEntryController() {
|
|
|
40484
40429
|
|
|
40485
40430
|
// src/models/online-form.model.ts
|
|
40486
40431
|
var import_joi105 = __toESM(require("joi"));
|
|
40487
|
-
var
|
|
40432
|
+
var import_mongodb109 = require("mongodb");
|
|
40488
40433
|
var schemaOnlineForm = import_joi105.default.object({
|
|
40489
40434
|
_id: import_joi105.default.string().hex().optional().allow("", null),
|
|
40490
40435
|
name: import_joi105.default.string().required(),
|
|
@@ -40532,21 +40477,21 @@ function MOnlineForm(value) {
|
|
|
40532
40477
|
}
|
|
40533
40478
|
if (value._id && typeof value._id === "string") {
|
|
40534
40479
|
try {
|
|
40535
|
-
value._id = new
|
|
40480
|
+
value._id = new import_mongodb109.ObjectId(value._id);
|
|
40536
40481
|
} catch (error2) {
|
|
40537
40482
|
throw new Error("Invalid ID.");
|
|
40538
40483
|
}
|
|
40539
40484
|
}
|
|
40540
40485
|
if (value.org && typeof value.org === "string") {
|
|
40541
40486
|
try {
|
|
40542
|
-
value.org = new
|
|
40487
|
+
value.org = new import_mongodb109.ObjectId(value.org);
|
|
40543
40488
|
} catch (error2) {
|
|
40544
40489
|
throw new Error("Invalid org ID.");
|
|
40545
40490
|
}
|
|
40546
40491
|
}
|
|
40547
40492
|
if (value.site && typeof value.site === "string") {
|
|
40548
40493
|
try {
|
|
40549
|
-
value.site = new
|
|
40494
|
+
value.site = new import_mongodb109.ObjectId(value.site);
|
|
40550
40495
|
} catch (error2) {
|
|
40551
40496
|
throw new Error("Invalid site ID.");
|
|
40552
40497
|
}
|
|
@@ -40569,7 +40514,7 @@ function MOnlineForm(value) {
|
|
|
40569
40514
|
|
|
40570
40515
|
// src/repositories/online-form.repo.ts
|
|
40571
40516
|
var import_node_server_utils186 = require("@7365admin1/node-server-utils");
|
|
40572
|
-
var
|
|
40517
|
+
var import_mongodb110 = require("mongodb");
|
|
40573
40518
|
function useOnlineFormRepo() {
|
|
40574
40519
|
const db = import_node_server_utils186.useAtlas.getDb();
|
|
40575
40520
|
if (!db) {
|
|
@@ -40621,7 +40566,7 @@ function useOnlineFormRepo() {
|
|
|
40621
40566
|
}) {
|
|
40622
40567
|
page = page > 0 ? page - 1 : 0;
|
|
40623
40568
|
try {
|
|
40624
|
-
site = new
|
|
40569
|
+
site = new import_mongodb110.ObjectId(site);
|
|
40625
40570
|
} catch (error) {
|
|
40626
40571
|
throw new import_node_server_utils186.BadRequestError("Invalid site ID format.");
|
|
40627
40572
|
}
|
|
@@ -40681,7 +40626,7 @@ function useOnlineFormRepo() {
|
|
|
40681
40626
|
}
|
|
40682
40627
|
async function getOnlineFormById(_id) {
|
|
40683
40628
|
try {
|
|
40684
|
-
_id = new
|
|
40629
|
+
_id = new import_mongodb110.ObjectId(_id);
|
|
40685
40630
|
} catch (error) {
|
|
40686
40631
|
throw new import_node_server_utils186.BadRequestError("Invalid online form ID format.");
|
|
40687
40632
|
}
|
|
@@ -40724,7 +40669,7 @@ function useOnlineFormRepo() {
|
|
|
40724
40669
|
}
|
|
40725
40670
|
async function updateOnlineFormById(_id, value) {
|
|
40726
40671
|
try {
|
|
40727
|
-
_id = new
|
|
40672
|
+
_id = new import_mongodb110.ObjectId(_id);
|
|
40728
40673
|
} catch (error) {
|
|
40729
40674
|
throw new import_node_server_utils186.BadRequestError("Invalid online form ID format.");
|
|
40730
40675
|
}
|
|
@@ -40752,7 +40697,7 @@ function useOnlineFormRepo() {
|
|
|
40752
40697
|
}
|
|
40753
40698
|
async function deleteOnlineFormById(_id, session) {
|
|
40754
40699
|
try {
|
|
40755
|
-
_id = new
|
|
40700
|
+
_id = new import_mongodb110.ObjectId(_id);
|
|
40756
40701
|
} catch (error) {
|
|
40757
40702
|
throw new import_node_server_utils186.BadRequestError("Invalid online form ID format.");
|
|
40758
40703
|
}
|
|
@@ -40785,7 +40730,7 @@ function useOnlineFormRepo() {
|
|
|
40785
40730
|
}
|
|
40786
40731
|
async function getOnlineFormsBySiteId(site, { search = "", page = 1, limit = 10, status = "active" }) {
|
|
40787
40732
|
try {
|
|
40788
|
-
site = new
|
|
40733
|
+
site = new import_mongodb110.ObjectId(site);
|
|
40789
40734
|
} catch (error) {
|
|
40790
40735
|
throw new import_node_server_utils186.BadRequestError(
|
|
40791
40736
|
"Invalid online form configuration site ID format."
|
|
@@ -41226,7 +41171,7 @@ function useOccurrenceSubjectController() {
|
|
|
41226
41171
|
}
|
|
41227
41172
|
|
|
41228
41173
|
// src/models/nfc-patrol-log.model.ts
|
|
41229
|
-
var
|
|
41174
|
+
var import_mongodb111 = require("mongodb");
|
|
41230
41175
|
var import_joi108 = __toESM(require("joi"));
|
|
41231
41176
|
var import_node_server_utils190 = require("@7365admin1/node-server-utils");
|
|
41232
41177
|
var schemaNfcPatrolLog = import_joi108.default.object({
|
|
@@ -41278,32 +41223,32 @@ function MNfcPatrolLog(valueArg) {
|
|
|
41278
41223
|
}
|
|
41279
41224
|
if (value._id && typeof value._id === "string") {
|
|
41280
41225
|
try {
|
|
41281
|
-
value._id = new
|
|
41226
|
+
value._id = new import_mongodb111.ObjectId(value._id);
|
|
41282
41227
|
} catch (error2) {
|
|
41283
41228
|
throw new import_node_server_utils190.BadRequestError("Invalid _id format");
|
|
41284
41229
|
}
|
|
41285
41230
|
}
|
|
41286
41231
|
try {
|
|
41287
|
-
value.site = new
|
|
41232
|
+
value.site = new import_mongodb111.ObjectId(value.site);
|
|
41288
41233
|
} catch (error2) {
|
|
41289
41234
|
throw new import_node_server_utils190.BadRequestError("Invalid site format");
|
|
41290
41235
|
}
|
|
41291
41236
|
if (value?.createdBy) {
|
|
41292
41237
|
try {
|
|
41293
|
-
value.createdBy = new
|
|
41238
|
+
value.createdBy = new import_mongodb111.ObjectId(value.createdBy);
|
|
41294
41239
|
} catch (error2) {
|
|
41295
41240
|
throw new import_node_server_utils190.BadRequestError("Invalid createdBy format");
|
|
41296
41241
|
}
|
|
41297
41242
|
}
|
|
41298
41243
|
if (value?.route?._id) {
|
|
41299
41244
|
try {
|
|
41300
|
-
value.route._id = new
|
|
41245
|
+
value.route._id = new import_mongodb111.ObjectId(value.route._id);
|
|
41301
41246
|
} catch (error2) {
|
|
41302
41247
|
throw new import_node_server_utils190.BadRequestError("Invalid route _id format");
|
|
41303
41248
|
}
|
|
41304
41249
|
}
|
|
41305
41250
|
return {
|
|
41306
|
-
_id: value._id ?? new
|
|
41251
|
+
_id: value._id ?? new import_mongodb111.ObjectId(),
|
|
41307
41252
|
site: value.site,
|
|
41308
41253
|
route: value.route,
|
|
41309
41254
|
date: value.date,
|
|
@@ -41317,7 +41262,7 @@ function MNfcPatrolLog(valueArg) {
|
|
|
41317
41262
|
|
|
41318
41263
|
// src/repositories/nfc-patrol-log.repository.ts
|
|
41319
41264
|
var import_node_server_utils191 = require("@7365admin1/node-server-utils");
|
|
41320
|
-
var
|
|
41265
|
+
var import_mongodb112 = require("mongodb");
|
|
41321
41266
|
function useNfcPatrolLogRepo() {
|
|
41322
41267
|
const db = import_node_server_utils191.useAtlas.getDb();
|
|
41323
41268
|
if (!db) {
|
|
@@ -41370,7 +41315,7 @@ function useNfcPatrolLogRepo() {
|
|
|
41370
41315
|
const pageIndex = page > 0 ? page - 1 : 0;
|
|
41371
41316
|
let siteId;
|
|
41372
41317
|
try {
|
|
41373
|
-
siteId = typeof site === "string" ? new
|
|
41318
|
+
siteId = typeof site === "string" ? new import_mongodb112.ObjectId(site) : site;
|
|
41374
41319
|
} catch {
|
|
41375
41320
|
throw new import_node_server_utils191.BadRequestError("Invalid site ID format.");
|
|
41376
41321
|
}
|
|
@@ -41381,7 +41326,7 @@ function useNfcPatrolLogRepo() {
|
|
|
41381
41326
|
query.date = date;
|
|
41382
41327
|
}
|
|
41383
41328
|
if (route?._id) {
|
|
41384
|
-
query["route._id"] = typeof route._id === "string" ? new
|
|
41329
|
+
query["route._id"] = typeof route._id === "string" ? new import_mongodb112.ObjectId(route._id) : route._id;
|
|
41385
41330
|
}
|
|
41386
41331
|
if (route?.startTime) {
|
|
41387
41332
|
query["route.startTime"] = route.startTime;
|
|
@@ -42240,7 +42185,7 @@ function useNewDashboardController() {
|
|
|
42240
42185
|
|
|
42241
42186
|
// src/models/manpower-monitoring.model.ts
|
|
42242
42187
|
var import_joi111 = __toESM(require("joi"));
|
|
42243
|
-
var
|
|
42188
|
+
var import_mongodb113 = require("mongodb");
|
|
42244
42189
|
var shiftSchema = import_joi111.default.object({
|
|
42245
42190
|
name: import_joi111.default.string().required(),
|
|
42246
42191
|
checkIn: import_joi111.default.string().optional().allow("", null),
|
|
@@ -42265,7 +42210,7 @@ var manpowerMonitoringSchema = import_joi111.default.object({
|
|
|
42265
42210
|
});
|
|
42266
42211
|
var MManpowerMonitoring = class {
|
|
42267
42212
|
constructor(data) {
|
|
42268
|
-
this._id = new
|
|
42213
|
+
this._id = new import_mongodb113.ObjectId();
|
|
42269
42214
|
this.serviceProviderId = data.serviceProviderId || "";
|
|
42270
42215
|
this.siteId = data.siteId || "";
|
|
42271
42216
|
this.siteName = data.siteName;
|
|
@@ -42731,7 +42676,7 @@ var hrmlabs_attendance_util_default = {
|
|
|
42731
42676
|
};
|
|
42732
42677
|
|
|
42733
42678
|
// src/repositories/manpower-monitoring.repo.ts
|
|
42734
|
-
var
|
|
42679
|
+
var import_mongodb114 = require("mongodb");
|
|
42735
42680
|
var { hrmLabsAuthentication: hrmLabsAuthentication2, fetchSites: fetchSites2 } = hrmlabs_attendance_util_default;
|
|
42736
42681
|
function useManpowerMonitoringRepo() {
|
|
42737
42682
|
const db = import_node_server_utils196.useAtlas.getDb();
|
|
@@ -42745,11 +42690,11 @@ function useManpowerMonitoringRepo() {
|
|
|
42745
42690
|
try {
|
|
42746
42691
|
value = new MManpowerMonitoring(value);
|
|
42747
42692
|
if (value.createdBy)
|
|
42748
|
-
value.createdBy = new
|
|
42693
|
+
value.createdBy = new import_mongodb114.ObjectId(value.createdBy);
|
|
42749
42694
|
if (value.siteId)
|
|
42750
|
-
value.siteId = new
|
|
42695
|
+
value.siteId = new import_mongodb114.ObjectId(value.siteId);
|
|
42751
42696
|
if (value.serviceProviderId)
|
|
42752
|
-
value.serviceProviderId = new
|
|
42697
|
+
value.serviceProviderId = new import_mongodb114.ObjectId(value.serviceProviderId);
|
|
42753
42698
|
const result = await collection.insertOne(value, { session });
|
|
42754
42699
|
return result;
|
|
42755
42700
|
} catch (error) {
|
|
@@ -42790,8 +42735,8 @@ function useManpowerMonitoringRepo() {
|
|
|
42790
42735
|
}
|
|
42791
42736
|
async function getManpowerSettingsBySiteId(_id, serviceProviderId) {
|
|
42792
42737
|
try {
|
|
42793
|
-
_id = new
|
|
42794
|
-
serviceProviderId = new
|
|
42738
|
+
_id = new import_mongodb114.ObjectId(_id);
|
|
42739
|
+
serviceProviderId = new import_mongodb114.ObjectId(serviceProviderId);
|
|
42795
42740
|
} catch (error) {
|
|
42796
42741
|
throw new Error("Invalid Site ID format.");
|
|
42797
42742
|
}
|
|
@@ -42807,7 +42752,7 @@ function useManpowerMonitoringRepo() {
|
|
|
42807
42752
|
}
|
|
42808
42753
|
async function updateManpowerMonitoringSettings(_id, value) {
|
|
42809
42754
|
try {
|
|
42810
|
-
_id = new
|
|
42755
|
+
_id = new import_mongodb114.ObjectId(_id);
|
|
42811
42756
|
} catch (error) {
|
|
42812
42757
|
throw new import_node_server_utils196.BadRequestError("Invalid ID format.");
|
|
42813
42758
|
}
|
|
@@ -42834,7 +42779,7 @@ function useManpowerMonitoringRepo() {
|
|
|
42834
42779
|
for (let item of value) {
|
|
42835
42780
|
item = new MManpowerMonitoring(item);
|
|
42836
42781
|
const data = await collection.findOne({
|
|
42837
|
-
siteId: new
|
|
42782
|
+
siteId: new import_mongodb114.ObjectId(item.siteId)
|
|
42838
42783
|
});
|
|
42839
42784
|
if (data) {
|
|
42840
42785
|
let updateValue;
|
|
@@ -42859,11 +42804,11 @@ function useManpowerMonitoringRepo() {
|
|
|
42859
42804
|
}
|
|
42860
42805
|
} else {
|
|
42861
42806
|
if (item.createdBy)
|
|
42862
|
-
item.createdBy = new
|
|
42807
|
+
item.createdBy = new import_mongodb114.ObjectId(item.createdBy);
|
|
42863
42808
|
if (item.siteId)
|
|
42864
|
-
item.siteId = new
|
|
42809
|
+
item.siteId = new import_mongodb114.ObjectId(item.siteId);
|
|
42865
42810
|
if (item.serviceProviderId)
|
|
42866
|
-
item.serviceProviderId = new
|
|
42811
|
+
item.serviceProviderId = new import_mongodb114.ObjectId(item.serviceProviderId);
|
|
42867
42812
|
const result = await collection.insertOne(item);
|
|
42868
42813
|
if (result.insertedId) {
|
|
42869
42814
|
results.inserted++;
|
|
@@ -42887,7 +42832,7 @@ function useManpowerMonitoringRepo() {
|
|
|
42887
42832
|
const siteUrl = process.env.HRMLABS_SITE_URL;
|
|
42888
42833
|
try {
|
|
42889
42834
|
const serviceProvider = await serviceProviderCollection.findOne({
|
|
42890
|
-
_id: new
|
|
42835
|
+
_id: new import_mongodb114.ObjectId(serviceProviderId)
|
|
42891
42836
|
});
|
|
42892
42837
|
if (!serviceProvider) {
|
|
42893
42838
|
throw new Error("Service Provider not found.");
|
|
@@ -42929,7 +42874,7 @@ var import_node_server_utils197 = require("@7365admin1/node-server-utils");
|
|
|
42929
42874
|
|
|
42930
42875
|
// src/models/manpower-remarks.model.ts
|
|
42931
42876
|
var import_joi112 = __toESM(require("joi"));
|
|
42932
|
-
var
|
|
42877
|
+
var import_mongodb115 = require("mongodb");
|
|
42933
42878
|
var remarksSchema = import_joi112.default.object({
|
|
42934
42879
|
name: import_joi112.default.string().required(),
|
|
42935
42880
|
remark: import_joi112.default.object({
|
|
@@ -42953,7 +42898,7 @@ var manpowerRemarksSchema = import_joi112.default.object({
|
|
|
42953
42898
|
});
|
|
42954
42899
|
var MManpowerRemarks = class {
|
|
42955
42900
|
constructor(data) {
|
|
42956
|
-
this._id = new
|
|
42901
|
+
this._id = new import_mongodb115.ObjectId();
|
|
42957
42902
|
this.serviceProviderId = data.serviceProviderId || "";
|
|
42958
42903
|
this.siteId = data.siteId || "";
|
|
42959
42904
|
this.siteName = data.siteName || "";
|
|
@@ -42971,7 +42916,7 @@ var MManpowerRemarks = class {
|
|
|
42971
42916
|
};
|
|
42972
42917
|
|
|
42973
42918
|
// src/repositories/manpower-remarks.repo.ts
|
|
42974
|
-
var
|
|
42919
|
+
var import_mongodb116 = require("mongodb");
|
|
42975
42920
|
var import_moment_timezone2 = __toESM(require("moment-timezone"));
|
|
42976
42921
|
function useManpowerRemarksRepo() {
|
|
42977
42922
|
const db = import_node_server_utils197.useAtlas.getDb();
|
|
@@ -42984,9 +42929,9 @@ function useManpowerRemarksRepo() {
|
|
|
42984
42929
|
try {
|
|
42985
42930
|
value = new MManpowerRemarks(value);
|
|
42986
42931
|
if (value.siteId)
|
|
42987
|
-
value.siteId = new
|
|
42932
|
+
value.siteId = new import_mongodb116.ObjectId(value.siteId);
|
|
42988
42933
|
if (value.serviceProviderId)
|
|
42989
|
-
value.serviceProviderId = new
|
|
42934
|
+
value.serviceProviderId = new import_mongodb116.ObjectId(value.serviceProviderId);
|
|
42990
42935
|
const result = await collection.insertOne(value, { session });
|
|
42991
42936
|
return result;
|
|
42992
42937
|
} catch (error) {
|
|
@@ -43006,7 +42951,7 @@ function useManpowerRemarksRepo() {
|
|
|
43006
42951
|
limit = limit || 10;
|
|
43007
42952
|
const searchQuery = {};
|
|
43008
42953
|
const nowSGT = (0, import_moment_timezone2.default)().tz("Asia/Singapore");
|
|
43009
|
-
searchQuery.serviceProviderId = new
|
|
42954
|
+
searchQuery.serviceProviderId = new import_mongodb116.ObjectId(serviceProviderId);
|
|
43010
42955
|
if (search != "") {
|
|
43011
42956
|
searchQuery.siteName = { $regex: search, $options: "i" };
|
|
43012
42957
|
}
|
|
@@ -43038,8 +42983,8 @@ function useManpowerRemarksRepo() {
|
|
|
43038
42983
|
}
|
|
43039
42984
|
async function getManpowerRemarksBySiteId(_id, date, serviceProviderId) {
|
|
43040
42985
|
try {
|
|
43041
|
-
_id = new
|
|
43042
|
-
serviceProviderId = new
|
|
42986
|
+
_id = new import_mongodb116.ObjectId(_id);
|
|
42987
|
+
serviceProviderId = new import_mongodb116.ObjectId(serviceProviderId);
|
|
43043
42988
|
} catch (error) {
|
|
43044
42989
|
throw new Error("Invalid Site ID format.");
|
|
43045
42990
|
}
|
|
@@ -43056,13 +43001,13 @@ function useManpowerRemarksRepo() {
|
|
|
43056
43001
|
}
|
|
43057
43002
|
async function updateManpowerRemarks(_id, value) {
|
|
43058
43003
|
try {
|
|
43059
|
-
_id = new
|
|
43004
|
+
_id = new import_mongodb116.ObjectId(_id);
|
|
43060
43005
|
} catch (error) {
|
|
43061
43006
|
throw new import_node_server_utils197.BadRequestError("Invalid ID format.");
|
|
43062
43007
|
}
|
|
43063
43008
|
try {
|
|
43064
43009
|
if (value.createdBy) {
|
|
43065
|
-
value.createdBy = new
|
|
43010
|
+
value.createdBy = new import_mongodb116.ObjectId(value.createdBy);
|
|
43066
43011
|
}
|
|
43067
43012
|
const updateValue = {
|
|
43068
43013
|
...value,
|
|
@@ -43079,7 +43024,7 @@ function useManpowerRemarksRepo() {
|
|
|
43079
43024
|
}
|
|
43080
43025
|
async function updateRemarksStatus(_id, value) {
|
|
43081
43026
|
try {
|
|
43082
|
-
_id = new
|
|
43027
|
+
_id = new import_mongodb116.ObjectId(_id);
|
|
43083
43028
|
} catch (error) {
|
|
43084
43029
|
throw new import_node_server_utils197.BadRequestError("Invalid ID format.");
|
|
43085
43030
|
}
|
|
@@ -43351,7 +43296,7 @@ function useManpowerMonitoringCtrl() {
|
|
|
43351
43296
|
|
|
43352
43297
|
// src/models/manpower-designations.model.ts
|
|
43353
43298
|
var import_joi114 = __toESM(require("joi"));
|
|
43354
|
-
var
|
|
43299
|
+
var import_mongodb117 = require("mongodb");
|
|
43355
43300
|
var designationsSchema = import_joi114.default.object({
|
|
43356
43301
|
title: import_joi114.default.string().required(),
|
|
43357
43302
|
shifts: import_joi114.default.object({
|
|
@@ -43370,7 +43315,7 @@ var manpowerDesignationsSchema = import_joi114.default.object({
|
|
|
43370
43315
|
});
|
|
43371
43316
|
var MManpowerDesignations = class {
|
|
43372
43317
|
constructor(data) {
|
|
43373
|
-
this._id = new
|
|
43318
|
+
this._id = new import_mongodb117.ObjectId();
|
|
43374
43319
|
this.siteId = data.siteId || "";
|
|
43375
43320
|
this.siteName = data.siteName || "";
|
|
43376
43321
|
this.serviceProviderId = data.serviceProviderId || "";
|
|
@@ -43384,7 +43329,7 @@ var MManpowerDesignations = class {
|
|
|
43384
43329
|
|
|
43385
43330
|
// src/repositories/manpower-designations.repo.ts
|
|
43386
43331
|
var import_node_server_utils200 = require("@7365admin1/node-server-utils");
|
|
43387
|
-
var
|
|
43332
|
+
var import_mongodb118 = require("mongodb");
|
|
43388
43333
|
function useManpowerDesignationRepo() {
|
|
43389
43334
|
const db = import_node_server_utils200.useAtlas.getDb();
|
|
43390
43335
|
if (!db) {
|
|
@@ -43396,11 +43341,11 @@ function useManpowerDesignationRepo() {
|
|
|
43396
43341
|
try {
|
|
43397
43342
|
value = new MManpowerDesignations(value);
|
|
43398
43343
|
if (value.createdBy)
|
|
43399
|
-
value.createdBy = new
|
|
43344
|
+
value.createdBy = new import_mongodb118.ObjectId(value.createdBy);
|
|
43400
43345
|
if (value.siteId)
|
|
43401
|
-
value.siteId = new
|
|
43346
|
+
value.siteId = new import_mongodb118.ObjectId(value.siteId);
|
|
43402
43347
|
if (value.serviceProviderId)
|
|
43403
|
-
value.serviceProviderId = new
|
|
43348
|
+
value.serviceProviderId = new import_mongodb118.ObjectId(value.serviceProviderId);
|
|
43404
43349
|
const result = await collection.insertOne(value);
|
|
43405
43350
|
return result;
|
|
43406
43351
|
} catch (error) {
|
|
@@ -43409,8 +43354,8 @@ function useManpowerDesignationRepo() {
|
|
|
43409
43354
|
}
|
|
43410
43355
|
async function getManpowerDesignationsBySiteId(_id, serviceProviderId) {
|
|
43411
43356
|
try {
|
|
43412
|
-
_id = new
|
|
43413
|
-
serviceProviderId = new
|
|
43357
|
+
_id = new import_mongodb118.ObjectId(_id);
|
|
43358
|
+
serviceProviderId = new import_mongodb118.ObjectId(serviceProviderId);
|
|
43414
43359
|
} catch (error) {
|
|
43415
43360
|
throw new Error("Invalid Site ID format.");
|
|
43416
43361
|
}
|
|
@@ -43426,7 +43371,7 @@ function useManpowerDesignationRepo() {
|
|
|
43426
43371
|
}
|
|
43427
43372
|
async function updateManpowerDesignations(_id, value) {
|
|
43428
43373
|
try {
|
|
43429
|
-
_id = new
|
|
43374
|
+
_id = new import_mongodb118.ObjectId(_id);
|
|
43430
43375
|
} catch (error) {
|
|
43431
43376
|
throw new Error("Invalid ID format.");
|
|
43432
43377
|
}
|
|
@@ -43529,7 +43474,7 @@ function useManpowerDesignationCtrl() {
|
|
|
43529
43474
|
|
|
43530
43475
|
// src/models/overnight-parking.model.ts
|
|
43531
43476
|
var import_joi116 = __toESM(require("joi"));
|
|
43532
|
-
var
|
|
43477
|
+
var import_mongodb119 = require("mongodb");
|
|
43533
43478
|
var dayScheduleSchema = import_joi116.default.object({
|
|
43534
43479
|
isEnabled: import_joi116.default.boolean().required(),
|
|
43535
43480
|
startTime: import_joi116.default.string().pattern(/^([01]\d|2[0-3]):([0-5]\d)$/).optional().allow(null, "").messages({
|
|
@@ -43571,7 +43516,7 @@ function MOvernightParkingApprovalHours(value) {
|
|
|
43571
43516
|
}
|
|
43572
43517
|
if (value.site && typeof value.site === "string") {
|
|
43573
43518
|
try {
|
|
43574
|
-
value.site = new
|
|
43519
|
+
value.site = new import_mongodb119.ObjectId(value.site);
|
|
43575
43520
|
} catch {
|
|
43576
43521
|
throw new Error("Invalid site ID.");
|
|
43577
43522
|
}
|
|
@@ -45176,7 +45121,7 @@ function useManpowerRemarkCtrl() {
|
|
|
45176
45121
|
|
|
45177
45122
|
// src/models/manpower-sites.model.ts
|
|
45178
45123
|
var import_joi122 = __toESM(require("joi"));
|
|
45179
|
-
var
|
|
45124
|
+
var import_mongodb120 = require("mongodb");
|
|
45180
45125
|
var manpowerSitesSchema = import_joi122.default.object({
|
|
45181
45126
|
id: import_joi122.default.string().hex().required(),
|
|
45182
45127
|
text: import_joi122.default.string().hex().optional().allow("", null),
|
|
@@ -45187,7 +45132,7 @@ var manpowerSitesSchema = import_joi122.default.object({
|
|
|
45187
45132
|
});
|
|
45188
45133
|
var MManpowerSites = class {
|
|
45189
45134
|
constructor(data) {
|
|
45190
|
-
this._id = new
|
|
45135
|
+
this._id = new import_mongodb120.ObjectId();
|
|
45191
45136
|
this.id = data.id || "";
|
|
45192
45137
|
this.text = data.text || "";
|
|
45193
45138
|
this.contractID = data.contractID || "";
|
|
@@ -45397,7 +45342,7 @@ function useManpowerSitesCtrl() {
|
|
|
45397
45342
|
|
|
45398
45343
|
// src/utils/cron.util.ts
|
|
45399
45344
|
var import_node_server_utils214 = require("@7365admin1/node-server-utils");
|
|
45400
|
-
var
|
|
45345
|
+
var import_mongodb121 = require("mongodb");
|
|
45401
45346
|
var import_moment_timezone4 = __toESM(require("moment-timezone"));
|
|
45402
45347
|
var createManpowerRemarksDaily = async () => {
|
|
45403
45348
|
const db = import_node_server_utils214.useAtlas.getDb();
|
|
@@ -45557,7 +45502,7 @@ var updateRemarksisAcknowledged = async () => {
|
|
|
45557
45502
|
for (const id of updatedIds) {
|
|
45558
45503
|
const doc = await remarks.findOne({ _id: id });
|
|
45559
45504
|
const setting = await settings.findOne(
|
|
45560
|
-
{ siteId: new
|
|
45505
|
+
{ siteId: new import_mongodb121.ObjectId(doc?.siteId) },
|
|
45561
45506
|
{ projection: { emails: 1 } }
|
|
45562
45507
|
);
|
|
45563
45508
|
const payload = {
|
|
@@ -45643,7 +45588,7 @@ var updateRemarksStatusEod = async () => {
|
|
|
45643
45588
|
for (const doc of docs) {
|
|
45644
45589
|
let shiftsToCheck = [];
|
|
45645
45590
|
const endShiftTime = await settings.findOne(
|
|
45646
|
-
{ siteId: new
|
|
45591
|
+
{ siteId: new import_mongodb121.ObjectId(doc.siteId) },
|
|
45647
45592
|
{ projection: { shifts: 1, shiftType: 1 } }
|
|
45648
45593
|
);
|
|
45649
45594
|
if (doc.createdAtSGT === nowSGT) {
|
|
@@ -45749,7 +45694,7 @@ var isWithinHour = (alertTime, timeNow) => {
|
|
|
45749
45694
|
|
|
45750
45695
|
// src/events/manpower.event.ts
|
|
45751
45696
|
var import_node_server_utils215 = require("@7365admin1/node-server-utils");
|
|
45752
|
-
var
|
|
45697
|
+
var import_mongodb122 = require("mongodb");
|
|
45753
45698
|
var import_moment_timezone5 = __toESM(require("moment-timezone"));
|
|
45754
45699
|
async function manpowerEvents(io) {
|
|
45755
45700
|
let intervalId = null;
|
|
@@ -45775,7 +45720,7 @@ async function manpowerEvents(io) {
|
|
|
45775
45720
|
}).toArray();
|
|
45776
45721
|
for (const doc of docs) {
|
|
45777
45722
|
const siteSettings = await settings.findOne(
|
|
45778
|
-
{ siteId: new
|
|
45723
|
+
{ siteId: new import_mongodb122.ObjectId(doc.siteId), enabled: true },
|
|
45779
45724
|
{ projection: { shifts: 1, shiftType: 1 } }
|
|
45780
45725
|
);
|
|
45781
45726
|
const shiftType = siteSettings?.shiftType || "2-shifts";
|
|
@@ -45894,7 +45839,7 @@ function genericSignature(params, secretKey) {
|
|
|
45894
45839
|
}
|
|
45895
45840
|
|
|
45896
45841
|
// src/repositories/reddot-payment.repository.ts
|
|
45897
|
-
var
|
|
45842
|
+
var import_mongodb126 = require("mongodb");
|
|
45898
45843
|
|
|
45899
45844
|
// src/utils/date-format.util.ts
|
|
45900
45845
|
var import_moment_timezone6 = __toESM(require("moment-timezone"));
|
|
@@ -45919,11 +45864,11 @@ function formatDateString(today, format, dateRange) {
|
|
|
45919
45864
|
}
|
|
45920
45865
|
|
|
45921
45866
|
// src/models/credit-card.model.ts
|
|
45922
|
-
var
|
|
45867
|
+
var import_mongodb123 = require("mongodb");
|
|
45923
45868
|
var MCardInfo = class {
|
|
45924
45869
|
// this is coming from RDP transaction
|
|
45925
45870
|
constructor({
|
|
45926
|
-
_id = new
|
|
45871
|
+
_id = new import_mongodb123.ObjectId(),
|
|
45927
45872
|
userId,
|
|
45928
45873
|
cardType,
|
|
45929
45874
|
cardNumber,
|
|
@@ -45958,11 +45903,11 @@ var MCardInfo = class {
|
|
|
45958
45903
|
};
|
|
45959
45904
|
|
|
45960
45905
|
// src/models/cart.model.ts
|
|
45961
|
-
var
|
|
45906
|
+
var import_mongodb124 = require("mongodb");
|
|
45962
45907
|
var MUnitBillings = class {
|
|
45963
45908
|
// transaction response messages
|
|
45964
45909
|
constructor({
|
|
45965
|
-
_id = new
|
|
45910
|
+
_id = new import_mongodb124.ObjectId(),
|
|
45966
45911
|
unit,
|
|
45967
45912
|
unitId,
|
|
45968
45913
|
unitBill,
|
|
@@ -46003,7 +45948,7 @@ var MUnitBillings = class {
|
|
|
46003
45948
|
};
|
|
46004
45949
|
|
|
46005
45950
|
// src/repositories/payment.repository.ts
|
|
46006
|
-
var
|
|
45951
|
+
var import_mongodb125 = require("mongodb");
|
|
46007
45952
|
var import_node_server_utils216 = require("@7365admin1/node-server-utils");
|
|
46008
45953
|
var PaymentBillRepo = () => {
|
|
46009
45954
|
const getDB2 = () => {
|
|
@@ -46037,7 +45982,7 @@ var PaymentBillRepo = () => {
|
|
|
46037
45982
|
if (unitBillInfo?.status === "Inactive" /* inactive */) {
|
|
46038
45983
|
throw new Error("This Bill is Inactive!");
|
|
46039
45984
|
}
|
|
46040
|
-
const billId = new
|
|
45985
|
+
const billId = new import_mongodb125.ObjectId(unitBillInfo?.billId);
|
|
46041
45986
|
const billInfo = await billCollection().findOne({ _id: billId });
|
|
46042
45987
|
if (!billInfo) {
|
|
46043
45988
|
throw new Error("Bill info not found");
|
|
@@ -46076,13 +46021,13 @@ var PaymentBillRepo = () => {
|
|
|
46076
46021
|
const saveCreditCardInfo = async (payload) => {
|
|
46077
46022
|
try {
|
|
46078
46023
|
if (payload.userId)
|
|
46079
|
-
payload.userId = new
|
|
46024
|
+
payload.userId = new import_mongodb125.ObjectId(payload.userId);
|
|
46080
46025
|
if (payload.site)
|
|
46081
|
-
payload.site = new
|
|
46026
|
+
payload.site = new import_mongodb125.ObjectId(payload.site);
|
|
46082
46027
|
if (payload.organization)
|
|
46083
|
-
payload.organization = new
|
|
46028
|
+
payload.organization = new import_mongodb125.ObjectId(payload.organization);
|
|
46084
46029
|
if (payload.createdBy)
|
|
46085
|
-
payload.createdBy = new
|
|
46030
|
+
payload.createdBy = new import_mongodb125.ObjectId(payload.createdBy);
|
|
46086
46031
|
const createdAt = formatDateString(/* @__PURE__ */ new Date(), "mm-dd-yyyy");
|
|
46087
46032
|
payload.createdAt = createdAt;
|
|
46088
46033
|
const result = await creditCollection().insertOne(new MCardInfo(payload));
|
|
@@ -46094,19 +46039,19 @@ var PaymentBillRepo = () => {
|
|
|
46094
46039
|
const checkOutUnitBills = async (payload) => {
|
|
46095
46040
|
try {
|
|
46096
46041
|
if (payload.unitId)
|
|
46097
|
-
payload.unitId = new
|
|
46042
|
+
payload.unitId = new import_mongodb125.ObjectId(payload.unitId);
|
|
46098
46043
|
if (payload.site)
|
|
46099
|
-
payload.site = new
|
|
46044
|
+
payload.site = new import_mongodb125.ObjectId(payload.site);
|
|
46100
46045
|
if (payload.organization)
|
|
46101
|
-
payload.organization = new
|
|
46046
|
+
payload.organization = new import_mongodb125.ObjectId(payload.organization);
|
|
46102
46047
|
payload.createdAt = await formatDateString(/* @__PURE__ */ new Date(), "mm-dd-yyyy");
|
|
46103
46048
|
const addToCart = await cartCollection().insertOne(new MUnitBillings(payload));
|
|
46104
46049
|
const unitId = payload.unitId;
|
|
46105
46050
|
const dateFormatted = formatDateString(/* @__PURE__ */ new Date(), "for-ref");
|
|
46106
46051
|
const unit = unitId?.toString().slice(-4);
|
|
46107
|
-
const newId = new
|
|
46052
|
+
const newId = new import_mongodb125.ObjectId(addToCart?.insertedId).toString().slice(-4);
|
|
46108
46053
|
const referenceNumber = `CRT${unit}${newId}${dateFormatted}`;
|
|
46109
|
-
const result = await cartCollection().findOneAndUpdate({ _id: new
|
|
46054
|
+
const result = await cartCollection().findOneAndUpdate({ _id: new import_mongodb125.ObjectId(addToCart.insertedId) }, { $set: { referenceNumber } }, { returnDocument: "after" });
|
|
46110
46055
|
return result;
|
|
46111
46056
|
} catch (error) {
|
|
46112
46057
|
throw new Error(error.message || error || "Server Internal Error");
|
|
@@ -46137,7 +46082,7 @@ var PaymentBillRepo = () => {
|
|
|
46137
46082
|
for (const ref of refNumber) {
|
|
46138
46083
|
const unitBillInfo = await collection().findOne({ referenceNumber: ref });
|
|
46139
46084
|
const billId = unitBillInfo?.billId;
|
|
46140
|
-
const billInfo = await billCollection().findOne({ _id: new
|
|
46085
|
+
const billInfo = await billCollection().findOne({ _id: new import_mongodb125.ObjectId(billId) });
|
|
46141
46086
|
const billAmount = billInfo?.price;
|
|
46142
46087
|
payload.updatedAt = updatedAt;
|
|
46143
46088
|
payload.amountPaid = billAmount;
|
|
@@ -46288,7 +46233,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
46288
46233
|
throw new Error("Failed to Add Merchant Details");
|
|
46289
46234
|
}
|
|
46290
46235
|
const merchantId = merchant?.insertedId;
|
|
46291
|
-
const orgId = new
|
|
46236
|
+
const orgId = new import_mongodb126.ObjectId(_id);
|
|
46292
46237
|
const result = await orgCollection().findOneAndUpdate({ _id: orgId }, { $push: { merchant: merchantId } }, {
|
|
46293
46238
|
returnDocument: "after"
|
|
46294
46239
|
});
|
|
@@ -46317,7 +46262,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
46317
46262
|
const getMerchantDetailsById = async (_id) => {
|
|
46318
46263
|
try {
|
|
46319
46264
|
if (_id)
|
|
46320
|
-
_id = new
|
|
46265
|
+
_id = new import_mongodb126.ObjectId(_id);
|
|
46321
46266
|
const result = await redDotMerchantCollection().aggregate([
|
|
46322
46267
|
{
|
|
46323
46268
|
$match: {
|
|
@@ -46572,7 +46517,7 @@ function useRedDotPaymentController() {
|
|
|
46572
46517
|
|
|
46573
46518
|
// src/repositories/verification-v2.repo.ts
|
|
46574
46519
|
var import_node_server_utils218 = require("@7365admin1/node-server-utils");
|
|
46575
|
-
var
|
|
46520
|
+
var import_mongodb127 = require("mongodb");
|
|
46576
46521
|
function useVerificationRepoV2() {
|
|
46577
46522
|
const db = import_node_server_utils218.useAtlas.getDb();
|
|
46578
46523
|
if (!db) {
|
|
@@ -46625,7 +46570,7 @@ function useVerificationRepoV2() {
|
|
|
46625
46570
|
}
|
|
46626
46571
|
async function updateVerificationStatusById(_id, status, session) {
|
|
46627
46572
|
try {
|
|
46628
|
-
_id = new
|
|
46573
|
+
_id = new import_mongodb127.ObjectId(_id);
|
|
46629
46574
|
} catch (error) {
|
|
46630
46575
|
throw new import_node_server_utils218.BadRequestError("Invalid verification ID format.");
|
|
46631
46576
|
}
|
|
@@ -47177,7 +47122,7 @@ var import_node_server_utils222 = require("@7365admin1/node-server-utils");
|
|
|
47177
47122
|
var import_uuid2 = require("uuid");
|
|
47178
47123
|
|
|
47179
47124
|
// src/repositories/user-v2.repo.ts
|
|
47180
|
-
var
|
|
47125
|
+
var import_mongodb128 = require("mongodb");
|
|
47181
47126
|
var import_node_server_utils221 = require("@7365admin1/node-server-utils");
|
|
47182
47127
|
function useUserRepoV2() {
|
|
47183
47128
|
const { updateFeedbackCreatedByName } = useFeedbackRepo();
|
|
@@ -47378,7 +47323,7 @@ function useUserRepoV2() {
|
|
|
47378
47323
|
}
|
|
47379
47324
|
if (organization) {
|
|
47380
47325
|
try {
|
|
47381
|
-
query.defaultOrg = new
|
|
47326
|
+
query.defaultOrg = new import_mongodb128.ObjectId(organization);
|
|
47382
47327
|
cacheOptions.organization = organization.toString();
|
|
47383
47328
|
} catch (error) {
|
|
47384
47329
|
throw new import_node_server_utils221.BadRequestError("Invalid organization ID format.");
|
|
@@ -47517,13 +47462,13 @@ function useUserRepoV2() {
|
|
|
47517
47462
|
);
|
|
47518
47463
|
}
|
|
47519
47464
|
try {
|
|
47520
|
-
_id = new
|
|
47465
|
+
_id = new import_mongodb128.ObjectId(_id);
|
|
47521
47466
|
} catch (error) {
|
|
47522
47467
|
throw new import_node_server_utils221.BadRequestError("Invalid ID.");
|
|
47523
47468
|
}
|
|
47524
47469
|
if (field === "defaultOrg") {
|
|
47525
47470
|
try {
|
|
47526
|
-
value = new
|
|
47471
|
+
value = new import_mongodb128.ObjectId(value);
|
|
47527
47472
|
} catch (error) {
|
|
47528
47473
|
throw new import_node_server_utils221.BadRequestError("Invalid organization ID.");
|
|
47529
47474
|
}
|
|
@@ -47564,7 +47509,7 @@ function useUserRepoV2() {
|
|
|
47564
47509
|
year
|
|
47565
47510
|
}, session) {
|
|
47566
47511
|
try {
|
|
47567
|
-
_id = new
|
|
47512
|
+
_id = new import_mongodb128.ObjectId(_id);
|
|
47568
47513
|
} catch (error) {
|
|
47569
47514
|
throw new import_node_server_utils221.BadRequestError("Invalid user ID format.");
|
|
47570
47515
|
}
|
|
@@ -47594,7 +47539,7 @@ function useUserRepoV2() {
|
|
|
47594
47539
|
}
|
|
47595
47540
|
async function updatePassword({ _id, password }, session) {
|
|
47596
47541
|
try {
|
|
47597
|
-
_id = new
|
|
47542
|
+
_id = new import_mongodb128.ObjectId(_id);
|
|
47598
47543
|
} catch (error) {
|
|
47599
47544
|
throw new import_node_server_utils221.BadRequestError("Invalid user ID format.");
|
|
47600
47545
|
}
|