@7365admin1/core 2.41.0 → 2.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +197 -116
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +417 -330
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -423,7 +423,6 @@ function useFeedbackRepo() {
|
|
|
423
423
|
cacheOptions.from = from;
|
|
424
424
|
cacheOptions.to = to;
|
|
425
425
|
}
|
|
426
|
-
console.log("query", JSON.stringify(query));
|
|
427
426
|
const cacheKey = makeCacheKey2(feedbacks_namespace_collection, cacheOptions);
|
|
428
427
|
const cachedData = await getCache(cacheKey);
|
|
429
428
|
if (cachedData) {
|
|
@@ -1892,7 +1891,6 @@ function useOccurrenceEntryRepo() {
|
|
|
1892
1891
|
throw new Error("Invalid incident report ID.");
|
|
1893
1892
|
}
|
|
1894
1893
|
}
|
|
1895
|
-
console.log("Updating occurrence entry:", _id, value);
|
|
1896
1894
|
try {
|
|
1897
1895
|
const res = await collection.updateOne(
|
|
1898
1896
|
{ _id },
|
|
@@ -10332,7 +10330,6 @@ function useSubscriptionService() {
|
|
|
10332
10330
|
subscription.nextBillingDate,
|
|
10333
10331
|
"pending"
|
|
10334
10332
|
);
|
|
10335
|
-
console.log("dueInvoice", dueInvoice);
|
|
10336
10333
|
if (value.promoCode) {
|
|
10337
10334
|
const promoCode = await getByCode(value.promoCode);
|
|
10338
10335
|
if (!promoCode) {
|
|
@@ -11361,11 +11358,8 @@ function useFeedbackController() {
|
|
|
11361
11358
|
(acc, [key, value]) => ({ ...acc, [key]: value }),
|
|
11362
11359
|
{}
|
|
11363
11360
|
);
|
|
11364
|
-
console.log("cookies", cookies);
|
|
11365
11361
|
const createdBy = cookies?.["user"].toString() ?? "";
|
|
11366
|
-
console.log("createdBy", createdBy);
|
|
11367
11362
|
const payload = { ...req.body, createdBy };
|
|
11368
|
-
console.log("payload", payload);
|
|
11369
11363
|
const { error } = feedbackSchema.validate(payload);
|
|
11370
11364
|
if (error) {
|
|
11371
11365
|
logger40.log({ level: "error", message: error.message });
|
|
@@ -13301,7 +13295,8 @@ var schemaPerson = Joi35.object({
|
|
|
13301
13295
|
plates: Joi35.array().items(schemaPlate).optional().allow(null),
|
|
13302
13296
|
isOwner: Joi35.boolean().required(),
|
|
13303
13297
|
files: Joi35.array().items(schemaFiles).optional().allow(null),
|
|
13304
|
-
password: Joi35.string().optional().allow(null, "")
|
|
13298
|
+
password: Joi35.string().optional().allow(null, ""),
|
|
13299
|
+
plateNumber: Joi35.string().optional().allow(null, "")
|
|
13305
13300
|
});
|
|
13306
13301
|
var schemaUpdatePerson = Joi35.object({
|
|
13307
13302
|
_id: Joi35.string().hex().required(),
|
|
@@ -13321,7 +13316,8 @@ var schemaUpdatePerson = Joi35.object({
|
|
|
13321
13316
|
plates: Joi35.array().items(schemaFiles).optional().allow(null, ""),
|
|
13322
13317
|
isOwner: Joi35.boolean().optional().allow(null, ""),
|
|
13323
13318
|
files: Joi35.array().items(schemaFiles).optional().allow(null),
|
|
13324
|
-
password: Joi35.string().optional().allow(null, "")
|
|
13319
|
+
password: Joi35.string().optional().allow(null, ""),
|
|
13320
|
+
plateNumber: Joi35.string().optional().allow(null, "")
|
|
13325
13321
|
});
|
|
13326
13322
|
function MPerson(value) {
|
|
13327
13323
|
const { error } = schemaPerson.validate(value);
|
|
@@ -13391,6 +13387,7 @@ function MPerson(value) {
|
|
|
13391
13387
|
plates: value.plates ?? [],
|
|
13392
13388
|
isOwner: value.isOwner ?? false,
|
|
13393
13389
|
files: value.files ?? [],
|
|
13390
|
+
plateNumber: value.plateNumber ?? "",
|
|
13394
13391
|
createdAt: value.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
13395
13392
|
updatedAt: value.updatedAt,
|
|
13396
13393
|
deletedAt: value.deletedAt
|
|
@@ -13724,7 +13721,6 @@ function useVisitorTransactionRepo() {
|
|
|
13724
13721
|
...status && { status },
|
|
13725
13722
|
...tab == "Overnight Parking" && { isOvernightParking: true }
|
|
13726
13723
|
};
|
|
13727
|
-
console.log(query);
|
|
13728
13724
|
sort = Object.keys(sort).length > 0 ? sort : { _id: -1 };
|
|
13729
13725
|
try {
|
|
13730
13726
|
const basePipeline = [{ $match: query }];
|
|
@@ -14197,8 +14193,8 @@ function MVehicle(value) {
|
|
|
14197
14193
|
const createdAtDate = value.createdAt ? new Date(value.createdAt) : /* @__PURE__ */ new Date();
|
|
14198
14194
|
const expiredDate = new Date(createdAtDate);
|
|
14199
14195
|
expiredDate.setFullYear(expiredDate.getFullYear() + 10);
|
|
14200
|
-
const createdAt = createdAtDate
|
|
14201
|
-
const expiredAt = value.end ?? expiredDate
|
|
14196
|
+
const createdAt = createdAtDate;
|
|
14197
|
+
const expiredAt = value.end ?? expiredDate;
|
|
14202
14198
|
return {
|
|
14203
14199
|
plateNumber: value.plateNumber ?? "",
|
|
14204
14200
|
type: value.type ?? "",
|
|
@@ -14214,8 +14210,8 @@ function MVehicle(value) {
|
|
|
14214
14210
|
nric: value.nric ?? "",
|
|
14215
14211
|
remarks: value.remarks ?? "",
|
|
14216
14212
|
seasonPassType: value.seasonPassType ?? "",
|
|
14217
|
-
start: value.start
|
|
14218
|
-
end: value.end
|
|
14213
|
+
start: value.start ? new Date(value.start) : createdAt,
|
|
14214
|
+
end: value.end ? new Date(value.end) : expiredAt,
|
|
14219
14215
|
status: value.status ?? "active" /* ACTIVE */,
|
|
14220
14216
|
unitName: value.unitName ?? "",
|
|
14221
14217
|
peopleId: value.peopleId ?? "",
|
|
@@ -14353,10 +14349,11 @@ function useVehicleRepo() {
|
|
|
14353
14349
|
const baseQuery = {
|
|
14354
14350
|
...status && { status },
|
|
14355
14351
|
...type && { type },
|
|
14356
|
-
...category && { category }
|
|
14357
|
-
...search && { $text: { search } }
|
|
14352
|
+
...category && { category }
|
|
14358
14353
|
};
|
|
14359
14354
|
let query = { ...baseQuery };
|
|
14355
|
+
if (search)
|
|
14356
|
+
query.$text = { $search: search };
|
|
14360
14357
|
const escapeRegex = (input) => input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
14361
14358
|
const buildGroupedPipeline = (matchQuery) => [
|
|
14362
14359
|
{ $match: matchQuery },
|
|
@@ -14916,7 +14913,7 @@ function useVehicleRepo() {
|
|
|
14916
14913
|
throw error;
|
|
14917
14914
|
}
|
|
14918
14915
|
}
|
|
14919
|
-
async function bulkUpsertVehicles(values
|
|
14916
|
+
async function bulkUpsertVehicles(values) {
|
|
14920
14917
|
try {
|
|
14921
14918
|
if (!Array.isArray(values) || values.length === 0) {
|
|
14922
14919
|
return {
|
|
@@ -14925,7 +14922,7 @@ function useVehicleRepo() {
|
|
|
14925
14922
|
upsertedCount: 0
|
|
14926
14923
|
};
|
|
14927
14924
|
}
|
|
14928
|
-
const now =
|
|
14925
|
+
const now = /* @__PURE__ */ new Date();
|
|
14929
14926
|
const operations = values.map((item) => {
|
|
14930
14927
|
const vehicle = MVehicle(item);
|
|
14931
14928
|
const plateNumber = Array.isArray(vehicle.plateNumber) ? vehicle.plateNumber[0] : vehicle.plateNumber;
|
|
@@ -14933,7 +14930,7 @@ function useVehicleRepo() {
|
|
|
14933
14930
|
return {
|
|
14934
14931
|
updateOne: {
|
|
14935
14932
|
filter: {
|
|
14936
|
-
site: vehicle.site,
|
|
14933
|
+
site: new ObjectId43(vehicle.site),
|
|
14937
14934
|
plateNumber,
|
|
14938
14935
|
$or: [
|
|
14939
14936
|
{ deletedAt: "" },
|
|
@@ -14944,6 +14941,9 @@ function useVehicleRepo() {
|
|
|
14944
14941
|
update: {
|
|
14945
14942
|
$set: {
|
|
14946
14943
|
...rest,
|
|
14944
|
+
site: new ObjectId43(vehicle.site),
|
|
14945
|
+
unit: vehicle.unit ? new ObjectId43(vehicle.unit) : null,
|
|
14946
|
+
org: vehicle.org ? new ObjectId43(vehicle.org) : null,
|
|
14947
14947
|
plateNumber,
|
|
14948
14948
|
updatedAt: now
|
|
14949
14949
|
},
|
|
@@ -14955,10 +14955,7 @@ function useVehicleRepo() {
|
|
|
14955
14955
|
}
|
|
14956
14956
|
};
|
|
14957
14957
|
});
|
|
14958
|
-
const res = await collection.bulkWrite(operations
|
|
14959
|
-
ordered: false,
|
|
14960
|
-
session
|
|
14961
|
-
});
|
|
14958
|
+
const res = await collection.bulkWrite(operations);
|
|
14962
14959
|
return {
|
|
14963
14960
|
matchedCount: res.matchedCount,
|
|
14964
14961
|
modifiedCount: res.modifiedCount,
|
|
@@ -15007,10 +15004,10 @@ import {
|
|
|
15007
15004
|
BadRequestError as BadRequestError70,
|
|
15008
15005
|
InternalServerError as InternalServerError26,
|
|
15009
15006
|
logger as logger51,
|
|
15010
|
-
makeCacheKey as
|
|
15007
|
+
makeCacheKey as makeCacheKey24,
|
|
15011
15008
|
paginate as paginate20,
|
|
15012
15009
|
useAtlas as useAtlas33,
|
|
15013
|
-
useCache as
|
|
15010
|
+
useCache as useCache25,
|
|
15014
15011
|
AppError as AppError10,
|
|
15015
15012
|
toObjectId as toObjectId10
|
|
15016
15013
|
} from "@7365admin1/node-server-utils";
|
|
@@ -15022,7 +15019,7 @@ function usePersonRepo() {
|
|
|
15022
15019
|
throw new InternalServerError26("Unable to connect to server.");
|
|
15023
15020
|
}
|
|
15024
15021
|
const collection = db.collection(site_people_namespace_collection);
|
|
15025
|
-
const { delNamespace, getCache, setCache } =
|
|
15022
|
+
const { delNamespace, getCache, setCache } = useCache25(
|
|
15026
15023
|
site_people_namespace_collection
|
|
15027
15024
|
);
|
|
15028
15025
|
async function createIndexes() {
|
|
@@ -15123,7 +15120,7 @@ function usePersonRepo() {
|
|
|
15123
15120
|
...query.site && { site: query.site.toString() },
|
|
15124
15121
|
...PERSON_TYPES.includes(type) && { type }
|
|
15125
15122
|
};
|
|
15126
|
-
const cacheKey =
|
|
15123
|
+
const cacheKey = makeCacheKey24(
|
|
15127
15124
|
site_people_namespace_collection,
|
|
15128
15125
|
cacheOptions
|
|
15129
15126
|
);
|
|
@@ -15218,7 +15215,7 @@ function usePersonRepo() {
|
|
|
15218
15215
|
} catch (error) {
|
|
15219
15216
|
throw new BadRequestError70("Invalid person ID.");
|
|
15220
15217
|
}
|
|
15221
|
-
const cacheKey =
|
|
15218
|
+
const cacheKey = makeCacheKey24(site_people_namespace_collection, {
|
|
15222
15219
|
_id: String(_id)
|
|
15223
15220
|
});
|
|
15224
15221
|
try {
|
|
@@ -15254,7 +15251,7 @@ function usePersonRepo() {
|
|
|
15254
15251
|
}
|
|
15255
15252
|
}
|
|
15256
15253
|
async function getPersonByPlateNumber(plateNumber) {
|
|
15257
|
-
const cacheKey =
|
|
15254
|
+
const cacheKey = makeCacheKey24(site_people_namespace_collection, {
|
|
15258
15255
|
plateNumber,
|
|
15259
15256
|
key: "get-person-plate-number"
|
|
15260
15257
|
});
|
|
@@ -15282,7 +15279,7 @@ function usePersonRepo() {
|
|
|
15282
15279
|
}
|
|
15283
15280
|
async function getByNRIC(value) {
|
|
15284
15281
|
try {
|
|
15285
|
-
const cacheKey =
|
|
15282
|
+
const cacheKey = makeCacheKey24(site_people_namespace_collection, {
|
|
15286
15283
|
nric: value
|
|
15287
15284
|
});
|
|
15288
15285
|
const cachedData = await getCache(cacheKey);
|
|
@@ -15303,7 +15300,7 @@ function usePersonRepo() {
|
|
|
15303
15300
|
}
|
|
15304
15301
|
async function getPersonByPhoneNumber(value) {
|
|
15305
15302
|
try {
|
|
15306
|
-
const cacheKey =
|
|
15303
|
+
const cacheKey = makeCacheKey24(site_people_namespace_collection, {
|
|
15307
15304
|
contact: value
|
|
15308
15305
|
});
|
|
15309
15306
|
const cachedData = await getCache(cacheKey);
|
|
@@ -15329,7 +15326,7 @@ function usePersonRepo() {
|
|
|
15329
15326
|
type = [],
|
|
15330
15327
|
unit
|
|
15331
15328
|
}, session) {
|
|
15332
|
-
const cacheKey =
|
|
15329
|
+
const cacheKey = makeCacheKey24(site_people_namespace_collection, {
|
|
15333
15330
|
unit: JSON.stringify(unit),
|
|
15334
15331
|
status,
|
|
15335
15332
|
type,
|
|
@@ -15363,7 +15360,7 @@ function usePersonRepo() {
|
|
|
15363
15360
|
}
|
|
15364
15361
|
async function getCompany(search) {
|
|
15365
15362
|
try {
|
|
15366
|
-
const cacheKey =
|
|
15363
|
+
const cacheKey = makeCacheKey24(site_people_namespace_collection, {
|
|
15367
15364
|
company: search
|
|
15368
15365
|
});
|
|
15369
15366
|
const cachedData = await getCache(cacheKey);
|
|
@@ -15422,7 +15419,7 @@ function usePersonRepo() {
|
|
|
15422
15419
|
}
|
|
15423
15420
|
}
|
|
15424
15421
|
async function getPeopleByPlateNumber(plateNumber) {
|
|
15425
|
-
const cacheKey =
|
|
15422
|
+
const cacheKey = makeCacheKey24(site_people_namespace_collection, {
|
|
15426
15423
|
plateNumber,
|
|
15427
15424
|
key: "get-people-plate-number"
|
|
15428
15425
|
});
|
|
@@ -15468,7 +15465,7 @@ function usePersonRepo() {
|
|
|
15468
15465
|
sort: JSON.stringify(sort)
|
|
15469
15466
|
};
|
|
15470
15467
|
try {
|
|
15471
|
-
const cacheKey =
|
|
15468
|
+
const cacheKey = makeCacheKey24(
|
|
15472
15469
|
site_people_namespace_collection,
|
|
15473
15470
|
cacheOptions
|
|
15474
15471
|
);
|
|
@@ -15552,7 +15549,7 @@ function usePersonRepo() {
|
|
|
15552
15549
|
}
|
|
15553
15550
|
async function getByUserId(userId) {
|
|
15554
15551
|
const user = toObjectId10(userId);
|
|
15555
|
-
const cacheKey =
|
|
15552
|
+
const cacheKey = makeCacheKey24(site_people_namespace_collection, {
|
|
15556
15553
|
user: userId
|
|
15557
15554
|
});
|
|
15558
15555
|
try {
|
|
@@ -15617,11 +15614,11 @@ import {
|
|
|
15617
15614
|
BadRequestError as BadRequestError72,
|
|
15618
15615
|
InternalServerError as InternalServerError27,
|
|
15619
15616
|
logger as logger53,
|
|
15620
|
-
makeCacheKey as
|
|
15617
|
+
makeCacheKey as makeCacheKey25,
|
|
15621
15618
|
paginate as paginate21,
|
|
15622
15619
|
toObjectId as toObjectId11,
|
|
15623
15620
|
useAtlas as useAtlas34,
|
|
15624
|
-
useCache as
|
|
15621
|
+
useCache as useCache26
|
|
15625
15622
|
} from "@7365admin1/node-server-utils";
|
|
15626
15623
|
|
|
15627
15624
|
// src/models/building.model.ts
|
|
@@ -15821,7 +15818,7 @@ function useBuildingUnitRepo() {
|
|
|
15821
15818
|
}
|
|
15822
15819
|
const namespace_collection = "building-units";
|
|
15823
15820
|
const collection = db.collection(namespace_collection);
|
|
15824
|
-
const { getCache, setCache, delNamespace, delCache } =
|
|
15821
|
+
const { getCache, setCache, delNamespace, delCache } = useCache26(namespace_collection);
|
|
15825
15822
|
async function createIndexes() {
|
|
15826
15823
|
try {
|
|
15827
15824
|
await collection.createIndexes([
|
|
@@ -15999,7 +15996,7 @@ function useBuildingUnitRepo() {
|
|
|
15999
15996
|
...building && { building },
|
|
16000
15997
|
...status && { status }
|
|
16001
15998
|
};
|
|
16002
|
-
const cacheKey =
|
|
15999
|
+
const cacheKey = makeCacheKey25(namespace_collection, cacheParams);
|
|
16003
16000
|
logger53.log({
|
|
16004
16001
|
level: "info",
|
|
16005
16002
|
message: `Cache key for getAll building units: ${cacheKey}`
|
|
@@ -16070,7 +16067,7 @@ function useBuildingUnitRepo() {
|
|
|
16070
16067
|
} catch (error) {
|
|
16071
16068
|
throw new BadRequestError72("Invalid ID.");
|
|
16072
16069
|
}
|
|
16073
|
-
const cacheKey =
|
|
16070
|
+
const cacheKey = makeCacheKey25(namespace_collection, { _id: String(_id) });
|
|
16074
16071
|
try {
|
|
16075
16072
|
const cached = await getCache(cacheKey);
|
|
16076
16073
|
if (cached) {
|
|
@@ -16113,7 +16110,7 @@ function useBuildingUnitRepo() {
|
|
|
16113
16110
|
} catch (error) {
|
|
16114
16111
|
throw new BadRequestError72("Invalid building ID.");
|
|
16115
16112
|
}
|
|
16116
|
-
const cacheKey =
|
|
16113
|
+
const cacheKey = makeCacheKey25(namespace_collection, {
|
|
16117
16114
|
building: String(building),
|
|
16118
16115
|
level
|
|
16119
16116
|
});
|
|
@@ -16187,7 +16184,7 @@ function useBuildingUnitRepo() {
|
|
|
16187
16184
|
} catch (error) {
|
|
16188
16185
|
throw new BadRequestError72("Invalid building ID.");
|
|
16189
16186
|
}
|
|
16190
|
-
const cacheKey =
|
|
16187
|
+
const cacheKey = makeCacheKey25(namespace_collection, {
|
|
16191
16188
|
building: String(building)
|
|
16192
16189
|
});
|
|
16193
16190
|
try {
|
|
@@ -16261,7 +16258,7 @@ function useBuildingUnitRepo() {
|
|
|
16261
16258
|
block,
|
|
16262
16259
|
level
|
|
16263
16260
|
};
|
|
16264
|
-
const cacheKey =
|
|
16261
|
+
const cacheKey = makeCacheKey25(namespace_collection, cacheOptions);
|
|
16265
16262
|
const cachedData = await getCache(cacheKey);
|
|
16266
16263
|
if (cachedData) {
|
|
16267
16264
|
logger53.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -16299,7 +16296,7 @@ function useBuildingUnitRepo() {
|
|
|
16299
16296
|
const cacheOptions = {
|
|
16300
16297
|
site: site.toString()
|
|
16301
16298
|
};
|
|
16302
|
-
const cacheKey =
|
|
16299
|
+
const cacheKey = makeCacheKey25(namespace_collection, cacheOptions);
|
|
16303
16300
|
const cachedData = await getCache(cacheKey);
|
|
16304
16301
|
if (cachedData) {
|
|
16305
16302
|
logger53.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -16347,7 +16344,7 @@ function useBuildingUnitRepo() {
|
|
|
16347
16344
|
{ deletedAt: "" }
|
|
16348
16345
|
]
|
|
16349
16346
|
};
|
|
16350
|
-
const cacheKey =
|
|
16347
|
+
const cacheKey = makeCacheKey25(namespace_collection, cacheOptions);
|
|
16351
16348
|
try {
|
|
16352
16349
|
const cached = await getCache(cacheKey);
|
|
16353
16350
|
if (cached) {
|
|
@@ -17051,15 +17048,11 @@ function useVehicleService() {
|
|
|
17051
17048
|
}
|
|
17052
17049
|
}
|
|
17053
17050
|
async function bulkUpsertVehicles(values, site, org) {
|
|
17054
|
-
const session = useAtlas35.getClient()?.startSession();
|
|
17055
|
-
if (!session) {
|
|
17056
|
-
throw new Error("Unable to start session for vehicle service.");
|
|
17057
|
-
}
|
|
17058
17051
|
try {
|
|
17059
17052
|
if (!Array.isArray(values) || values.length === 0) {
|
|
17060
17053
|
throw new Error("Vehicle list is required.");
|
|
17061
17054
|
}
|
|
17062
|
-
const now =
|
|
17055
|
+
const now = /* @__PURE__ */ new Date();
|
|
17063
17056
|
const sanitizedValues = (await Promise.all(
|
|
17064
17057
|
values.map(async (item) => {
|
|
17065
17058
|
const plateNumber = Array.isArray(item.plateNumber) ? item.plateNumber[0] : item.plateNumber;
|
|
@@ -17074,7 +17067,7 @@ function useVehicleService() {
|
|
|
17074
17067
|
...item,
|
|
17075
17068
|
org,
|
|
17076
17069
|
site,
|
|
17077
|
-
start:
|
|
17070
|
+
start: now.toISOString(),
|
|
17078
17071
|
unit: unitId,
|
|
17079
17072
|
plateNumber: typeof plateNumber === "string" ? plateNumber.trim().toUpperCase() : plateNumber
|
|
17080
17073
|
};
|
|
@@ -17104,33 +17097,36 @@ function useVehicleService() {
|
|
|
17104
17097
|
if (!siteCameras.length) {
|
|
17105
17098
|
throw new Error("No site cameras found.");
|
|
17106
17099
|
}
|
|
17107
|
-
|
|
17108
|
-
|
|
17109
|
-
|
|
17110
|
-
|
|
17111
|
-
const
|
|
17112
|
-
|
|
17113
|
-
|
|
17114
|
-
|
|
17115
|
-
|
|
17116
|
-
|
|
17117
|
-
|
|
17118
|
-
|
|
17119
|
-
|
|
17120
|
-
|
|
17121
|
-
|
|
17122
|
-
|
|
17123
|
-
|
|
17124
|
-
|
|
17125
|
-
|
|
17126
|
-
|
|
17127
|
-
|
|
17128
|
-
|
|
17129
|
-
|
|
17100
|
+
await Promise.all(
|
|
17101
|
+
sanitizedValues.map(async (vehicleValue) => {
|
|
17102
|
+
const plateNumber = vehicleValue.plateNumber;
|
|
17103
|
+
const _mode = vehicleValue.type === "whitelist" /* WHITELIST */ ? "TrafficRedList" /* TRAFFIC_REDLIST */ : "TrafficBlackList" /* TRAFFIC_BLACKLIST */;
|
|
17104
|
+
const recNos = await Promise.all(
|
|
17105
|
+
siteCameras.map(async (camera) => {
|
|
17106
|
+
const { host, username, password } = camera;
|
|
17107
|
+
const dahuaPayload = {
|
|
17108
|
+
host,
|
|
17109
|
+
username,
|
|
17110
|
+
password,
|
|
17111
|
+
plateNumber,
|
|
17112
|
+
mode: _mode,
|
|
17113
|
+
...vehicleValue.start ? { start: String(vehicleValue.start) } : {},
|
|
17114
|
+
...vehicleValue.end ? { end: String(vehicleValue.end) } : {},
|
|
17115
|
+
...vehicleValue.name ? { owner: vehicleValue.name } : {},
|
|
17116
|
+
...vehicleValue.vehicleModel ? { vehicleType: vehicleValue.vehicleModel } : {},
|
|
17117
|
+
...vehicleValue.vehicleColor ? { vehicleColor: vehicleValue.vehicleColor } : {}
|
|
17118
|
+
};
|
|
17119
|
+
const dahuaResponse = await _bulkInsertPlateNumber(dahuaPayload);
|
|
17120
|
+
const responseData = dahuaResponse?.data?.toString("utf-8") ?? "";
|
|
17121
|
+
return responseData.split("=")[1]?.trim();
|
|
17122
|
+
})
|
|
17123
|
+
);
|
|
17124
|
+
vehicleValue.recNo = recNos.find((r) => r) ?? void 0;
|
|
17125
|
+
})
|
|
17126
|
+
);
|
|
17127
|
+
return await _bulkUpsertVehicles(sanitizedValues);
|
|
17130
17128
|
} catch (error) {
|
|
17131
17129
|
throw error;
|
|
17132
|
-
} finally {
|
|
17133
|
-
session.endSession();
|
|
17134
17130
|
}
|
|
17135
17131
|
}
|
|
17136
17132
|
return {
|
|
@@ -18194,7 +18190,7 @@ function MChat(value) {
|
|
|
18194
18190
|
import {
|
|
18195
18191
|
useAtlas as useAtlas37,
|
|
18196
18192
|
InternalServerError as InternalServerError28,
|
|
18197
|
-
useCache as
|
|
18193
|
+
useCache as useCache27,
|
|
18198
18194
|
logger as logger59
|
|
18199
18195
|
} from "@7365admin1/node-server-utils";
|
|
18200
18196
|
function useChatRepo() {
|
|
@@ -18204,7 +18200,7 @@ function useChatRepo() {
|
|
|
18204
18200
|
}
|
|
18205
18201
|
const namespace_collection = "chats";
|
|
18206
18202
|
const collection = db.collection(namespace_collection);
|
|
18207
|
-
const { delNamespace } =
|
|
18203
|
+
const { delNamespace } = useCache27(namespace_collection);
|
|
18208
18204
|
async function createChat(value, session) {
|
|
18209
18205
|
try {
|
|
18210
18206
|
value = MChat(value);
|
|
@@ -18258,10 +18254,10 @@ import {
|
|
|
18258
18254
|
BadRequestError as BadRequestError79,
|
|
18259
18255
|
InternalServerError as InternalServerError29,
|
|
18260
18256
|
logger as logger61,
|
|
18261
|
-
makeCacheKey as
|
|
18257
|
+
makeCacheKey as makeCacheKey26,
|
|
18262
18258
|
paginate as paginate22,
|
|
18263
18259
|
useAtlas as useAtlas38,
|
|
18264
|
-
useCache as
|
|
18260
|
+
useCache as useCache28
|
|
18265
18261
|
} from "@7365admin1/node-server-utils";
|
|
18266
18262
|
import { ObjectId as ObjectId49 } from "mongodb";
|
|
18267
18263
|
var buildings_namespace_collection = "buildings";
|
|
@@ -18271,7 +18267,7 @@ function useBuildingRepo() {
|
|
|
18271
18267
|
throw new Error("Unable to connect to server.");
|
|
18272
18268
|
}
|
|
18273
18269
|
const collection = db.collection(buildings_namespace_collection);
|
|
18274
|
-
const { getCache, setCache, delNamespace } =
|
|
18270
|
+
const { getCache, setCache, delNamespace } = useCache28(
|
|
18275
18271
|
buildings_namespace_collection
|
|
18276
18272
|
);
|
|
18277
18273
|
async function createIndexes() {
|
|
@@ -18382,7 +18378,7 @@ function useBuildingRepo() {
|
|
|
18382
18378
|
...site && { site },
|
|
18383
18379
|
...status && { status }
|
|
18384
18380
|
};
|
|
18385
|
-
const cacheKey =
|
|
18381
|
+
const cacheKey = makeCacheKey26(buildings_namespace_collection, cacheParams);
|
|
18386
18382
|
logger61.log({
|
|
18387
18383
|
level: "info",
|
|
18388
18384
|
message: `Cache key for getAll buildings: ${cacheKey}`
|
|
@@ -18427,7 +18423,7 @@ function useBuildingRepo() {
|
|
|
18427
18423
|
} catch (error) {
|
|
18428
18424
|
throw new BadRequestError79("Invalid ID.");
|
|
18429
18425
|
}
|
|
18430
|
-
const cacheKey =
|
|
18426
|
+
const cacheKey = makeCacheKey26(buildings_namespace_collection, {
|
|
18431
18427
|
_id: String(_id)
|
|
18432
18428
|
});
|
|
18433
18429
|
try {
|
|
@@ -18498,7 +18494,7 @@ function useBuildingRepo() {
|
|
|
18498
18494
|
block
|
|
18499
18495
|
};
|
|
18500
18496
|
const cacheOptions = { ...query };
|
|
18501
|
-
const cacheKey =
|
|
18497
|
+
const cacheKey = makeCacheKey26(buildings_namespace_collection, cacheOptions);
|
|
18502
18498
|
try {
|
|
18503
18499
|
const cached = await getCache(cacheKey);
|
|
18504
18500
|
if (cached) {
|
|
@@ -19188,6 +19184,7 @@ function useBuildingUnitController() {
|
|
|
19188
19184
|
import { BadRequestError as BadRequestError84, logger as logger66 } from "@7365admin1/node-server-utils";
|
|
19189
19185
|
import Joi46 from "joi";
|
|
19190
19186
|
import ExcelJS from "exceljs";
|
|
19187
|
+
import csv from "csv-parser";
|
|
19191
19188
|
import fs from "fs";
|
|
19192
19189
|
function useVehicleController() {
|
|
19193
19190
|
const {
|
|
@@ -19232,8 +19229,15 @@ function useVehicleController() {
|
|
|
19232
19229
|
};
|
|
19233
19230
|
}
|
|
19234
19231
|
function parseExpiryDate(value) {
|
|
19235
|
-
if (!value)
|
|
19236
|
-
|
|
19232
|
+
if (!value) {
|
|
19233
|
+
const today = /* @__PURE__ */ new Date();
|
|
19234
|
+
today.setFullYear(today.getFullYear() + 10);
|
|
19235
|
+
return today.toISOString();
|
|
19236
|
+
}
|
|
19237
|
+
const date = new Date(value);
|
|
19238
|
+
if (!isNaN(date.getTime())) {
|
|
19239
|
+
return date.toISOString();
|
|
19240
|
+
}
|
|
19237
19241
|
const [day, monthStr, yearShort] = value.split("-");
|
|
19238
19242
|
const months = {
|
|
19239
19243
|
Jan: 0,
|
|
@@ -19253,19 +19257,17 @@ function useVehicleController() {
|
|
|
19253
19257
|
if (month === void 0)
|
|
19254
19258
|
return void 0;
|
|
19255
19259
|
const year = 2e3 + Number(yearShort);
|
|
19256
|
-
const
|
|
19257
|
-
return isNaN(
|
|
19260
|
+
const fallbackDate = new Date(year, month, Number(day));
|
|
19261
|
+
return isNaN(fallbackDate.getTime()) ? void 0 : fallbackDate.toISOString();
|
|
19258
19262
|
}
|
|
19259
|
-
async function
|
|
19263
|
+
async function uploadSpreadsheetVehicles(req, res, next) {
|
|
19260
19264
|
try {
|
|
19261
19265
|
if (!req.file) {
|
|
19262
|
-
next(new BadRequestError84("
|
|
19263
|
-
return;
|
|
19264
|
-
}
|
|
19265
|
-
if (!req.file.originalname.toLowerCase().endsWith(".xlsx")) {
|
|
19266
|
-
next(new BadRequestError84("Only .xlsx files are allowed."));
|
|
19266
|
+
next(new BadRequestError84("Spreadsheet file is required."));
|
|
19267
19267
|
return;
|
|
19268
19268
|
}
|
|
19269
|
+
const { originalname, path: path4 } = req.file;
|
|
19270
|
+
const lowerName = originalname.toLowerCase();
|
|
19269
19271
|
const rowSchema = Joi46.object({
|
|
19270
19272
|
fullName: Joi46.string().trim().required(),
|
|
19271
19273
|
userType: Joi46.string().trim().required(),
|
|
@@ -19277,7 +19279,11 @@ function useVehicleController() {
|
|
|
19277
19279
|
plateNumber: Joi46.string().trim().uppercase().required(),
|
|
19278
19280
|
vehicleModel: Joi46.string().trim().allow("", null).optional(),
|
|
19279
19281
|
vehicleColor: Joi46.string().trim().allow("", null).optional(),
|
|
19280
|
-
subscriptionExpiry: Joi46.
|
|
19282
|
+
subscriptionExpiry: Joi46.alternatives().try(
|
|
19283
|
+
Joi46.date().iso(),
|
|
19284
|
+
// ISO format
|
|
19285
|
+
Joi46.string().pattern(/^\d{1,2}-[A-Za-z]{3}-\d{2}$/)
|
|
19286
|
+
).allow("", null).optional()
|
|
19281
19287
|
});
|
|
19282
19288
|
const querySchema = Joi46.object({
|
|
19283
19289
|
site: Joi46.string().hex().length(24).required(),
|
|
@@ -19285,10 +19291,7 @@ function useVehicleController() {
|
|
|
19285
19291
|
});
|
|
19286
19292
|
const { error: queryError, value: queryValue } = querySchema.validate(
|
|
19287
19293
|
req.query,
|
|
19288
|
-
{
|
|
19289
|
-
abortEarly: false,
|
|
19290
|
-
convert: true
|
|
19291
|
-
}
|
|
19294
|
+
{ abortEarly: false, convert: true }
|
|
19292
19295
|
);
|
|
19293
19296
|
if (queryError) {
|
|
19294
19297
|
next(
|
|
@@ -19299,30 +19302,43 @@ function useVehicleController() {
|
|
|
19299
19302
|
return;
|
|
19300
19303
|
}
|
|
19301
19304
|
const { site, org } = queryValue;
|
|
19302
|
-
|
|
19303
|
-
|
|
19304
|
-
|
|
19305
|
-
|
|
19306
|
-
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
const headers = (headerRow.values || []).slice(1).map((header) => String(header ?? "").trim());
|
|
19312
|
-
worksheet.eachRow((row, rowNumber) => {
|
|
19313
|
-
if (rowNumber === 1)
|
|
19305
|
+
let rows = [];
|
|
19306
|
+
if (lowerName.endsWith(".xlsx") || lowerName.endsWith(".xls")) {
|
|
19307
|
+
const workbook = new ExcelJS.Workbook();
|
|
19308
|
+
await workbook.xlsx.readFile(path4);
|
|
19309
|
+
const worksheet = workbook.worksheets[0];
|
|
19310
|
+
if (!worksheet) {
|
|
19311
|
+
next(
|
|
19312
|
+
new BadRequestError84("No worksheet found in uploaded Excel file.")
|
|
19313
|
+
);
|
|
19314
19314
|
return;
|
|
19315
|
-
|
|
19316
|
-
|
|
19317
|
-
|
|
19315
|
+
}
|
|
19316
|
+
const headerRow = worksheet.getRow(1);
|
|
19317
|
+
const headers = (headerRow.values || []).slice(1).map((header) => String(header ?? "").trim());
|
|
19318
|
+
worksheet.eachRow((row, rowNumber) => {
|
|
19319
|
+
if (rowNumber === 1)
|
|
19320
|
+
return;
|
|
19321
|
+
const rowData = {};
|
|
19322
|
+
headers.forEach((header, index) => {
|
|
19323
|
+
rowData[header] = row.getCell(index + 1).value ?? "";
|
|
19324
|
+
});
|
|
19325
|
+
if (Object.values(rowData).some(
|
|
19326
|
+
(v) => v !== "" && v !== null && v !== void 0
|
|
19327
|
+
)) {
|
|
19328
|
+
rows.push(rowData);
|
|
19329
|
+
}
|
|
19318
19330
|
});
|
|
19319
|
-
|
|
19320
|
-
|
|
19331
|
+
} else if (lowerName.endsWith(".csv")) {
|
|
19332
|
+
rows = await new Promise((resolve, reject) => {
|
|
19333
|
+
const parsed = [];
|
|
19334
|
+
fs.createReadStream(path4).pipe(csv()).on("data", (row) => parsed.push(row)).on("end", () => resolve(parsed)).on("error", reject);
|
|
19335
|
+
});
|
|
19336
|
+
} else {
|
|
19337
|
+
next(
|
|
19338
|
+
new BadRequestError84("Only .xlsx, .xls, or .csv files are allowed.")
|
|
19321
19339
|
);
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
}
|
|
19325
|
-
});
|
|
19340
|
+
return;
|
|
19341
|
+
}
|
|
19326
19342
|
const validRows = [];
|
|
19327
19343
|
const invalidRows = [];
|
|
19328
19344
|
rows.forEach((row, index) => {
|
|
@@ -19336,9 +19352,9 @@ function useVehicleController() {
|
|
|
19336
19352
|
data: row,
|
|
19337
19353
|
errors: error.details.map((d) => d.message)
|
|
19338
19354
|
});
|
|
19339
|
-
|
|
19355
|
+
} else {
|
|
19356
|
+
validRows.push(value);
|
|
19340
19357
|
}
|
|
19341
|
-
validRows.push(value);
|
|
19342
19358
|
});
|
|
19343
19359
|
const vehicles = validRows.map((row) => mapRowToVehicle(row, site, org));
|
|
19344
19360
|
let data = {};
|
|
@@ -19346,15 +19362,15 @@ function useVehicleController() {
|
|
|
19346
19362
|
data = await _bulkUpsertVehicles(vehicles, site, org);
|
|
19347
19363
|
}
|
|
19348
19364
|
res.status(200).json({
|
|
19349
|
-
message: "
|
|
19350
|
-
|
|
19365
|
+
message: "Spreadsheet import completed.",
|
|
19366
|
+
fileName: originalname,
|
|
19351
19367
|
totalRows: rows.length,
|
|
19352
19368
|
validRows: validRows.length,
|
|
19353
19369
|
invalidRows: invalidRows.length,
|
|
19354
19370
|
validationErrors: invalidRows,
|
|
19355
19371
|
data
|
|
19356
19372
|
});
|
|
19357
|
-
fs.unlink(
|
|
19373
|
+
fs.unlink(path4, () => {
|
|
19358
19374
|
});
|
|
19359
19375
|
} catch (error) {
|
|
19360
19376
|
logger66.log({ level: "error", message: error.message });
|
|
@@ -19696,8 +19712,7 @@ function useVehicleController() {
|
|
|
19696
19712
|
getVehiclesByNRIC,
|
|
19697
19713
|
reactivateVehicleById,
|
|
19698
19714
|
getAllVehiclesByUnitId,
|
|
19699
|
-
|
|
19700
|
-
uploadExcelVehicles
|
|
19715
|
+
uploadSpreadsheetVehicles
|
|
19701
19716
|
};
|
|
19702
19717
|
}
|
|
19703
19718
|
|
|
@@ -19942,10 +19957,10 @@ import {
|
|
|
19942
19957
|
BadRequestError as BadRequestError87,
|
|
19943
19958
|
InternalServerError as InternalServerError30,
|
|
19944
19959
|
logger as logger68,
|
|
19945
|
-
makeCacheKey as
|
|
19960
|
+
makeCacheKey as makeCacheKey27,
|
|
19946
19961
|
paginate as paginate23,
|
|
19947
19962
|
useAtlas as useAtlas42,
|
|
19948
|
-
useCache as
|
|
19963
|
+
useCache as useCache29
|
|
19949
19964
|
} from "@7365admin1/node-server-utils";
|
|
19950
19965
|
import { ObjectId as ObjectId51 } from "mongodb";
|
|
19951
19966
|
import Joi49 from "joi";
|
|
@@ -19956,7 +19971,7 @@ function useCustomerSiteRepo() {
|
|
|
19956
19971
|
}
|
|
19957
19972
|
const namespace_collection = "customer.sites";
|
|
19958
19973
|
const collection = db.collection(namespace_collection);
|
|
19959
|
-
const { delNamespace, getCache, setCache } =
|
|
19974
|
+
const { delNamespace, getCache, setCache } = useCache29(namespace_collection);
|
|
19960
19975
|
async function createIndexes() {
|
|
19961
19976
|
try {
|
|
19962
19977
|
await collection.createIndexes([
|
|
@@ -20016,7 +20031,7 @@ function useCustomerSiteRepo() {
|
|
|
20016
20031
|
throw new BadRequestError87("Invalid org ID.");
|
|
20017
20032
|
}
|
|
20018
20033
|
}
|
|
20019
|
-
const cacheKey =
|
|
20034
|
+
const cacheKey = makeCacheKey27(namespace_collection, cacheKeyOptions);
|
|
20020
20035
|
try {
|
|
20021
20036
|
const cachedData = await getCache(cacheKey);
|
|
20022
20037
|
if (cachedData) {
|
|
@@ -20068,7 +20083,7 @@ function useCustomerSiteRepo() {
|
|
|
20068
20083
|
query.$or = [{ name: { $regex: search, $options: "i" } }];
|
|
20069
20084
|
cacheOptions.search = search;
|
|
20070
20085
|
}
|
|
20071
|
-
const cacheKey =
|
|
20086
|
+
const cacheKey = makeCacheKey27(namespace_collection, cacheOptions);
|
|
20072
20087
|
const cachedData = await getCache(cacheKey);
|
|
20073
20088
|
if (cachedData) {
|
|
20074
20089
|
logger68.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -20118,7 +20133,7 @@ function useCustomerSiteRepo() {
|
|
|
20118
20133
|
}
|
|
20119
20134
|
try {
|
|
20120
20135
|
const query = { site, status: "active" };
|
|
20121
|
-
const cacheKey =
|
|
20136
|
+
const cacheKey = makeCacheKey27(namespace_collection, {
|
|
20122
20137
|
site: site.toString(),
|
|
20123
20138
|
status: "active",
|
|
20124
20139
|
tag: "get-by-site-as-sp"
|
|
@@ -20533,9 +20548,9 @@ import {
|
|
|
20533
20548
|
useAtlas as useAtlas44,
|
|
20534
20549
|
InternalServerError as InternalServerError31,
|
|
20535
20550
|
BadRequestError as BadRequestError91,
|
|
20536
|
-
useCache as
|
|
20551
|
+
useCache as useCache30,
|
|
20537
20552
|
logger as logger71,
|
|
20538
|
-
makeCacheKey as
|
|
20553
|
+
makeCacheKey as makeCacheKey28,
|
|
20539
20554
|
NotFoundError as NotFoundError21
|
|
20540
20555
|
} from "@7365admin1/node-server-utils";
|
|
20541
20556
|
function useAttendanceSettingsRepository() {
|
|
@@ -20545,7 +20560,7 @@ function useAttendanceSettingsRepository() {
|
|
|
20545
20560
|
}
|
|
20546
20561
|
const namespace_collection = "site.attendance-settings";
|
|
20547
20562
|
const collection = db.collection(namespace_collection);
|
|
20548
|
-
const { delNamespace, setCache, getCache } =
|
|
20563
|
+
const { delNamespace, setCache, getCache } = useCache30(namespace_collection);
|
|
20549
20564
|
async function createIndex() {
|
|
20550
20565
|
try {
|
|
20551
20566
|
await collection.createIndexes([
|
|
@@ -20582,7 +20597,7 @@ function useAttendanceSettingsRepository() {
|
|
|
20582
20597
|
throw new BadRequestError91("Invalid attendance settings site ID format.");
|
|
20583
20598
|
}
|
|
20584
20599
|
const query = { site, serviceType };
|
|
20585
|
-
const cacheKey =
|
|
20600
|
+
const cacheKey = makeCacheKey28(namespace_collection, {
|
|
20586
20601
|
site: site.toString(),
|
|
20587
20602
|
serviceType
|
|
20588
20603
|
});
|
|
@@ -20814,9 +20829,9 @@ import {
|
|
|
20814
20829
|
InternalServerError as InternalServerError32,
|
|
20815
20830
|
paginate as paginate24,
|
|
20816
20831
|
BadRequestError as BadRequestError94,
|
|
20817
|
-
useCache as
|
|
20832
|
+
useCache as useCache31,
|
|
20818
20833
|
logger as logger75,
|
|
20819
|
-
makeCacheKey as
|
|
20834
|
+
makeCacheKey as makeCacheKey29,
|
|
20820
20835
|
NotFoundError as NotFoundError22
|
|
20821
20836
|
} from "@7365admin1/node-server-utils";
|
|
20822
20837
|
function useAttendanceRepository() {
|
|
@@ -20826,7 +20841,7 @@ function useAttendanceRepository() {
|
|
|
20826
20841
|
}
|
|
20827
20842
|
const namespace_collection = "site.attendances";
|
|
20828
20843
|
const collection = db.collection(namespace_collection);
|
|
20829
|
-
const { delNamespace, setCache, getCache, delCache } =
|
|
20844
|
+
const { delNamespace, setCache, getCache, delCache } = useCache31(namespace_collection);
|
|
20830
20845
|
async function createIndex() {
|
|
20831
20846
|
try {
|
|
20832
20847
|
await collection.createIndexes([
|
|
@@ -20879,7 +20894,7 @@ function useAttendanceRepository() {
|
|
|
20879
20894
|
if (search) {
|
|
20880
20895
|
cacheOptions.search = search;
|
|
20881
20896
|
}
|
|
20882
|
-
const cacheKey =
|
|
20897
|
+
const cacheKey = makeCacheKey29(namespace_collection, cacheOptions);
|
|
20883
20898
|
const cachedData = await getCache(cacheKey);
|
|
20884
20899
|
if (cachedData) {
|
|
20885
20900
|
logger75.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -20983,7 +20998,7 @@ function useAttendanceRepository() {
|
|
|
20983
20998
|
if (search) {
|
|
20984
20999
|
cacheOptions.search = search;
|
|
20985
21000
|
}
|
|
20986
|
-
const cacheKey =
|
|
21001
|
+
const cacheKey = makeCacheKey29(namespace_collection, cacheOptions);
|
|
20987
21002
|
const cachedData = await getCache(cacheKey);
|
|
20988
21003
|
if (cachedData) {
|
|
20989
21004
|
logger75.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -21061,7 +21076,7 @@ function useAttendanceRepository() {
|
|
|
21061
21076
|
throw new BadRequestError94("Invalid attendance ID format.");
|
|
21062
21077
|
}
|
|
21063
21078
|
const query = { _id };
|
|
21064
|
-
const cacheKey =
|
|
21079
|
+
const cacheKey = makeCacheKey29(namespace_collection, {
|
|
21065
21080
|
_id: _id.toString()
|
|
21066
21081
|
});
|
|
21067
21082
|
if (!session) {
|
|
@@ -21114,7 +21129,7 @@ function useAttendanceRepository() {
|
|
|
21114
21129
|
throw new BadRequestError94("Invalid attendance ID format.");
|
|
21115
21130
|
}
|
|
21116
21131
|
const query = { _id };
|
|
21117
|
-
const cacheKey =
|
|
21132
|
+
const cacheKey = makeCacheKey29(namespace_collection, {
|
|
21118
21133
|
_id: _id.toString()
|
|
21119
21134
|
});
|
|
21120
21135
|
if (!session) {
|
|
@@ -21194,7 +21209,7 @@ function useAttendanceRepository() {
|
|
|
21194
21209
|
);
|
|
21195
21210
|
if (res.modifiedCount === 0)
|
|
21196
21211
|
throw new InternalServerError32("Unable to delete attendance.");
|
|
21197
|
-
const cacheKey =
|
|
21212
|
+
const cacheKey = makeCacheKey29(namespace_collection, { _id });
|
|
21198
21213
|
delCache(cacheKey).then(() => {
|
|
21199
21214
|
logger75.info(`Cache deleted for key: ${cacheKey}`);
|
|
21200
21215
|
}).catch((err) => {
|
|
@@ -22149,11 +22164,6 @@ var KeyRepo = class {
|
|
|
22149
22164
|
} else if (organization) {
|
|
22150
22165
|
defaultQuery = { organization };
|
|
22151
22166
|
}
|
|
22152
|
-
console.log("key-query: ", {
|
|
22153
|
-
...defaultQuery,
|
|
22154
|
-
...searchQuery,
|
|
22155
|
-
...dateFilter
|
|
22156
|
-
});
|
|
22157
22167
|
try {
|
|
22158
22168
|
const result = await this.collection().aggregate([
|
|
22159
22169
|
{
|
|
@@ -22666,14 +22676,28 @@ function useVisitorTransactionService() {
|
|
|
22666
22676
|
const host = camera.host;
|
|
22667
22677
|
const username = camera.username;
|
|
22668
22678
|
const password = camera.password;
|
|
22669
|
-
const
|
|
22679
|
+
const redlist = "TrafficRedList" /* TRAFFIC_REDLIST */;
|
|
22680
|
+
const blacklist = "TrafficBlackList" /* TRAFFIC_BLACKLIST */;
|
|
22670
22681
|
const _plateNumber = value.plateNumber;
|
|
22682
|
+
const dahuaBlocklistQuery = {
|
|
22683
|
+
host,
|
|
22684
|
+
username,
|
|
22685
|
+
password,
|
|
22686
|
+
plateNumber: _plateNumber,
|
|
22687
|
+
mode: blacklist
|
|
22688
|
+
};
|
|
22689
|
+
const isBlocklistedRaw = await _getPlateNumber(dahuaBlocklistQuery);
|
|
22690
|
+
const rawString = isBlocklistedRaw?.toString?.("utf-8") ?? String(isBlocklistedRaw);
|
|
22691
|
+
const foundMatch = rawString.match(/found=(\d+)/);
|
|
22692
|
+
const found = foundMatch ? Number(foundMatch[1]) : 0;
|
|
22693
|
+
if (found === 1)
|
|
22694
|
+
throw new BadRequestError97("This plate number is blocklisted");
|
|
22671
22695
|
const dahuaQuery = {
|
|
22672
22696
|
host,
|
|
22673
22697
|
username,
|
|
22674
22698
|
password,
|
|
22675
22699
|
plateNumber: _plateNumber,
|
|
22676
|
-
mode
|
|
22700
|
+
mode: redlist
|
|
22677
22701
|
};
|
|
22678
22702
|
const raw = await _getPlateNumber(dahuaQuery);
|
|
22679
22703
|
const parsed = parseDahuaFind(raw);
|
|
@@ -22683,7 +22707,7 @@ function useVisitorTransactionService() {
|
|
|
22683
22707
|
username,
|
|
22684
22708
|
password,
|
|
22685
22709
|
plateNumber: _plateNumber,
|
|
22686
|
-
mode,
|
|
22710
|
+
mode: redlist,
|
|
22687
22711
|
start: startDahuaDate,
|
|
22688
22712
|
end: endDahuaDate,
|
|
22689
22713
|
owner: value.name ?? "",
|
|
@@ -22719,7 +22743,7 @@ function useVisitorTransactionService() {
|
|
|
22719
22743
|
password,
|
|
22720
22744
|
plateNumber: _plateNumber,
|
|
22721
22745
|
recno: parsed.recNo,
|
|
22722
|
-
mode,
|
|
22746
|
+
mode: redlist,
|
|
22723
22747
|
start: startDahuaDate,
|
|
22724
22748
|
end: endDahuaDate,
|
|
22725
22749
|
owner: value.name ?? "",
|
|
@@ -23416,10 +23440,10 @@ import {
|
|
|
23416
23440
|
BadRequestError as BadRequestError99,
|
|
23417
23441
|
InternalServerError as InternalServerError33,
|
|
23418
23442
|
logger as logger80,
|
|
23419
|
-
makeCacheKey as
|
|
23443
|
+
makeCacheKey as makeCacheKey30,
|
|
23420
23444
|
paginate as paginate25,
|
|
23421
23445
|
useAtlas as useAtlas50,
|
|
23422
|
-
useCache as
|
|
23446
|
+
useCache as useCache32
|
|
23423
23447
|
} from "@7365admin1/node-server-utils";
|
|
23424
23448
|
import { ObjectId as ObjectId61 } from "mongodb";
|
|
23425
23449
|
var guests_namespace_collection = "visitor.guests";
|
|
@@ -23429,7 +23453,7 @@ function useGuestManagementRepo() {
|
|
|
23429
23453
|
throw new InternalServerError33("Unable to connect to server.");
|
|
23430
23454
|
}
|
|
23431
23455
|
const collection = db.collection(guests_namespace_collection);
|
|
23432
|
-
const { delNamespace, getCache, setCache } =
|
|
23456
|
+
const { delNamespace, getCache, setCache } = useCache32(
|
|
23433
23457
|
guests_namespace_collection
|
|
23434
23458
|
);
|
|
23435
23459
|
async function createTextIndex() {
|
|
@@ -23508,7 +23532,7 @@ function useGuestManagementRepo() {
|
|
|
23508
23532
|
...query.org && { org: query.org.toString() },
|
|
23509
23533
|
...query.site && { site: query.site.toString() }
|
|
23510
23534
|
};
|
|
23511
|
-
const cacheKey =
|
|
23535
|
+
const cacheKey = makeCacheKey30(guests_namespace_collection, cacheOptions);
|
|
23512
23536
|
const cachedData = await getCache(cacheKey);
|
|
23513
23537
|
if (cachedData) {
|
|
23514
23538
|
logger80.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -24145,7 +24169,6 @@ function usePersonController() {
|
|
|
24145
24169
|
}
|
|
24146
24170
|
async function getPeopleByUnit(req, res, next) {
|
|
24147
24171
|
const PERSON_TYPES3 = Object.values(PersonTypes);
|
|
24148
|
-
console.log(req.query);
|
|
24149
24172
|
try {
|
|
24150
24173
|
const schema2 = Joi58.object({
|
|
24151
24174
|
unit: Joi58.string().required(),
|
|
@@ -24389,8 +24412,8 @@ import {
|
|
|
24389
24412
|
InternalServerError as InternalServerError34,
|
|
24390
24413
|
paginate as paginate26,
|
|
24391
24414
|
BadRequestError as BadRequestError104,
|
|
24392
|
-
useCache as
|
|
24393
|
-
makeCacheKey as
|
|
24415
|
+
useCache as useCache33,
|
|
24416
|
+
makeCacheKey as makeCacheKey31,
|
|
24394
24417
|
logger as logger85
|
|
24395
24418
|
} from "@7365admin1/node-server-utils";
|
|
24396
24419
|
function useRobotRepo() {
|
|
@@ -24400,7 +24423,7 @@ function useRobotRepo() {
|
|
|
24400
24423
|
}
|
|
24401
24424
|
const namespace_collection = "robots";
|
|
24402
24425
|
const collection = db.collection(namespace_collection);
|
|
24403
|
-
const { delNamespace, getCache, setCache } =
|
|
24426
|
+
const { delNamespace, getCache, setCache } = useCache33(namespace_collection);
|
|
24404
24427
|
async function createIndex() {
|
|
24405
24428
|
try {
|
|
24406
24429
|
await collection.createIndexes([
|
|
@@ -24500,7 +24523,7 @@ function useRobotRepo() {
|
|
|
24500
24523
|
cacheOptions.from = from;
|
|
24501
24524
|
cacheOptions.to = to;
|
|
24502
24525
|
}
|
|
24503
|
-
const cacheKey =
|
|
24526
|
+
const cacheKey = makeCacheKey31(namespace_collection, cacheOptions);
|
|
24504
24527
|
const cachedData = await getCache(cacheKey);
|
|
24505
24528
|
if (cachedData) {
|
|
24506
24529
|
logger85.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -24729,10 +24752,10 @@ import {
|
|
|
24729
24752
|
BadRequestError as BadRequestError108,
|
|
24730
24753
|
InternalServerError as InternalServerError35,
|
|
24731
24754
|
logger as logger88,
|
|
24732
|
-
makeCacheKey as
|
|
24755
|
+
makeCacheKey as makeCacheKey32,
|
|
24733
24756
|
paginate as paginate27,
|
|
24734
24757
|
useAtlas as useAtlas54,
|
|
24735
|
-
useCache as
|
|
24758
|
+
useCache as useCache34
|
|
24736
24759
|
} from "@7365admin1/node-server-utils";
|
|
24737
24760
|
import { ObjectId as ObjectId65 } from "mongodb";
|
|
24738
24761
|
function usePatrolQuestionRepo() {
|
|
@@ -24742,7 +24765,7 @@ function usePatrolQuestionRepo() {
|
|
|
24742
24765
|
}
|
|
24743
24766
|
const namespace_collection = "patrol.questions";
|
|
24744
24767
|
const collection = db.collection(namespace_collection);
|
|
24745
|
-
const { delNamespace, getCache, setCache } =
|
|
24768
|
+
const { delNamespace, getCache, setCache } = useCache34(namespace_collection);
|
|
24746
24769
|
async function createIndexes() {
|
|
24747
24770
|
try {
|
|
24748
24771
|
await collection.createIndexes([
|
|
@@ -24828,7 +24851,7 @@ function usePatrolQuestionRepo() {
|
|
|
24828
24851
|
...search && { search },
|
|
24829
24852
|
...query.site && { site: query.site.toString() }
|
|
24830
24853
|
};
|
|
24831
|
-
const cacheKey =
|
|
24854
|
+
const cacheKey = makeCacheKey32(namespace_collection, cacheOptions);
|
|
24832
24855
|
const cachedData = await getCache(cacheKey);
|
|
24833
24856
|
if (cachedData) {
|
|
24834
24857
|
logger88.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -24904,7 +24927,7 @@ function usePatrolQuestionRepo() {
|
|
|
24904
24927
|
} catch (error) {
|
|
24905
24928
|
throw new BadRequestError108("Invalid patrol question ID format.");
|
|
24906
24929
|
}
|
|
24907
|
-
const cacheKey =
|
|
24930
|
+
const cacheKey = makeCacheKey32(namespace_collection, { _id });
|
|
24908
24931
|
const cachedData = await getCache(cacheKey);
|
|
24909
24932
|
if (cachedData) {
|
|
24910
24933
|
logger88.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -25180,10 +25203,10 @@ import {
|
|
|
25180
25203
|
BadRequestError as BadRequestError111,
|
|
25181
25204
|
InternalServerError as InternalServerError36,
|
|
25182
25205
|
logger as logger91,
|
|
25183
|
-
makeCacheKey as
|
|
25206
|
+
makeCacheKey as makeCacheKey33,
|
|
25184
25207
|
paginate as paginate28,
|
|
25185
25208
|
useAtlas as useAtlas55,
|
|
25186
|
-
useCache as
|
|
25209
|
+
useCache as useCache35
|
|
25187
25210
|
} from "@7365admin1/node-server-utils";
|
|
25188
25211
|
import { ObjectId as ObjectId67 } from "mongodb";
|
|
25189
25212
|
function usePatrolRouteRepo() {
|
|
@@ -25193,7 +25216,7 @@ function usePatrolRouteRepo() {
|
|
|
25193
25216
|
}
|
|
25194
25217
|
const namespace_collection = "patrol.route";
|
|
25195
25218
|
const collection = db.collection(namespace_collection);
|
|
25196
|
-
const { delNamespace, getCache, setCache } =
|
|
25219
|
+
const { delNamespace, getCache, setCache } = useCache35(namespace_collection);
|
|
25197
25220
|
async function createTextIndex() {
|
|
25198
25221
|
try {
|
|
25199
25222
|
await collection.createIndex({
|
|
@@ -25254,7 +25277,7 @@ function usePatrolRouteRepo() {
|
|
|
25254
25277
|
...search && { search },
|
|
25255
25278
|
...query.site && { site: query.site.toString() }
|
|
25256
25279
|
};
|
|
25257
|
-
const cacheKey =
|
|
25280
|
+
const cacheKey = makeCacheKey33(namespace_collection, cacheOptions);
|
|
25258
25281
|
const cachedData = await getCache(cacheKey);
|
|
25259
25282
|
if (cachedData) {
|
|
25260
25283
|
logger91.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -25475,7 +25498,7 @@ function usePatrolRouteRepo() {
|
|
|
25475
25498
|
...day && { day },
|
|
25476
25499
|
...start && { start }
|
|
25477
25500
|
};
|
|
25478
|
-
const cacheKey =
|
|
25501
|
+
const cacheKey = makeCacheKey33(namespace_collection, cacheOptions);
|
|
25479
25502
|
const cachedData = await getCache(cacheKey);
|
|
25480
25503
|
if (cachedData) {
|
|
25481
25504
|
logger91.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -25542,7 +25565,7 @@ function usePatrolRouteRepo() {
|
|
|
25542
25565
|
} catch (error) {
|
|
25543
25566
|
throw new BadRequestError111("Invalid patrol log ID format.");
|
|
25544
25567
|
}
|
|
25545
|
-
const cacheKey =
|
|
25568
|
+
const cacheKey = makeCacheKey33(namespace_collection, { _id });
|
|
25546
25569
|
const cachedData = await getCache(cacheKey);
|
|
25547
25570
|
if (cachedData) {
|
|
25548
25571
|
logger91.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -25897,10 +25920,10 @@ import {
|
|
|
25897
25920
|
BadRequestError as BadRequestError114,
|
|
25898
25921
|
InternalServerError as InternalServerError37,
|
|
25899
25922
|
logger as logger94,
|
|
25900
|
-
makeCacheKey as
|
|
25923
|
+
makeCacheKey as makeCacheKey34,
|
|
25901
25924
|
paginate as paginate29,
|
|
25902
25925
|
useAtlas as useAtlas56,
|
|
25903
|
-
useCache as
|
|
25926
|
+
useCache as useCache36
|
|
25904
25927
|
} from "@7365admin1/node-server-utils";
|
|
25905
25928
|
import { ObjectId as ObjectId69 } from "mongodb";
|
|
25906
25929
|
function usePatrolLogRepo() {
|
|
@@ -25910,7 +25933,7 @@ function usePatrolLogRepo() {
|
|
|
25910
25933
|
}
|
|
25911
25934
|
const namespace_collection = "patrol.logs";
|
|
25912
25935
|
const collection = db.collection(namespace_collection);
|
|
25913
|
-
const { delNamespace, getCache, setCache } =
|
|
25936
|
+
const { delNamespace, getCache, setCache } = useCache36(namespace_collection);
|
|
25914
25937
|
async function createIndexes() {
|
|
25915
25938
|
try {
|
|
25916
25939
|
await collection.createIndexes([
|
|
@@ -26007,7 +26030,7 @@ function usePatrolLogRepo() {
|
|
|
26007
26030
|
...query.site && { site: query.site.toString() },
|
|
26008
26031
|
...dateFrom && { dateFrom: dateFrom.toString() }
|
|
26009
26032
|
};
|
|
26010
|
-
const cacheKey =
|
|
26033
|
+
const cacheKey = makeCacheKey34(namespace_collection, cacheOptions);
|
|
26011
26034
|
const cachedData = await getCache(cacheKey);
|
|
26012
26035
|
if (cachedData) {
|
|
26013
26036
|
logger94.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -26171,7 +26194,7 @@ function usePatrolLogRepo() {
|
|
|
26171
26194
|
} catch (error) {
|
|
26172
26195
|
throw new BadRequestError114("Invalid patrol log ID format.");
|
|
26173
26196
|
}
|
|
26174
|
-
const cacheKey =
|
|
26197
|
+
const cacheKey = makeCacheKey34(namespace_collection, { _id });
|
|
26175
26198
|
const cachedData = await getCache(cacheKey);
|
|
26176
26199
|
if (cachedData) {
|
|
26177
26200
|
logger94.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -26687,11 +26710,11 @@ import {
|
|
|
26687
26710
|
BadRequestError as BadRequestError117,
|
|
26688
26711
|
InternalServerError as InternalServerError38,
|
|
26689
26712
|
logger as logger97,
|
|
26690
|
-
makeCacheKey as
|
|
26713
|
+
makeCacheKey as makeCacheKey35,
|
|
26691
26714
|
NotFoundError as NotFoundError25,
|
|
26692
26715
|
paginate as paginate30,
|
|
26693
26716
|
useAtlas as useAtlas58,
|
|
26694
|
-
useCache as
|
|
26717
|
+
useCache as useCache37
|
|
26695
26718
|
} from "@7365admin1/node-server-utils";
|
|
26696
26719
|
import { ObjectId as ObjectId71 } from "mongodb";
|
|
26697
26720
|
function useSiteFacilityRepo() {
|
|
@@ -26701,7 +26724,7 @@ function useSiteFacilityRepo() {
|
|
|
26701
26724
|
}
|
|
26702
26725
|
const namespace_collection = "site.facilities";
|
|
26703
26726
|
const collection = db.collection(namespace_collection);
|
|
26704
|
-
const { delNamespace, getCache, setCache } =
|
|
26727
|
+
const { delNamespace, getCache, setCache } = useCache37(namespace_collection);
|
|
26705
26728
|
async function createTextIndex() {
|
|
26706
26729
|
try {
|
|
26707
26730
|
await collection.createIndex({
|
|
@@ -26776,7 +26799,7 @@ function useSiteFacilityRepo() {
|
|
|
26776
26799
|
query.$text = { $search: search };
|
|
26777
26800
|
cacheOptions.search = search;
|
|
26778
26801
|
}
|
|
26779
|
-
const cacheKey =
|
|
26802
|
+
const cacheKey = makeCacheKey35(namespace_collection, cacheOptions);
|
|
26780
26803
|
const cachedData = await getCache(cacheKey);
|
|
26781
26804
|
if (cachedData) {
|
|
26782
26805
|
logger97.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -26810,7 +26833,7 @@ function useSiteFacilityRepo() {
|
|
|
26810
26833
|
} catch (error) {
|
|
26811
26834
|
throw new BadRequestError117("Invalid site facility ID format.");
|
|
26812
26835
|
}
|
|
26813
|
-
const cacheKey =
|
|
26836
|
+
const cacheKey = makeCacheKey35(namespace_collection, { _id });
|
|
26814
26837
|
const cachedData = await getCache(cacheKey);
|
|
26815
26838
|
if (cachedData) {
|
|
26816
26839
|
logger97.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -26935,7 +26958,7 @@ function useSiteFacilityRepo() {
|
|
|
26935
26958
|
_id,
|
|
26936
26959
|
site
|
|
26937
26960
|
};
|
|
26938
|
-
const cacheKey =
|
|
26961
|
+
const cacheKey = makeCacheKey35(namespace_collection, query);
|
|
26939
26962
|
const cachedData = await getCache(cacheKey);
|
|
26940
26963
|
if (cachedData) {
|
|
26941
26964
|
logger97.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -27345,11 +27368,11 @@ import {
|
|
|
27345
27368
|
BadRequestError as BadRequestError119,
|
|
27346
27369
|
InternalServerError as InternalServerError39,
|
|
27347
27370
|
logger as logger99,
|
|
27348
|
-
makeCacheKey as
|
|
27371
|
+
makeCacheKey as makeCacheKey36,
|
|
27349
27372
|
NotFoundError as NotFoundError26,
|
|
27350
27373
|
paginate as paginate31,
|
|
27351
27374
|
useAtlas as useAtlas60,
|
|
27352
|
-
useCache as
|
|
27375
|
+
useCache as useCache38
|
|
27353
27376
|
} from "@7365admin1/node-server-utils";
|
|
27354
27377
|
import { ObjectId as ObjectId73 } from "mongodb";
|
|
27355
27378
|
function useServiceProviderBillingRepo() {
|
|
@@ -27359,7 +27382,7 @@ function useServiceProviderBillingRepo() {
|
|
|
27359
27382
|
}
|
|
27360
27383
|
const namespace_collection = "site.service-provider.billing";
|
|
27361
27384
|
const collection = db.collection(namespace_collection);
|
|
27362
|
-
const { delNamespace, getCache, setCache } =
|
|
27385
|
+
const { delNamespace, getCache, setCache } = useCache38(namespace_collection);
|
|
27363
27386
|
async function createIndexes() {
|
|
27364
27387
|
try {
|
|
27365
27388
|
await collection.createIndexes([{ key: { orgId: 1, status: 1 } }]);
|
|
@@ -27418,7 +27441,7 @@ function useServiceProviderBillingRepo() {
|
|
|
27418
27441
|
query.$text = { $search: search };
|
|
27419
27442
|
cacheOptions.search = search;
|
|
27420
27443
|
}
|
|
27421
|
-
const cacheKey =
|
|
27444
|
+
const cacheKey = makeCacheKey36(namespace_collection, cacheOptions);
|
|
27422
27445
|
const cachedData = await getCache(cacheKey);
|
|
27423
27446
|
if (cachedData) {
|
|
27424
27447
|
logger99.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -27452,7 +27475,7 @@ function useServiceProviderBillingRepo() {
|
|
|
27452
27475
|
} catch (error) {
|
|
27453
27476
|
throw new BadRequestError119("Invalid service provider billing ID format.");
|
|
27454
27477
|
}
|
|
27455
|
-
const cacheKey =
|
|
27478
|
+
const cacheKey = makeCacheKey36(namespace_collection, { _id });
|
|
27456
27479
|
const cachedData = await getCache(cacheKey);
|
|
27457
27480
|
if (cachedData) {
|
|
27458
27481
|
logger99.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -27996,12 +28019,12 @@ import {
|
|
|
27996
28019
|
BadRequestError as BadRequestError121,
|
|
27997
28020
|
InternalServerError as InternalServerError40,
|
|
27998
28021
|
logger as logger101,
|
|
27999
|
-
makeCacheKey as
|
|
28022
|
+
makeCacheKey as makeCacheKey37,
|
|
28000
28023
|
NotFoundError as NotFoundError27,
|
|
28001
28024
|
paginate as paginate32,
|
|
28002
28025
|
toObjectId as toObjectId13,
|
|
28003
28026
|
useAtlas as useAtlas62,
|
|
28004
|
-
useCache as
|
|
28027
|
+
useCache as useCache39
|
|
28005
28028
|
} from "@7365admin1/node-server-utils";
|
|
28006
28029
|
import { ObjectId as ObjectId75 } from "mongodb";
|
|
28007
28030
|
var facility_bookings_namespace_collection = "site.facilty-booking";
|
|
@@ -28011,7 +28034,7 @@ function useSiteFacilityBookingRepo() {
|
|
|
28011
28034
|
throw new InternalServerError40("Unable to connect to server.");
|
|
28012
28035
|
}
|
|
28013
28036
|
const collection = db.collection(facility_bookings_namespace_collection);
|
|
28014
|
-
const { delNamespace, getCache, setCache } =
|
|
28037
|
+
const { delNamespace, getCache, setCache } = useCache39(
|
|
28015
28038
|
facility_bookings_namespace_collection
|
|
28016
28039
|
);
|
|
28017
28040
|
async function createIndexes() {
|
|
@@ -28069,7 +28092,7 @@ function useSiteFacilityBookingRepo() {
|
|
|
28069
28092
|
limit,
|
|
28070
28093
|
...search && { search }
|
|
28071
28094
|
};
|
|
28072
|
-
const cacheKey =
|
|
28095
|
+
const cacheKey = makeCacheKey37(
|
|
28073
28096
|
facility_bookings_namespace_collection,
|
|
28074
28097
|
cacheOptions
|
|
28075
28098
|
);
|
|
@@ -28102,7 +28125,7 @@ function useSiteFacilityBookingRepo() {
|
|
|
28102
28125
|
}
|
|
28103
28126
|
async function getSiteFacilityBookingById(id, session) {
|
|
28104
28127
|
const _id = toObjectId13(id);
|
|
28105
|
-
const cacheKey =
|
|
28128
|
+
const cacheKey = makeCacheKey37(facility_bookings_namespace_collection, {
|
|
28106
28129
|
id
|
|
28107
28130
|
});
|
|
28108
28131
|
const cachedData = await getCache(cacheKey);
|
|
@@ -28475,11 +28498,11 @@ import {
|
|
|
28475
28498
|
BadRequestError as BadRequestError123,
|
|
28476
28499
|
InternalServerError as InternalServerError41,
|
|
28477
28500
|
logger as logger103,
|
|
28478
|
-
makeCacheKey as
|
|
28501
|
+
makeCacheKey as makeCacheKey38,
|
|
28479
28502
|
NotFoundError as NotFoundError28,
|
|
28480
28503
|
paginate as paginate33,
|
|
28481
28504
|
useAtlas as useAtlas64,
|
|
28482
|
-
useCache as
|
|
28505
|
+
useCache as useCache40
|
|
28483
28506
|
} from "@7365admin1/node-server-utils";
|
|
28484
28507
|
import { ObjectId as ObjectId77 } from "mongodb";
|
|
28485
28508
|
function useDocumentManagementRepo() {
|
|
@@ -28489,7 +28512,7 @@ function useDocumentManagementRepo() {
|
|
|
28489
28512
|
}
|
|
28490
28513
|
const namespace_collection = "documents";
|
|
28491
28514
|
const collection = db.collection(namespace_collection);
|
|
28492
|
-
const { delNamespace, getCache, setCache } =
|
|
28515
|
+
const { delNamespace, getCache, setCache } = useCache40(namespace_collection);
|
|
28493
28516
|
async function createTextIndex() {
|
|
28494
28517
|
try {
|
|
28495
28518
|
await collection.createIndex({
|
|
@@ -28558,7 +28581,7 @@ function useDocumentManagementRepo() {
|
|
|
28558
28581
|
];
|
|
28559
28582
|
cacheOptions.search = search;
|
|
28560
28583
|
}
|
|
28561
|
-
const cacheKey =
|
|
28584
|
+
const cacheKey = makeCacheKey38(namespace_collection, cacheOptions);
|
|
28562
28585
|
const cachedData = await getCache(cacheKey);
|
|
28563
28586
|
if (cachedData) {
|
|
28564
28587
|
logger103.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -28599,7 +28622,7 @@ function useDocumentManagementRepo() {
|
|
|
28599
28622
|
} catch (error) {
|
|
28600
28623
|
throw new BadRequestError123("Invalid document ID format.");
|
|
28601
28624
|
}
|
|
28602
|
-
const cacheKey =
|
|
28625
|
+
const cacheKey = makeCacheKey38(namespace_collection, { _id });
|
|
28603
28626
|
const cachedData = await getCache(cacheKey);
|
|
28604
28627
|
if (cachedData) {
|
|
28605
28628
|
logger103.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -28716,7 +28739,7 @@ function useDocumentManagementRepo() {
|
|
|
28716
28739
|
} catch (error) {
|
|
28717
28740
|
throw new BadRequestError123("Invalid document management site ID format.");
|
|
28718
28741
|
}
|
|
28719
|
-
const cacheKey =
|
|
28742
|
+
const cacheKey = makeCacheKey38(namespace_collection, { site });
|
|
28720
28743
|
const cachedData = await getCache(cacheKey);
|
|
28721
28744
|
if (cachedData) {
|
|
28722
28745
|
logger103.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -29140,11 +29163,11 @@ import {
|
|
|
29140
29163
|
BadRequestError as BadRequestError126,
|
|
29141
29164
|
InternalServerError as InternalServerError42,
|
|
29142
29165
|
logger as logger105,
|
|
29143
|
-
makeCacheKey as
|
|
29166
|
+
makeCacheKey as makeCacheKey39,
|
|
29144
29167
|
NotFoundError as NotFoundError30,
|
|
29145
29168
|
paginate as paginate34,
|
|
29146
29169
|
useAtlas as useAtlas66,
|
|
29147
|
-
useCache as
|
|
29170
|
+
useCache as useCache41
|
|
29148
29171
|
} from "@7365admin1/node-server-utils";
|
|
29149
29172
|
import { ObjectId as ObjectId79 } from "mongodb";
|
|
29150
29173
|
var bulletin_boards_namespace_collection = "bulletin-boards";
|
|
@@ -29154,7 +29177,7 @@ function useBulletinBoardRepo() {
|
|
|
29154
29177
|
throw new InternalServerError42("Unable to connect to server.");
|
|
29155
29178
|
}
|
|
29156
29179
|
const collection = db.collection(bulletin_boards_namespace_collection);
|
|
29157
|
-
const { delNamespace, getCache, setCache } =
|
|
29180
|
+
const { delNamespace, getCache, setCache } = useCache41(
|
|
29158
29181
|
bulletin_boards_namespace_collection
|
|
29159
29182
|
);
|
|
29160
29183
|
async function createIndexes() {
|
|
@@ -29218,7 +29241,7 @@ function useBulletinBoardRepo() {
|
|
|
29218
29241
|
...search && { search },
|
|
29219
29242
|
...recipients?.length && { recipients: recipients.sort().join(",") }
|
|
29220
29243
|
};
|
|
29221
|
-
const cacheKey =
|
|
29244
|
+
const cacheKey = makeCacheKey39(
|
|
29222
29245
|
bulletin_boards_namespace_collection,
|
|
29223
29246
|
cacheOptions
|
|
29224
29247
|
);
|
|
@@ -29255,7 +29278,7 @@ function useBulletinBoardRepo() {
|
|
|
29255
29278
|
} catch (error) {
|
|
29256
29279
|
throw new BadRequestError126("Invalid bulletin board ID format.");
|
|
29257
29280
|
}
|
|
29258
|
-
const cacheKey =
|
|
29281
|
+
const cacheKey = makeCacheKey39(bulletin_boards_namespace_collection, {
|
|
29259
29282
|
_id
|
|
29260
29283
|
});
|
|
29261
29284
|
const cachedData = await getCache(cacheKey);
|
|
@@ -29786,9 +29809,9 @@ import {
|
|
|
29786
29809
|
InternalServerError as InternalServerError43,
|
|
29787
29810
|
logger as logger108,
|
|
29788
29811
|
useAtlas as useAtlas68,
|
|
29789
|
-
useCache as
|
|
29812
|
+
useCache as useCache42,
|
|
29790
29813
|
paginate as paginate35,
|
|
29791
|
-
makeCacheKey as
|
|
29814
|
+
makeCacheKey as makeCacheKey40
|
|
29792
29815
|
} from "@7365admin1/node-server-utils";
|
|
29793
29816
|
import { ObjectId as ObjectId81 } from "mongodb";
|
|
29794
29817
|
function useSiteBillingItemRepo() {
|
|
@@ -29798,7 +29821,7 @@ function useSiteBillingItemRepo() {
|
|
|
29798
29821
|
}
|
|
29799
29822
|
const namespace_collection = "site.billing.items";
|
|
29800
29823
|
const collection = db.collection(namespace_collection);
|
|
29801
|
-
const { delNamespace, setCache, getCache } =
|
|
29824
|
+
const { delNamespace, setCache, getCache } = useCache42(namespace_collection);
|
|
29802
29825
|
async function createTextIndex() {
|
|
29803
29826
|
try {
|
|
29804
29827
|
await collection.createIndex({
|
|
@@ -29874,7 +29897,7 @@ function useSiteBillingItemRepo() {
|
|
|
29874
29897
|
...search && { search },
|
|
29875
29898
|
...query.site && { site: query.site.toString() }
|
|
29876
29899
|
};
|
|
29877
|
-
const cacheKey =
|
|
29900
|
+
const cacheKey = makeCacheKey40(namespace_collection, cacheOptions);
|
|
29878
29901
|
const cachedData = await getCache(cacheKey);
|
|
29879
29902
|
if (cachedData) {
|
|
29880
29903
|
logger108.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -29907,7 +29930,7 @@ function useSiteBillingItemRepo() {
|
|
|
29907
29930
|
} catch (error) {
|
|
29908
29931
|
throw new BadRequestError129("Invalid ID.");
|
|
29909
29932
|
}
|
|
29910
|
-
const cacheKey =
|
|
29933
|
+
const cacheKey = makeCacheKey40(namespace_collection, { _id: String(_id) });
|
|
29911
29934
|
try {
|
|
29912
29935
|
const cached = await getCache(cacheKey);
|
|
29913
29936
|
if (cached) {
|
|
@@ -30039,9 +30062,9 @@ import {
|
|
|
30039
30062
|
InternalServerError as InternalServerError44,
|
|
30040
30063
|
logger as logger110,
|
|
30041
30064
|
useAtlas as useAtlas69,
|
|
30042
|
-
useCache as
|
|
30065
|
+
useCache as useCache43,
|
|
30043
30066
|
paginate as paginate36,
|
|
30044
|
-
makeCacheKey as
|
|
30067
|
+
makeCacheKey as makeCacheKey41
|
|
30045
30068
|
} from "@7365admin1/node-server-utils";
|
|
30046
30069
|
|
|
30047
30070
|
// src/models/site-billing-configuration.model.ts
|
|
@@ -30171,7 +30194,7 @@ function useSiteBillingConfigurationRepo() {
|
|
|
30171
30194
|
}
|
|
30172
30195
|
const namespace_collection = "site.billing.configuration";
|
|
30173
30196
|
const collection = db.collection(namespace_collection);
|
|
30174
|
-
const { delNamespace, setCache, getCache } =
|
|
30197
|
+
const { delNamespace, setCache, getCache } = useCache43(namespace_collection);
|
|
30175
30198
|
async function createTextIndex() {
|
|
30176
30199
|
try {
|
|
30177
30200
|
await collection.createIndex({
|
|
@@ -30233,7 +30256,7 @@ function useSiteBillingConfigurationRepo() {
|
|
|
30233
30256
|
...search && { search },
|
|
30234
30257
|
...query.site && { site: query.site.toString() }
|
|
30235
30258
|
};
|
|
30236
|
-
const cacheKey =
|
|
30259
|
+
const cacheKey = makeCacheKey41(namespace_collection, cacheOptions);
|
|
30237
30260
|
const cachedData = await getCache(cacheKey);
|
|
30238
30261
|
if (cachedData) {
|
|
30239
30262
|
logger110.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -30266,7 +30289,7 @@ function useSiteBillingConfigurationRepo() {
|
|
|
30266
30289
|
} catch (error) {
|
|
30267
30290
|
throw new BadRequestError131("Invalid ID.");
|
|
30268
30291
|
}
|
|
30269
|
-
const cacheKey =
|
|
30292
|
+
const cacheKey = makeCacheKey41(namespace_collection, { _id: String(_id) });
|
|
30270
30293
|
try {
|
|
30271
30294
|
const cached = await getCache(cacheKey);
|
|
30272
30295
|
if (cached) {
|
|
@@ -30972,11 +30995,11 @@ import {
|
|
|
30972
30995
|
BadRequestError as BadRequestError136,
|
|
30973
30996
|
InternalServerError as InternalServerError45,
|
|
30974
30997
|
logger as logger115,
|
|
30975
|
-
makeCacheKey as
|
|
30998
|
+
makeCacheKey as makeCacheKey42,
|
|
30976
30999
|
NotFoundError as NotFoundError33,
|
|
30977
31000
|
paginate as paginate37,
|
|
30978
31001
|
useAtlas as useAtlas72,
|
|
30979
|
-
useCache as
|
|
31002
|
+
useCache as useCache44
|
|
30980
31003
|
} from "@7365admin1/node-server-utils";
|
|
30981
31004
|
import { ObjectId as ObjectId85 } from "mongodb";
|
|
30982
31005
|
var events_namespace_collection = "event-management";
|
|
@@ -30986,7 +31009,7 @@ function useEventManagementRepo() {
|
|
|
30986
31009
|
throw new InternalServerError45("Unable to connect to server.");
|
|
30987
31010
|
}
|
|
30988
31011
|
const collection = db.collection(events_namespace_collection);
|
|
30989
|
-
const { delNamespace, getCache, setCache } =
|
|
31012
|
+
const { delNamespace, getCache, setCache } = useCache44(
|
|
30990
31013
|
events_namespace_collection
|
|
30991
31014
|
);
|
|
30992
31015
|
async function createIndexes() {
|
|
@@ -31074,7 +31097,7 @@ function useEventManagementRepo() {
|
|
|
31074
31097
|
query.$text = { $search: search };
|
|
31075
31098
|
cacheOptions.search = search;
|
|
31076
31099
|
}
|
|
31077
|
-
const cacheKey =
|
|
31100
|
+
const cacheKey = makeCacheKey42(events_namespace_collection, cacheOptions);
|
|
31078
31101
|
const cachedData = await getCache(cacheKey);
|
|
31079
31102
|
if (cachedData) {
|
|
31080
31103
|
logger115.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -31126,7 +31149,7 @@ function useEventManagementRepo() {
|
|
|
31126
31149
|
} catch (error) {
|
|
31127
31150
|
throw new BadRequestError136("Invalid event ID format.");
|
|
31128
31151
|
}
|
|
31129
|
-
const cacheKey =
|
|
31152
|
+
const cacheKey = makeCacheKey42(events_namespace_collection, { _id });
|
|
31130
31153
|
const cachedData = await getCache(cacheKey);
|
|
31131
31154
|
if (cachedData) {
|
|
31132
31155
|
logger115.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -31658,9 +31681,9 @@ import {
|
|
|
31658
31681
|
InternalServerError as InternalServerError46,
|
|
31659
31682
|
logger as logger118,
|
|
31660
31683
|
useAtlas as useAtlas74,
|
|
31661
|
-
useCache as
|
|
31684
|
+
useCache as useCache45,
|
|
31662
31685
|
paginate as paginate38,
|
|
31663
|
-
makeCacheKey as
|
|
31686
|
+
makeCacheKey as makeCacheKey43
|
|
31664
31687
|
} from "@7365admin1/node-server-utils";
|
|
31665
31688
|
import { ObjectId as ObjectId87 } from "mongodb";
|
|
31666
31689
|
function useSiteUnitBillingRepo() {
|
|
@@ -31670,7 +31693,7 @@ function useSiteUnitBillingRepo() {
|
|
|
31670
31693
|
}
|
|
31671
31694
|
const namespace_collection = "site.unit.billing";
|
|
31672
31695
|
const collection = db.collection(namespace_collection);
|
|
31673
|
-
const { delNamespace, setCache, getCache } =
|
|
31696
|
+
const { delNamespace, setCache, getCache } = useCache45(namespace_collection);
|
|
31674
31697
|
async function createTextIndex() {
|
|
31675
31698
|
try {
|
|
31676
31699
|
await collection.createIndex({
|
|
@@ -31786,7 +31809,7 @@ function useSiteUnitBillingRepo() {
|
|
|
31786
31809
|
...dateFrom && { dateFrom },
|
|
31787
31810
|
...dateTo && { dateTo }
|
|
31788
31811
|
};
|
|
31789
|
-
const cacheKey =
|
|
31812
|
+
const cacheKey = makeCacheKey43(namespace_collection, cacheOptions);
|
|
31790
31813
|
const cachedData = await getCache(cacheKey);
|
|
31791
31814
|
if (cachedData) {
|
|
31792
31815
|
logger118.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -31841,7 +31864,7 @@ function useSiteUnitBillingRepo() {
|
|
|
31841
31864
|
} catch (error) {
|
|
31842
31865
|
throw new BadRequestError139("Invalid ID.");
|
|
31843
31866
|
}
|
|
31844
|
-
const cacheKey =
|
|
31867
|
+
const cacheKey = makeCacheKey43(namespace_collection, { _id: String(_id) });
|
|
31845
31868
|
try {
|
|
31846
31869
|
const cached = await getCache(cacheKey);
|
|
31847
31870
|
if (cached) {
|
|
@@ -32890,7 +32913,11 @@ var formatEntryPassDate = (date) => {
|
|
|
32890
32913
|
const day = String(newDate.getDate()).padStart(2, "0");
|
|
32891
32914
|
return `${year}${month}${day}`;
|
|
32892
32915
|
};
|
|
32893
|
-
async function removeAccessGroup({
|
|
32916
|
+
async function removeAccessGroup({
|
|
32917
|
+
cardNo,
|
|
32918
|
+
staffNo,
|
|
32919
|
+
url
|
|
32920
|
+
}) {
|
|
32894
32921
|
try {
|
|
32895
32922
|
const commands = readTemplate("delete-qr-card", {
|
|
32896
32923
|
staffNo,
|
|
@@ -32911,8 +32938,6 @@ async function removeAccessGroup({ cardNo, staffNo, url }) {
|
|
|
32911
32938
|
});
|
|
32912
32939
|
const response = await sendCommand(commands, url);
|
|
32913
32940
|
const result = await parseStringPromise(response, { explicitArray: false });
|
|
32914
|
-
console.log(result.RESULT.$.STCODE);
|
|
32915
|
-
console.log(commands);
|
|
32916
32941
|
if (result && result.RESULT.$.STCODE !== "0") {
|
|
32917
32942
|
throw new Error("Command failed, server error.");
|
|
32918
32943
|
}
|
|
@@ -36203,10 +36228,10 @@ import {
|
|
|
36203
36228
|
BadRequestError as BadRequestError144,
|
|
36204
36229
|
InternalServerError as InternalServerError48,
|
|
36205
36230
|
logger as logger122,
|
|
36206
|
-
makeCacheKey as
|
|
36231
|
+
makeCacheKey as makeCacheKey45,
|
|
36207
36232
|
paginate as paginate40,
|
|
36208
36233
|
useAtlas as useAtlas77,
|
|
36209
|
-
useCache as
|
|
36234
|
+
useCache as useCache47
|
|
36210
36235
|
} from "@7365admin1/node-server-utils";
|
|
36211
36236
|
import { ObjectId as ObjectId92 } from "mongodb";
|
|
36212
36237
|
function useNfcPatrolTagRepo() {
|
|
@@ -36217,8 +36242,8 @@ function useNfcPatrolTagRepo() {
|
|
|
36217
36242
|
const namespace_collection = "nfc-patrol-tags";
|
|
36218
36243
|
const namespace_collection_nfc_patrol_routes = "nfc-patrol-routes";
|
|
36219
36244
|
const collection = db.collection(namespace_collection);
|
|
36220
|
-
const { delNamespace, getCache, setCache } =
|
|
36221
|
-
const { delNamespace: delNamespaceNfcPatrolRoutes } =
|
|
36245
|
+
const { delNamespace, getCache, setCache } = useCache47(namespace_collection);
|
|
36246
|
+
const { delNamespace: delNamespaceNfcPatrolRoutes } = useCache47(
|
|
36222
36247
|
namespace_collection_nfc_patrol_routes
|
|
36223
36248
|
);
|
|
36224
36249
|
async function createIndexes() {
|
|
@@ -36274,7 +36299,7 @@ function useNfcPatrolTagRepo() {
|
|
|
36274
36299
|
page,
|
|
36275
36300
|
limit
|
|
36276
36301
|
};
|
|
36277
|
-
const cacheKey =
|
|
36302
|
+
const cacheKey = makeCacheKey45(namespace_collection, cacheOptions);
|
|
36278
36303
|
const cachedData = await getCache(cacheKey);
|
|
36279
36304
|
if (cachedData) {
|
|
36280
36305
|
logger122.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -36666,12 +36691,12 @@ import {
|
|
|
36666
36691
|
BadRequestError as BadRequestError147,
|
|
36667
36692
|
InternalServerError as InternalServerError49,
|
|
36668
36693
|
logger as logger124,
|
|
36669
|
-
makeCacheKey as
|
|
36694
|
+
makeCacheKey as makeCacheKey46,
|
|
36670
36695
|
NotFoundError as NotFoundError37,
|
|
36671
36696
|
paginate as paginate41,
|
|
36672
36697
|
toObjectId as toObjectId14,
|
|
36673
36698
|
useAtlas as useAtlas79,
|
|
36674
|
-
useCache as
|
|
36699
|
+
useCache as useCache48
|
|
36675
36700
|
} from "@7365admin1/node-server-utils";
|
|
36676
36701
|
import { ObjectId as ObjectId94 } from "mongodb";
|
|
36677
36702
|
var occurrence_book_namespace_collection = "occurrence-books";
|
|
@@ -36708,7 +36733,7 @@ function useOccurrenceBookRepo() {
|
|
|
36708
36733
|
}
|
|
36709
36734
|
}
|
|
36710
36735
|
const collection = db.collection(occurrence_book_namespace_collection);
|
|
36711
|
-
const { delNamespace, getCache, setCache } =
|
|
36736
|
+
const { delNamespace, getCache, setCache } = useCache48(
|
|
36712
36737
|
occurrence_book_namespace_collection
|
|
36713
36738
|
);
|
|
36714
36739
|
async function add(value, session) {
|
|
@@ -36784,7 +36809,7 @@ function useOccurrenceBookRepo() {
|
|
|
36784
36809
|
$lt: endDateISO
|
|
36785
36810
|
};
|
|
36786
36811
|
}
|
|
36787
|
-
const cacheKey =
|
|
36812
|
+
const cacheKey = makeCacheKey46(
|
|
36788
36813
|
occurrence_book_namespace_collection,
|
|
36789
36814
|
cacheOptions
|
|
36790
36815
|
);
|
|
@@ -36821,7 +36846,7 @@ function useOccurrenceBookRepo() {
|
|
|
36821
36846
|
} catch (error) {
|
|
36822
36847
|
throw new BadRequestError147("Invalid occurrence book ID format.");
|
|
36823
36848
|
}
|
|
36824
|
-
const cacheKey =
|
|
36849
|
+
const cacheKey = makeCacheKey46(occurrence_book_namespace_collection, {
|
|
36825
36850
|
_id
|
|
36826
36851
|
});
|
|
36827
36852
|
const cachedData = await getCache(cacheKey);
|
|
@@ -37317,11 +37342,11 @@ import {
|
|
|
37317
37342
|
BadRequestError as BadRequestError149,
|
|
37318
37343
|
InternalServerError as InternalServerError50,
|
|
37319
37344
|
logger as logger126,
|
|
37320
|
-
makeCacheKey as
|
|
37345
|
+
makeCacheKey as makeCacheKey47,
|
|
37321
37346
|
NotFoundError as NotFoundError38,
|
|
37322
37347
|
paginate as paginate42,
|
|
37323
37348
|
useAtlas as useAtlas81,
|
|
37324
|
-
useCache as
|
|
37349
|
+
useCache as useCache49
|
|
37325
37350
|
} from "@7365admin1/node-server-utils";
|
|
37326
37351
|
import { ObjectId as ObjectId96 } from "mongodb";
|
|
37327
37352
|
function useBulletinVideoRepo() {
|
|
@@ -37340,7 +37365,7 @@ function useBulletinVideoRepo() {
|
|
|
37340
37365
|
}
|
|
37341
37366
|
const namespace_collection = "bulletin-videos";
|
|
37342
37367
|
const collection = db.collection(namespace_collection);
|
|
37343
|
-
const { delNamespace, getCache, setCache } =
|
|
37368
|
+
const { delNamespace, getCache, setCache } = useCache49(namespace_collection);
|
|
37344
37369
|
async function add(value, session) {
|
|
37345
37370
|
try {
|
|
37346
37371
|
value = MBulletinVideo(value);
|
|
@@ -37391,7 +37416,7 @@ function useBulletinVideoRepo() {
|
|
|
37391
37416
|
query.$text = { $search: search };
|
|
37392
37417
|
cacheOptions.search = search;
|
|
37393
37418
|
}
|
|
37394
|
-
const cacheKey =
|
|
37419
|
+
const cacheKey = makeCacheKey47(namespace_collection, cacheOptions);
|
|
37395
37420
|
const cachedData = await getCache(cacheKey);
|
|
37396
37421
|
if (cachedData) {
|
|
37397
37422
|
logger126.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -37425,7 +37450,7 @@ function useBulletinVideoRepo() {
|
|
|
37425
37450
|
} catch (error) {
|
|
37426
37451
|
throw new BadRequestError149("Invalid bulletin video ID format.");
|
|
37427
37452
|
}
|
|
37428
|
-
const cacheKey =
|
|
37453
|
+
const cacheKey = makeCacheKey47(namespace_collection, { _id });
|
|
37429
37454
|
const cachedData = await getCache(cacheKey);
|
|
37430
37455
|
if (cachedData) {
|
|
37431
37456
|
logger126.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -37879,9 +37904,9 @@ import {
|
|
|
37879
37904
|
InternalServerError as InternalServerError51,
|
|
37880
37905
|
logger as logger129,
|
|
37881
37906
|
useAtlas as useAtlas83,
|
|
37882
|
-
useCache as
|
|
37907
|
+
useCache as useCache50,
|
|
37883
37908
|
paginate as paginate43,
|
|
37884
|
-
makeCacheKey as
|
|
37909
|
+
makeCacheKey as makeCacheKey48
|
|
37885
37910
|
} from "@7365admin1/node-server-utils";
|
|
37886
37911
|
import { ObjectId as ObjectId98 } from "mongodb";
|
|
37887
37912
|
function useStatementOfAccountRepo() {
|
|
@@ -37891,7 +37916,7 @@ function useStatementOfAccountRepo() {
|
|
|
37891
37916
|
}
|
|
37892
37917
|
const namespace_collection = "site.statement-of-accounts";
|
|
37893
37918
|
const collection = db.collection(namespace_collection);
|
|
37894
|
-
const { delNamespace, getCache, setCache } =
|
|
37919
|
+
const { delNamespace, getCache, setCache } = useCache50(namespace_collection);
|
|
37895
37920
|
async function createTextIndex() {
|
|
37896
37921
|
try {
|
|
37897
37922
|
await collection.createIndex({
|
|
@@ -37979,7 +38004,7 @@ function useStatementOfAccountRepo() {
|
|
|
37979
38004
|
...dateFrom && { dateFrom: dateFrom.toString() },
|
|
37980
38005
|
...dateTo && { dateTo: dateTo.toString() }
|
|
37981
38006
|
};
|
|
37982
|
-
const cacheKey =
|
|
38007
|
+
const cacheKey = makeCacheKey48(namespace_collection, cacheOptions);
|
|
37983
38008
|
const cachedData = await getCache(cacheKey);
|
|
37984
38009
|
if (cachedData) {
|
|
37985
38010
|
logger129.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -38024,7 +38049,7 @@ function useStatementOfAccountRepo() {
|
|
|
38024
38049
|
} catch (error) {
|
|
38025
38050
|
throw new BadRequestError152("Invalid ID.");
|
|
38026
38051
|
}
|
|
38027
|
-
const cacheKey =
|
|
38052
|
+
const cacheKey = makeCacheKey48(namespace_collection, { _id: String(_id) });
|
|
38028
38053
|
try {
|
|
38029
38054
|
const cached = await getCache(cacheKey);
|
|
38030
38055
|
if (cached) {
|
|
@@ -38665,7 +38690,6 @@ function useStatementOfAccountController() {
|
|
|
38665
38690
|
try {
|
|
38666
38691
|
const _id = req.params.id;
|
|
38667
38692
|
const status = req.params.status;
|
|
38668
|
-
console.log(_id, status);
|
|
38669
38693
|
const result = await _updateStatusById(_id, { status });
|
|
38670
38694
|
res.status(200).json({ message: result });
|
|
38671
38695
|
return;
|
|
@@ -38870,11 +38894,11 @@ import {
|
|
|
38870
38894
|
BadRequestError as BadRequestError156,
|
|
38871
38895
|
InternalServerError as InternalServerError52,
|
|
38872
38896
|
logger as logger133,
|
|
38873
|
-
makeCacheKey as
|
|
38897
|
+
makeCacheKey as makeCacheKey49,
|
|
38874
38898
|
NotFoundError as NotFoundError40,
|
|
38875
38899
|
paginate as paginate44,
|
|
38876
38900
|
useAtlas as useAtlas85,
|
|
38877
|
-
useCache as
|
|
38901
|
+
useCache as useCache51
|
|
38878
38902
|
} from "@7365admin1/node-server-utils";
|
|
38879
38903
|
import { ObjectId as ObjectId101 } from "mongodb";
|
|
38880
38904
|
function useEntryPassSettingsRepo() {
|
|
@@ -38884,7 +38908,7 @@ function useEntryPassSettingsRepo() {
|
|
|
38884
38908
|
}
|
|
38885
38909
|
const namespace_collection = "site.entrypass-settings";
|
|
38886
38910
|
const collection = db.collection(namespace_collection);
|
|
38887
|
-
const { delNamespace, getCache, setCache } =
|
|
38911
|
+
const { delNamespace, getCache, setCache } = useCache51(namespace_collection);
|
|
38888
38912
|
async function createTextIndex() {
|
|
38889
38913
|
try {
|
|
38890
38914
|
await collection.createIndex({
|
|
@@ -38937,7 +38961,7 @@ function useEntryPassSettingsRepo() {
|
|
|
38937
38961
|
const query = {
|
|
38938
38962
|
...status ? { $and: [{ status }, { status: { $ne: "deleted" } }] } : { status: { $ne: "deleted" } }
|
|
38939
38963
|
};
|
|
38940
|
-
const cacheKey =
|
|
38964
|
+
const cacheKey = makeCacheKey49(namespace_collection, cacheOptions);
|
|
38941
38965
|
const cachedData = await getCache(cacheKey);
|
|
38942
38966
|
if (cachedData) {
|
|
38943
38967
|
logger133.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -38990,7 +39014,7 @@ function useEntryPassSettingsRepo() {
|
|
|
38990
39014
|
} catch (error) {
|
|
38991
39015
|
throw new BadRequestError156("Invalid entry pass settings ID format.");
|
|
38992
39016
|
}
|
|
38993
|
-
const cacheKey =
|
|
39017
|
+
const cacheKey = makeCacheKey49(namespace_collection, { _id });
|
|
38994
39018
|
const cachedData = await getCache(cacheKey);
|
|
38995
39019
|
if (cachedData) {
|
|
38996
39020
|
logger133.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -39118,7 +39142,7 @@ function useEntryPassSettingsRepo() {
|
|
|
39118
39142
|
} catch (error) {
|
|
39119
39143
|
throw new BadRequestError156("Invalid entry pass settings ID format.");
|
|
39120
39144
|
}
|
|
39121
|
-
const cacheKey =
|
|
39145
|
+
const cacheKey = makeCacheKey49(namespace_collection, { site });
|
|
39122
39146
|
const cachedData = await getCache(cacheKey);
|
|
39123
39147
|
if (cachedData) {
|
|
39124
39148
|
logger133.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -39444,9 +39468,9 @@ function useEntryPassSettingsController() {
|
|
|
39444
39468
|
import {
|
|
39445
39469
|
InternalServerError as InternalServerError53,
|
|
39446
39470
|
logger as logger135,
|
|
39447
|
-
makeCacheKey as
|
|
39471
|
+
makeCacheKey as makeCacheKey50,
|
|
39448
39472
|
useAtlas as useAtlas86,
|
|
39449
|
-
useCache as
|
|
39473
|
+
useCache as useCache52
|
|
39450
39474
|
} from "@7365admin1/node-server-utils";
|
|
39451
39475
|
function useDashboardRepo() {
|
|
39452
39476
|
const db = useAtlas86.getDb();
|
|
@@ -39457,7 +39481,7 @@ function useDashboardRepo() {
|
|
|
39457
39481
|
const work_order_collection = db.collection("work-orders");
|
|
39458
39482
|
const visitor_collection = db.collection("visitor.transactions");
|
|
39459
39483
|
const namespace_collection = "dashboard";
|
|
39460
|
-
const { delNamespace, getCache, setCache } =
|
|
39484
|
+
const { delNamespace, getCache, setCache } = useCache52(namespace_collection);
|
|
39461
39485
|
async function getAll({
|
|
39462
39486
|
site = ""
|
|
39463
39487
|
}, session) {
|
|
@@ -39468,7 +39492,7 @@ function useDashboardRepo() {
|
|
|
39468
39492
|
const cacheOptions = {
|
|
39469
39493
|
site: site.toString()
|
|
39470
39494
|
};
|
|
39471
|
-
const cacheKey =
|
|
39495
|
+
const cacheKey = makeCacheKey50(namespace_collection, cacheOptions);
|
|
39472
39496
|
const cachedData = await getCache(cacheKey);
|
|
39473
39497
|
if (cachedData) {
|
|
39474
39498
|
logger135.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -39618,10 +39642,10 @@ import {
|
|
|
39618
39642
|
BadRequestError as BadRequestError160,
|
|
39619
39643
|
InternalServerError as InternalServerError54,
|
|
39620
39644
|
logger as logger138,
|
|
39621
|
-
makeCacheKey as
|
|
39645
|
+
makeCacheKey as makeCacheKey51,
|
|
39622
39646
|
paginate as paginate45,
|
|
39623
39647
|
useAtlas as useAtlas87,
|
|
39624
|
-
useCache as
|
|
39648
|
+
useCache as useCache53
|
|
39625
39649
|
} from "@7365admin1/node-server-utils";
|
|
39626
39650
|
import { ObjectId as ObjectId103 } from "mongodb";
|
|
39627
39651
|
function useNfcPatrolRouteRepo() {
|
|
@@ -39631,7 +39655,7 @@ function useNfcPatrolRouteRepo() {
|
|
|
39631
39655
|
}
|
|
39632
39656
|
const namespace_collection = "nfc-patrol-routes";
|
|
39633
39657
|
const collection = db.collection(namespace_collection);
|
|
39634
|
-
const { delNamespace, getCache, setCache } =
|
|
39658
|
+
const { delNamespace, getCache, setCache } = useCache53(namespace_collection);
|
|
39635
39659
|
async function createIndexes() {
|
|
39636
39660
|
try {
|
|
39637
39661
|
await collection.createIndexes([
|
|
@@ -39697,7 +39721,7 @@ function useNfcPatrolRouteRepo() {
|
|
|
39697
39721
|
cacheOptions.search = search;
|
|
39698
39722
|
if (filter)
|
|
39699
39723
|
cacheOptions.filter = filter;
|
|
39700
|
-
const cacheKey =
|
|
39724
|
+
const cacheKey = makeCacheKey51(namespace_collection, cacheOptions);
|
|
39701
39725
|
const cachedData = await getCache(cacheKey);
|
|
39702
39726
|
if (cachedData) {
|
|
39703
39727
|
logger138.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -39748,7 +39772,7 @@ function useNfcPatrolRouteRepo() {
|
|
|
39748
39772
|
if (isStart === true) {
|
|
39749
39773
|
cacheParams.isStart = true;
|
|
39750
39774
|
}
|
|
39751
|
-
const cacheKey =
|
|
39775
|
+
const cacheKey = makeCacheKey51(namespace_collection, cacheParams);
|
|
39752
39776
|
try {
|
|
39753
39777
|
const cached = await getCache(cacheKey);
|
|
39754
39778
|
if (cached) {
|
|
@@ -40370,11 +40394,11 @@ import {
|
|
|
40370
40394
|
BadRequestError as BadRequestError163,
|
|
40371
40395
|
InternalServerError as InternalServerError55,
|
|
40372
40396
|
logger as logger141,
|
|
40373
|
-
makeCacheKey as
|
|
40397
|
+
makeCacheKey as makeCacheKey52,
|
|
40374
40398
|
NotFoundError as NotFoundError43,
|
|
40375
40399
|
paginate as paginate46,
|
|
40376
40400
|
useAtlas as useAtlas89,
|
|
40377
|
-
useCache as
|
|
40401
|
+
useCache as useCache54
|
|
40378
40402
|
} from "@7365admin1/node-server-utils";
|
|
40379
40403
|
import { ObjectId as ObjectId105 } from "mongodb";
|
|
40380
40404
|
var incidents_namespace_collection = "incident-reports";
|
|
@@ -40405,7 +40429,7 @@ function useIncidentReportRepo() {
|
|
|
40405
40429
|
}
|
|
40406
40430
|
}
|
|
40407
40431
|
const collection = db.collection(incidents_namespace_collection);
|
|
40408
|
-
const { delNamespace, getCache, setCache } =
|
|
40432
|
+
const { delNamespace, getCache, setCache } = useCache54(
|
|
40409
40433
|
incidents_namespace_collection
|
|
40410
40434
|
);
|
|
40411
40435
|
async function add(value, session) {
|
|
@@ -40504,7 +40528,7 @@ function useIncidentReportRepo() {
|
|
|
40504
40528
|
if (search) {
|
|
40505
40529
|
cacheOptions.search = search;
|
|
40506
40530
|
}
|
|
40507
|
-
const cacheKey =
|
|
40531
|
+
const cacheKey = makeCacheKey52(incidents_namespace_collection, cacheOptions);
|
|
40508
40532
|
const cachedData = await getCache(cacheKey);
|
|
40509
40533
|
if (cachedData) {
|
|
40510
40534
|
logger141.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -40617,7 +40641,7 @@ function useIncidentReportRepo() {
|
|
|
40617
40641
|
} catch (error) {
|
|
40618
40642
|
throw new BadRequestError163("Invalid incident report ID format.");
|
|
40619
40643
|
}
|
|
40620
|
-
const cacheKey =
|
|
40644
|
+
const cacheKey = makeCacheKey52(incidents_namespace_collection, { _id });
|
|
40621
40645
|
const cachedData = await getCache(cacheKey);
|
|
40622
40646
|
if (cachedData) {
|
|
40623
40647
|
logger141.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -41294,10 +41318,10 @@ import {
|
|
|
41294
41318
|
BadRequestError as BadRequestError167,
|
|
41295
41319
|
InternalServerError as InternalServerError56,
|
|
41296
41320
|
logger as logger144,
|
|
41297
|
-
makeCacheKey as
|
|
41321
|
+
makeCacheKey as makeCacheKey53,
|
|
41298
41322
|
NotFoundError as NotFoundError45,
|
|
41299
41323
|
useAtlas as useAtlas91,
|
|
41300
|
-
useCache as
|
|
41324
|
+
useCache as useCache55
|
|
41301
41325
|
} from "@7365admin1/node-server-utils";
|
|
41302
41326
|
import { ObjectId as ObjectId107 } from "mongodb";
|
|
41303
41327
|
function useNfcPatrolSettingsRepository() {
|
|
@@ -41307,7 +41331,7 @@ function useNfcPatrolSettingsRepository() {
|
|
|
41307
41331
|
}
|
|
41308
41332
|
const namespace_collection = "site.nfc-patrol-settings";
|
|
41309
41333
|
const collection = db.collection(namespace_collection);
|
|
41310
|
-
const { delNamespace, setCache, getCache } =
|
|
41334
|
+
const { delNamespace, setCache, getCache } = useCache55(namespace_collection);
|
|
41311
41335
|
async function createIndexes() {
|
|
41312
41336
|
try {
|
|
41313
41337
|
await collection.createIndexes([{ key: { site: 1 }, unique: true }]);
|
|
@@ -41334,7 +41358,7 @@ function useNfcPatrolSettingsRepository() {
|
|
|
41334
41358
|
throw new BadRequestError167("Invalid nfc patrol settings site ID format.");
|
|
41335
41359
|
}
|
|
41336
41360
|
const query = { site };
|
|
41337
|
-
const cacheKey =
|
|
41361
|
+
const cacheKey = makeCacheKey53(namespace_collection, {
|
|
41338
41362
|
site: site.toString()
|
|
41339
41363
|
});
|
|
41340
41364
|
if (!session) {
|
|
@@ -41549,11 +41573,11 @@ import {
|
|
|
41549
41573
|
BadRequestError as BadRequestError170,
|
|
41550
41574
|
InternalServerError as InternalServerError57,
|
|
41551
41575
|
logger as logger147,
|
|
41552
|
-
makeCacheKey as
|
|
41576
|
+
makeCacheKey as makeCacheKey54,
|
|
41553
41577
|
NotFoundError as NotFoundError46,
|
|
41554
41578
|
paginate as paginate47,
|
|
41555
41579
|
useAtlas as useAtlas93,
|
|
41556
|
-
useCache as
|
|
41580
|
+
useCache as useCache56
|
|
41557
41581
|
} from "@7365admin1/node-server-utils";
|
|
41558
41582
|
|
|
41559
41583
|
// src/models/occurrence-subject.model.ts
|
|
@@ -41630,7 +41654,7 @@ function useOccurrenceSubjectRepo() {
|
|
|
41630
41654
|
}
|
|
41631
41655
|
const namespace_collection = "occurrence-subjects";
|
|
41632
41656
|
const collection = db.collection(namespace_collection);
|
|
41633
|
-
const { delNamespace, getCache, setCache } =
|
|
41657
|
+
const { delNamespace, getCache, setCache } = useCache56(namespace_collection);
|
|
41634
41658
|
async function add(value, session) {
|
|
41635
41659
|
try {
|
|
41636
41660
|
value = MOccurrenceSubject(value);
|
|
@@ -41682,7 +41706,7 @@ function useOccurrenceSubjectRepo() {
|
|
|
41682
41706
|
query.$text = { $search: search };
|
|
41683
41707
|
cacheOptions.search = search;
|
|
41684
41708
|
}
|
|
41685
|
-
const cacheKey =
|
|
41709
|
+
const cacheKey = makeCacheKey54(namespace_collection, cacheOptions);
|
|
41686
41710
|
const cachedData = await getCache(cacheKey);
|
|
41687
41711
|
if (cachedData) {
|
|
41688
41712
|
logger147.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -42202,11 +42226,11 @@ import {
|
|
|
42202
42226
|
BadRequestError as BadRequestError172,
|
|
42203
42227
|
InternalServerError as InternalServerError58,
|
|
42204
42228
|
logger as logger149,
|
|
42205
|
-
makeCacheKey as
|
|
42229
|
+
makeCacheKey as makeCacheKey55,
|
|
42206
42230
|
NotFoundError as NotFoundError47,
|
|
42207
42231
|
paginate as paginate48,
|
|
42208
42232
|
useAtlas as useAtlas95,
|
|
42209
|
-
useCache as
|
|
42233
|
+
useCache as useCache57
|
|
42210
42234
|
} from "@7365admin1/node-server-utils";
|
|
42211
42235
|
import { ObjectId as ObjectId112 } from "mongodb";
|
|
42212
42236
|
function useOnlineFormRepo() {
|
|
@@ -42216,7 +42240,7 @@ function useOnlineFormRepo() {
|
|
|
42216
42240
|
}
|
|
42217
42241
|
const namespace_collection = "online-forms";
|
|
42218
42242
|
const collection = db.collection(namespace_collection);
|
|
42219
|
-
const { delNamespace, getCache, setCache } =
|
|
42243
|
+
const { delNamespace, getCache, setCache } = useCache57(namespace_collection);
|
|
42220
42244
|
async function createTextIndex() {
|
|
42221
42245
|
try {
|
|
42222
42246
|
await collection.createIndex({
|
|
@@ -42283,7 +42307,7 @@ function useOnlineFormRepo() {
|
|
|
42283
42307
|
query.$or = [{ name: { $regex: search, $options: "i" } }];
|
|
42284
42308
|
cacheOptions.search = search;
|
|
42285
42309
|
}
|
|
42286
|
-
const cacheKey =
|
|
42310
|
+
const cacheKey = makeCacheKey55(namespace_collection, cacheOptions);
|
|
42287
42311
|
const cachedData = await getCache(cacheKey);
|
|
42288
42312
|
if (cachedData) {
|
|
42289
42313
|
logger149.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -42324,7 +42348,7 @@ function useOnlineFormRepo() {
|
|
|
42324
42348
|
} catch (error) {
|
|
42325
42349
|
throw new BadRequestError172("Invalid online form ID format.");
|
|
42326
42350
|
}
|
|
42327
|
-
const cacheKey =
|
|
42351
|
+
const cacheKey = makeCacheKey55(namespace_collection, { _id });
|
|
42328
42352
|
const cachedData = await getCache(cacheKey);
|
|
42329
42353
|
if (cachedData) {
|
|
42330
42354
|
logger149.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -42445,7 +42469,7 @@ function useOnlineFormRepo() {
|
|
|
42445
42469
|
cacheOptions.search = search;
|
|
42446
42470
|
}
|
|
42447
42471
|
cacheOptions.site = site;
|
|
42448
|
-
const cacheKey =
|
|
42472
|
+
const cacheKey = makeCacheKey55(namespace_collection, { site });
|
|
42449
42473
|
const cachedData = await getCache(cacheKey);
|
|
42450
42474
|
if (cachedData) {
|
|
42451
42475
|
logger149.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -42959,10 +42983,10 @@ import {
|
|
|
42959
42983
|
BadRequestError as BadRequestError176,
|
|
42960
42984
|
InternalServerError as InternalServerError59,
|
|
42961
42985
|
logger as logger153,
|
|
42962
|
-
makeCacheKey as
|
|
42986
|
+
makeCacheKey as makeCacheKey56,
|
|
42963
42987
|
paginate as paginate49,
|
|
42964
42988
|
useAtlas as useAtlas97,
|
|
42965
|
-
useCache as
|
|
42989
|
+
useCache as useCache58
|
|
42966
42990
|
} from "@7365admin1/node-server-utils";
|
|
42967
42991
|
import { ObjectId as ObjectId114 } from "mongodb";
|
|
42968
42992
|
function useNfcPatrolLogRepo() {
|
|
@@ -42972,7 +42996,7 @@ function useNfcPatrolLogRepo() {
|
|
|
42972
42996
|
}
|
|
42973
42997
|
const namespace_collection = "nfc-patrol-logs";
|
|
42974
42998
|
const collection = db.collection(namespace_collection);
|
|
42975
|
-
const { delNamespace, getCache, setCache } =
|
|
42999
|
+
const { delNamespace, getCache, setCache } = useCache58(namespace_collection);
|
|
42976
43000
|
async function createIndexes() {
|
|
42977
43001
|
try {
|
|
42978
43002
|
await collection.createIndexes([
|
|
@@ -43046,7 +43070,7 @@ function useNfcPatrolLogRepo() {
|
|
|
43046
43070
|
if (route?.startTime) {
|
|
43047
43071
|
cacheOptions.routeStartTime = route?.startTime;
|
|
43048
43072
|
}
|
|
43049
|
-
const cacheKey =
|
|
43073
|
+
const cacheKey = makeCacheKey56(namespace_collection, cacheOptions);
|
|
43050
43074
|
const cachedData = await getCache(cacheKey);
|
|
43051
43075
|
if (cachedData) {
|
|
43052
43076
|
logger153.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -43200,10 +43224,10 @@ import {
|
|
|
43200
43224
|
BadRequestError as BadRequestError179,
|
|
43201
43225
|
InternalServerError as InternalServerError60,
|
|
43202
43226
|
logger as logger156,
|
|
43203
|
-
makeCacheKey as
|
|
43227
|
+
makeCacheKey as makeCacheKey57,
|
|
43204
43228
|
toObjectId as toObjectId15,
|
|
43205
43229
|
useAtlas as useAtlas99,
|
|
43206
|
-
useCache as
|
|
43230
|
+
useCache as useCache59
|
|
43207
43231
|
} from "@7365admin1/node-server-utils";
|
|
43208
43232
|
var Period = /* @__PURE__ */ ((Period2) => {
|
|
43209
43233
|
Period2["TODAY"] = "today";
|
|
@@ -43289,7 +43313,7 @@ function useNewDashboardRepo() {
|
|
|
43289
43313
|
if (!db) {
|
|
43290
43314
|
throw new InternalServerError60("Unable to connect to server.");
|
|
43291
43315
|
}
|
|
43292
|
-
const { delNamespace, getCache, setCache } =
|
|
43316
|
+
const { delNamespace, getCache, setCache } = useCache59(
|
|
43293
43317
|
securityDashboardCollection
|
|
43294
43318
|
);
|
|
43295
43319
|
async function getMetric(collectionString, siteId, period) {
|
|
@@ -43334,7 +43358,7 @@ function useNewDashboardRepo() {
|
|
|
43334
43358
|
visitor,
|
|
43335
43359
|
incident
|
|
43336
43360
|
};
|
|
43337
|
-
const cacheKey =
|
|
43361
|
+
const cacheKey = makeCacheKey57(securityDashboardCollection, cacheOptions);
|
|
43338
43362
|
const cachedData = await getCache(cacheKey);
|
|
43339
43363
|
if (cachedData) {
|
|
43340
43364
|
logger156.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -43413,7 +43437,7 @@ function useNewDashboardRepo() {
|
|
|
43413
43437
|
visitor,
|
|
43414
43438
|
incident
|
|
43415
43439
|
};
|
|
43416
|
-
const cacheKey =
|
|
43440
|
+
const cacheKey = makeCacheKey57(PMDashboardCollection, cacheOptions);
|
|
43417
43441
|
const cachedData = await getCache(cacheKey);
|
|
43418
43442
|
if (cachedData) {
|
|
43419
43443
|
logger156.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -43494,7 +43518,7 @@ function useNewDashboardRepo() {
|
|
|
43494
43518
|
feedback,
|
|
43495
43519
|
workOrder
|
|
43496
43520
|
};
|
|
43497
|
-
const cacheKey =
|
|
43521
|
+
const cacheKey = makeCacheKey57(pestDashboardCollection, cacheOptions);
|
|
43498
43522
|
const cachedData = await getCache(cacheKey);
|
|
43499
43523
|
if (cachedData) {
|
|
43500
43524
|
logger156.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -43531,7 +43555,7 @@ function useNewDashboardRepo() {
|
|
|
43531
43555
|
feedback,
|
|
43532
43556
|
workOrder
|
|
43533
43557
|
};
|
|
43534
|
-
const cacheKey =
|
|
43558
|
+
const cacheKey = makeCacheKey57(poolDashboardCollection, cacheOptions);
|
|
43535
43559
|
const cachedData = await getCache(cacheKey);
|
|
43536
43560
|
if (cachedData) {
|
|
43537
43561
|
logger156.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -43568,7 +43592,7 @@ function useNewDashboardRepo() {
|
|
|
43568
43592
|
feedback,
|
|
43569
43593
|
workOrder
|
|
43570
43594
|
};
|
|
43571
|
-
const cacheKey =
|
|
43595
|
+
const cacheKey = makeCacheKey57(mAndEDashboardCollection, cacheOptions);
|
|
43572
43596
|
const cachedData = await getCache(cacheKey);
|
|
43573
43597
|
if (cachedData) {
|
|
43574
43598
|
logger156.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -43605,7 +43629,7 @@ function useNewDashboardRepo() {
|
|
|
43605
43629
|
feedback,
|
|
43606
43630
|
workOrder
|
|
43607
43631
|
};
|
|
43608
|
-
const cacheKey =
|
|
43632
|
+
const cacheKey = makeCacheKey57(landscapeDashboardCollection, cacheOptions);
|
|
43609
43633
|
const cachedData = await getCache(cacheKey);
|
|
43610
43634
|
if (cachedData) {
|
|
43611
43635
|
logger156.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -43943,6 +43967,8 @@ var MManpowerMonitoring = class {
|
|
|
43943
43967
|
// src/repositories/manpower-monitoring.repo.ts
|
|
43944
43968
|
import {
|
|
43945
43969
|
BadRequestError as BadRequestError181,
|
|
43970
|
+
InternalServerError as InternalServerError61,
|
|
43971
|
+
logger as logger158,
|
|
43946
43972
|
paginate as paginate51,
|
|
43947
43973
|
useAtlas as useAtlas100
|
|
43948
43974
|
} from "@7365admin1/node-server-utils";
|
|
@@ -44405,6 +44431,25 @@ function useManpowerMonitoringRepo() {
|
|
|
44405
44431
|
const namespace_collection = "manpower-settings";
|
|
44406
44432
|
const collection = db.collection(namespace_collection);
|
|
44407
44433
|
const serviceProviderCollection = db.collection("site.service-providers");
|
|
44434
|
+
async function createIndexes() {
|
|
44435
|
+
try {
|
|
44436
|
+
await collection.createIndexes([
|
|
44437
|
+
{
|
|
44438
|
+
key: { siteId: 1 }
|
|
44439
|
+
},
|
|
44440
|
+
{ key: { createdAt: 1 } }
|
|
44441
|
+
]);
|
|
44442
|
+
return `Successfully created indexes for ${namespace_collection}.`;
|
|
44443
|
+
} catch (error) {
|
|
44444
|
+
logger158.log({
|
|
44445
|
+
level: "error",
|
|
44446
|
+
message: error.message
|
|
44447
|
+
});
|
|
44448
|
+
throw new InternalServerError61(
|
|
44449
|
+
"Failed to create general indexes on manpower monitoring."
|
|
44450
|
+
);
|
|
44451
|
+
}
|
|
44452
|
+
}
|
|
44408
44453
|
async function createManpowerMonitoringSettings(value, session) {
|
|
44409
44454
|
try {
|
|
44410
44455
|
value = new MManpowerMonitoring(value);
|
|
@@ -44581,7 +44626,8 @@ function useManpowerMonitoringRepo() {
|
|
|
44581
44626
|
getManpowerSettingsBySiteId,
|
|
44582
44627
|
updateManpowerMonitoringSettings,
|
|
44583
44628
|
multipleManpowerMonitoringSettings,
|
|
44584
|
-
getAllSites
|
|
44629
|
+
getAllSites,
|
|
44630
|
+
createIndexes
|
|
44585
44631
|
};
|
|
44586
44632
|
}
|
|
44587
44633
|
|
|
@@ -44595,6 +44641,8 @@ import {
|
|
|
44595
44641
|
// src/repositories/manpower-remarks.repo.ts
|
|
44596
44642
|
import {
|
|
44597
44643
|
BadRequestError as BadRequestError182,
|
|
44644
|
+
InternalServerError as InternalServerError62,
|
|
44645
|
+
logger as logger159,
|
|
44598
44646
|
paginate as paginate52,
|
|
44599
44647
|
useAtlas as useAtlas101
|
|
44600
44648
|
} from "@7365admin1/node-server-utils";
|
|
@@ -44652,6 +44700,25 @@ function useManpowerRemarksRepo() {
|
|
|
44652
44700
|
}
|
|
44653
44701
|
const namespace_collection = "manpower-remarks";
|
|
44654
44702
|
const collection = db.collection(namespace_collection);
|
|
44703
|
+
async function createIndexes() {
|
|
44704
|
+
try {
|
|
44705
|
+
await collection.createIndexes([
|
|
44706
|
+
{
|
|
44707
|
+
key: { siteId: 1 }
|
|
44708
|
+
},
|
|
44709
|
+
{ key: { createdAt: 1 } }
|
|
44710
|
+
]);
|
|
44711
|
+
return `Successfully created indexes for ${namespace_collection}.`;
|
|
44712
|
+
} catch (error) {
|
|
44713
|
+
logger159.log({
|
|
44714
|
+
level: "error",
|
|
44715
|
+
message: error.message
|
|
44716
|
+
});
|
|
44717
|
+
throw new InternalServerError62(
|
|
44718
|
+
"Failed to create general indexes on manpower remarks."
|
|
44719
|
+
);
|
|
44720
|
+
}
|
|
44721
|
+
}
|
|
44655
44722
|
async function createManpowerRemarks(value, session) {
|
|
44656
44723
|
try {
|
|
44657
44724
|
value = new MManpowerRemarks(value);
|
|
@@ -44774,7 +44841,8 @@ function useManpowerRemarksRepo() {
|
|
|
44774
44841
|
getManpowerRemarksAllSite,
|
|
44775
44842
|
getManpowerRemarksBySiteId,
|
|
44776
44843
|
updateManpowerRemarks,
|
|
44777
|
-
updateRemarksStatus
|
|
44844
|
+
updateRemarksStatus,
|
|
44845
|
+
createIndexes
|
|
44778
44846
|
};
|
|
44779
44847
|
}
|
|
44780
44848
|
|
|
@@ -44786,7 +44854,6 @@ function useManpowerMonitoringSrvc() {
|
|
|
44786
44854
|
} = useManpowerMonitoringRepo();
|
|
44787
44855
|
const { createManpowerRemarks: _createManpowerRemarks } = useManpowerRemarksRepo();
|
|
44788
44856
|
async function createManpowerMonitoringSettings(payload) {
|
|
44789
|
-
console.log("Im here now at service");
|
|
44790
44857
|
const session = useAtlas102.getClient()?.startSession();
|
|
44791
44858
|
if (!session) {
|
|
44792
44859
|
throw new BadRequestError183("Database session not available.");
|
|
@@ -44802,7 +44869,6 @@ function useManpowerMonitoringSrvc() {
|
|
|
44802
44869
|
const afternoonAlertTime = afternoonCheckInTime ? moment3.tz(afternoonCheckInTime, "HH:mm", "Asia/Singapore").add(afternoonAlertFrequencyMins, "minutes").format("HH:mm") : "";
|
|
44803
44870
|
const nightAlertTime = moment3.tz(nightCheckInTime, "HH:mm", "Asia/Singapore").add(nightAlertFrequencyMins, "minutes").format("HH:mm");
|
|
44804
44871
|
const nowSGT = moment3().tz("Asia/Singapore");
|
|
44805
|
-
console.log("im done preparing the payload");
|
|
44806
44872
|
try {
|
|
44807
44873
|
const remarksPayload = {
|
|
44808
44874
|
siteId: payload.siteId,
|
|
@@ -44961,7 +45027,6 @@ function useManpowerMonitoringCtrl() {
|
|
|
44961
45027
|
});
|
|
44962
45028
|
const _id = req.params.id;
|
|
44963
45029
|
const payload = { ...req.body };
|
|
44964
|
-
console.log("_id", _id);
|
|
44965
45030
|
const { error } = validation.validate({ _id, ...payload });
|
|
44966
45031
|
if (error) {
|
|
44967
45032
|
next(new BadRequestError184(error.message));
|
|
@@ -45056,6 +45121,8 @@ var MManpowerDesignations = class {
|
|
|
45056
45121
|
|
|
45057
45122
|
// src/repositories/manpower-designations.repo.ts
|
|
45058
45123
|
import {
|
|
45124
|
+
InternalServerError as InternalServerError63,
|
|
45125
|
+
logger as logger162,
|
|
45059
45126
|
useAtlas as useAtlas103
|
|
45060
45127
|
} from "@7365admin1/node-server-utils";
|
|
45061
45128
|
import { ObjectId as ObjectId120 } from "mongodb";
|
|
@@ -45066,6 +45133,25 @@ function useManpowerDesignationRepo() {
|
|
|
45066
45133
|
}
|
|
45067
45134
|
const namespace_collection = "manpower-designations";
|
|
45068
45135
|
const collection = db.collection(namespace_collection);
|
|
45136
|
+
async function createIndexes() {
|
|
45137
|
+
try {
|
|
45138
|
+
await collection.createIndexes([
|
|
45139
|
+
{
|
|
45140
|
+
key: { siteId: 1 }
|
|
45141
|
+
},
|
|
45142
|
+
{ key: { createdAt: 1 } }
|
|
45143
|
+
]);
|
|
45144
|
+
return `Successfully created indexes for ${namespace_collection}.`;
|
|
45145
|
+
} catch (error) {
|
|
45146
|
+
logger162.log({
|
|
45147
|
+
level: "error",
|
|
45148
|
+
message: error.message
|
|
45149
|
+
});
|
|
45150
|
+
throw new InternalServerError63(
|
|
45151
|
+
"Failed to create general indexes on manpower designations."
|
|
45152
|
+
);
|
|
45153
|
+
}
|
|
45154
|
+
}
|
|
45069
45155
|
async function createManpowerDesignations(value) {
|
|
45070
45156
|
try {
|
|
45071
45157
|
value = new MManpowerDesignations(value);
|
|
@@ -45121,7 +45207,8 @@ function useManpowerDesignationRepo() {
|
|
|
45121
45207
|
return {
|
|
45122
45208
|
createManpowerDesignations,
|
|
45123
45209
|
getManpowerDesignationsBySiteId,
|
|
45124
|
-
updateManpowerDesignations
|
|
45210
|
+
updateManpowerDesignations,
|
|
45211
|
+
createIndexes
|
|
45125
45212
|
};
|
|
45126
45213
|
}
|
|
45127
45214
|
|
|
@@ -45270,10 +45357,10 @@ function MOvernightParkingApprovalHours(value) {
|
|
|
45270
45357
|
import {
|
|
45271
45358
|
InternalServerError as InternalServerError64,
|
|
45272
45359
|
logger as logger164,
|
|
45273
|
-
makeCacheKey as
|
|
45360
|
+
makeCacheKey as makeCacheKey61,
|
|
45274
45361
|
toObjectId as toObjectId16,
|
|
45275
45362
|
useAtlas as useAtlas104,
|
|
45276
|
-
useCache as
|
|
45363
|
+
useCache as useCache63
|
|
45277
45364
|
} from "@7365admin1/node-server-utils";
|
|
45278
45365
|
var overnight_parking_namespace_collection = "site.overnight-parking";
|
|
45279
45366
|
function useOvernightParkingRepo() {
|
|
@@ -45282,7 +45369,7 @@ function useOvernightParkingRepo() {
|
|
|
45282
45369
|
throw new InternalServerError64("Unable to connect to server.");
|
|
45283
45370
|
}
|
|
45284
45371
|
const collection = db.collection(overnight_parking_namespace_collection);
|
|
45285
|
-
const { delNamespace, setCache, getCache } =
|
|
45372
|
+
const { delNamespace, setCache, getCache } = useCache63(
|
|
45286
45373
|
overnight_parking_namespace_collection
|
|
45287
45374
|
);
|
|
45288
45375
|
async function createIndexes() {
|
|
@@ -45351,7 +45438,7 @@ function useOvernightParkingRepo() {
|
|
|
45351
45438
|
}
|
|
45352
45439
|
async function getSiteOvernightParking(site) {
|
|
45353
45440
|
const siteId = toObjectId16(site);
|
|
45354
|
-
const cacheKey =
|
|
45441
|
+
const cacheKey = makeCacheKey61(overnight_parking_namespace_collection, {
|
|
45355
45442
|
site
|
|
45356
45443
|
});
|
|
45357
45444
|
const cachedData = await getCache(cacheKey);
|
|
@@ -45498,11 +45585,11 @@ import {
|
|
|
45498
45585
|
BadRequestError as BadRequestError189,
|
|
45499
45586
|
InternalServerError as InternalServerError65,
|
|
45500
45587
|
logger as logger166,
|
|
45501
|
-
makeCacheKey as
|
|
45588
|
+
makeCacheKey as makeCacheKey62,
|
|
45502
45589
|
paginate as paginate55,
|
|
45503
45590
|
toObjectId as toObjectId18,
|
|
45504
45591
|
useAtlas as useAtlas105,
|
|
45505
|
-
useCache as
|
|
45592
|
+
useCache as useCache64
|
|
45506
45593
|
} from "@7365admin1/node-server-utils";
|
|
45507
45594
|
var overnight_parking_requests_namespace_collection = "site.overnight-parking-requests";
|
|
45508
45595
|
function useOvernightParkingRequestRepo() {
|
|
@@ -45513,7 +45600,7 @@ function useOvernightParkingRequestRepo() {
|
|
|
45513
45600
|
const collection = db.collection(
|
|
45514
45601
|
overnight_parking_requests_namespace_collection
|
|
45515
45602
|
);
|
|
45516
|
-
const { delNamespace, getCache, setCache } =
|
|
45603
|
+
const { delNamespace, getCache, setCache } = useCache64(
|
|
45517
45604
|
overnight_parking_requests_namespace_collection
|
|
45518
45605
|
);
|
|
45519
45606
|
async function createIndexes() {
|
|
@@ -45580,7 +45667,7 @@ function useOvernightParkingRequestRepo() {
|
|
|
45580
45667
|
sort: JSON.stringify(sort),
|
|
45581
45668
|
...status && { status }
|
|
45582
45669
|
};
|
|
45583
|
-
const cacheKey =
|
|
45670
|
+
const cacheKey = makeCacheKey62(
|
|
45584
45671
|
overnight_parking_requests_namespace_collection,
|
|
45585
45672
|
cacheOptions
|
|
45586
45673
|
);
|
|
@@ -45610,7 +45697,7 @@ function useOvernightParkingRequestRepo() {
|
|
|
45610
45697
|
}
|
|
45611
45698
|
async function getOvernightParkingRequestById(id) {
|
|
45612
45699
|
try {
|
|
45613
|
-
const cacheKey =
|
|
45700
|
+
const cacheKey = makeCacheKey62(
|
|
45614
45701
|
overnight_parking_requests_namespace_collection,
|
|
45615
45702
|
{ id }
|
|
45616
45703
|
);
|
|
@@ -48720,7 +48807,7 @@ import {
|
|
|
48720
48807
|
comparePassword as comparePassword3,
|
|
48721
48808
|
InternalServerError as InternalServerError71,
|
|
48722
48809
|
NotFoundError as NotFoundError53,
|
|
48723
|
-
useCache as
|
|
48810
|
+
useCache as useCache67
|
|
48724
48811
|
} from "@7365admin1/node-server-utils";
|
|
48725
48812
|
import { v4 as uuidv42 } from "uuid";
|
|
48726
48813
|
|
|
@@ -48734,8 +48821,8 @@ import {
|
|
|
48734
48821
|
paginate as paginate58,
|
|
48735
48822
|
NotFoundError as NotFoundError52,
|
|
48736
48823
|
AppError as AppError28,
|
|
48737
|
-
useCache as
|
|
48738
|
-
makeCacheKey as
|
|
48824
|
+
useCache as useCache66,
|
|
48825
|
+
makeCacheKey as makeCacheKey64,
|
|
48739
48826
|
toObjectId as toObjectId19
|
|
48740
48827
|
} from "@7365admin1/node-server-utils";
|
|
48741
48828
|
function useUserRepoV2() {
|
|
@@ -48748,7 +48835,7 @@ function useUserRepoV2() {
|
|
|
48748
48835
|
}
|
|
48749
48836
|
const namespace_collection = "users";
|
|
48750
48837
|
const collection = db.collection(namespace_collection);
|
|
48751
|
-
const { delNamespace, setCache, getCache, delCache } =
|
|
48838
|
+
const { delNamespace, setCache, getCache, delCache } = useCache66(namespace_collection);
|
|
48752
48839
|
async function createIndex() {
|
|
48753
48840
|
try {
|
|
48754
48841
|
await collection.createIndexes([{ key: { email: 1 } }]);
|
|
@@ -48796,7 +48883,7 @@ function useUserRepoV2() {
|
|
|
48796
48883
|
}
|
|
48797
48884
|
async function getUserByEmail(email) {
|
|
48798
48885
|
try {
|
|
48799
|
-
const cacheKey =
|
|
48886
|
+
const cacheKey = makeCacheKey64(namespace_collection, { email });
|
|
48800
48887
|
const cachedData = await getCache(cacheKey);
|
|
48801
48888
|
if (cachedData) {
|
|
48802
48889
|
logger180.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -48815,7 +48902,7 @@ function useUserRepoV2() {
|
|
|
48815
48902
|
}
|
|
48816
48903
|
async function getUserByEmailStatus(email) {
|
|
48817
48904
|
try {
|
|
48818
|
-
const cacheKey =
|
|
48905
|
+
const cacheKey = makeCacheKey64(namespace_collection, {
|
|
48819
48906
|
email,
|
|
48820
48907
|
status: "complete" /* COMPLETE */
|
|
48821
48908
|
});
|
|
@@ -48839,7 +48926,7 @@ function useUserRepoV2() {
|
|
|
48839
48926
|
async function getUserById(id) {
|
|
48840
48927
|
const _id = toObjectId19(id);
|
|
48841
48928
|
try {
|
|
48842
|
-
const cacheKey =
|
|
48929
|
+
const cacheKey = makeCacheKey64(namespace_collection, { id });
|
|
48843
48930
|
const cachedData = await getCache(cacheKey);
|
|
48844
48931
|
if (cachedData) {
|
|
48845
48932
|
logger180.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -48878,7 +48965,7 @@ function useUserRepoV2() {
|
|
|
48878
48965
|
}
|
|
48879
48966
|
async function getUserByReferralCode(referralCode) {
|
|
48880
48967
|
try {
|
|
48881
|
-
const cacheKey =
|
|
48968
|
+
const cacheKey = makeCacheKey64(namespace_collection, { referralCode });
|
|
48882
48969
|
const cachedData = await getCache(cacheKey);
|
|
48883
48970
|
if (cachedData) {
|
|
48884
48971
|
logger180.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -48895,7 +48982,7 @@ function useUserRepoV2() {
|
|
|
48895
48982
|
}
|
|
48896
48983
|
async function getByEmailApp(email, app) {
|
|
48897
48984
|
try {
|
|
48898
|
-
const cacheKey =
|
|
48985
|
+
const cacheKey = makeCacheKey64(namespace_collection, { email, app });
|
|
48899
48986
|
const cachedData = await getCache(cacheKey);
|
|
48900
48987
|
if (cachedData) {
|
|
48901
48988
|
logger180.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -48951,7 +49038,7 @@ function useUserRepoV2() {
|
|
|
48951
49038
|
err
|
|
48952
49039
|
);
|
|
48953
49040
|
});
|
|
48954
|
-
const cacheKey =
|
|
49041
|
+
const cacheKey = makeCacheKey64(namespace_collection, cacheOptions);
|
|
48955
49042
|
const cachedData = await getCache(cacheKey);
|
|
48956
49043
|
if (cachedData) {
|
|
48957
49044
|
logger180.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -49015,7 +49102,7 @@ function useUserRepoV2() {
|
|
|
49015
49102
|
err
|
|
49016
49103
|
)
|
|
49017
49104
|
);
|
|
49018
|
-
const cacheKey =
|
|
49105
|
+
const cacheKey = makeCacheKey64(namespace_collection, cacheOptions);
|
|
49019
49106
|
const cachedData = await getCache(cacheKey);
|
|
49020
49107
|
if (cachedData) {
|
|
49021
49108
|
logger180.info(`Cache hit for key: ${cacheKey}`);
|
|
@@ -49041,7 +49128,7 @@ function useUserRepoV2() {
|
|
|
49041
49128
|
}
|
|
49042
49129
|
}
|
|
49043
49130
|
async function updatePasswordById({ _id, password }, session) {
|
|
49044
|
-
const cacheKey =
|
|
49131
|
+
const cacheKey = makeCacheKey64(namespace_collection, { _id });
|
|
49045
49132
|
_id = toObjectId19(_id);
|
|
49046
49133
|
try {
|
|
49047
49134
|
const result = await collection.updateOne(
|
|
@@ -49105,7 +49192,7 @@ function useUserRepoV2() {
|
|
|
49105
49192
|
// Dynamically set the field
|
|
49106
49193
|
{ session }
|
|
49107
49194
|
);
|
|
49108
|
-
const cacheKey =
|
|
49195
|
+
const cacheKey = makeCacheKey64(namespace_collection, { _id });
|
|
49109
49196
|
delCache(cacheKey).then(() => {
|
|
49110
49197
|
logger180.info(`Cache deleted for key: ${cacheKey}`);
|
|
49111
49198
|
}).catch((err) => {
|
|
@@ -49140,7 +49227,7 @@ function useUserRepoV2() {
|
|
|
49140
49227
|
},
|
|
49141
49228
|
{ session }
|
|
49142
49229
|
);
|
|
49143
|
-
const cacheKey =
|
|
49230
|
+
const cacheKey = makeCacheKey64(namespace_collection, { _id });
|
|
49144
49231
|
delCache(cacheKey).then(() => {
|
|
49145
49232
|
logger180.info(`Cache deleted for key: ${cacheKey}`);
|
|
49146
49233
|
}).catch((err) => {
|
|
@@ -49163,7 +49250,7 @@ function useUserRepoV2() {
|
|
|
49163
49250
|
{ $set: { password, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } },
|
|
49164
49251
|
{ session }
|
|
49165
49252
|
);
|
|
49166
|
-
const cacheKey =
|
|
49253
|
+
const cacheKey = makeCacheKey64(namespace_collection, { _id });
|
|
49167
49254
|
delCache(cacheKey).then(() => {
|
|
49168
49255
|
logger180.info(`Cache deleted for key: ${cacheKey}`);
|
|
49169
49256
|
}).catch((err) => {
|
|
@@ -49195,7 +49282,7 @@ function useUserRepoV2() {
|
|
|
49195
49282
|
function useAuthServiceV2() {
|
|
49196
49283
|
const { getUserByEmail, getUserById: _getUserById } = useUserRepoV2();
|
|
49197
49284
|
const expiresIn = "15m";
|
|
49198
|
-
const { setCache, delCache } =
|
|
49285
|
+
const { setCache, delCache } = useCache67("sessions");
|
|
49199
49286
|
const { getByUserIdType } = useMemberRepo();
|
|
49200
49287
|
async function login({
|
|
49201
49288
|
email,
|
|
@@ -49963,7 +50050,7 @@ import {
|
|
|
49963
50050
|
InternalServerError as InternalServerError73,
|
|
49964
50051
|
useAtlas as useAtlas116,
|
|
49965
50052
|
logger as logger184,
|
|
49966
|
-
useCache as
|
|
50053
|
+
useCache as useCache68
|
|
49967
50054
|
} from "@7365admin1/node-server-utils";
|
|
49968
50055
|
function useRoleRepoV2() {
|
|
49969
50056
|
const db = useAtlas116.getDb();
|
|
@@ -50000,7 +50087,7 @@ function useRoleRepoV2() {
|
|
|
50000
50087
|
throw new InternalServerError73("Failed to create unique index on role.");
|
|
50001
50088
|
}
|
|
50002
50089
|
}
|
|
50003
|
-
const { delNamespace } =
|
|
50090
|
+
const { delNamespace } = useCache68(namespace_collection);
|
|
50004
50091
|
async function addRole(value, session) {
|
|
50005
50092
|
value = new MRoleV2(value);
|
|
50006
50093
|
try {
|