@7365admin1/core 2.10.0 → 2.11.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/.github/workflows/main.yml +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +961 -627
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +396 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/public/rsa-keys/new_rsa_512_priv.pem +0 -3
- package/dist/public/rsa-keys/new_rsa_512_pub.pem +0 -3
package/dist/index.mjs
CHANGED
|
@@ -934,6 +934,7 @@ function useWorkOrderRepo() {
|
|
|
934
934
|
}
|
|
935
935
|
}
|
|
936
936
|
const { delNamespace, setCache, getCache, delCache } = useCache3(namespace_collection);
|
|
937
|
+
const { delNamespace: _delDashboardNameSpace } = useCache3("dashboard");
|
|
937
938
|
async function createWorkOrder(value, session) {
|
|
938
939
|
try {
|
|
939
940
|
value = MWorkOrder(value);
|
|
@@ -946,6 +947,11 @@ function useWorkOrderRepo() {
|
|
|
946
947
|
err
|
|
947
948
|
);
|
|
948
949
|
});
|
|
950
|
+
_delDashboardNameSpace().then(() => {
|
|
951
|
+
logger5.info(`Cache cleared for namespace: dashboard`);
|
|
952
|
+
}).catch((err) => {
|
|
953
|
+
logger5.error(`Failed to clear cache for namespace: dashboard`, err);
|
|
954
|
+
});
|
|
949
955
|
return res.insertedId;
|
|
950
956
|
} catch (error) {
|
|
951
957
|
throw error;
|
|
@@ -1182,11 +1188,18 @@ function useWorkOrderRepo() {
|
|
|
1182
1188
|
if (res.modifiedCount === 0) {
|
|
1183
1189
|
throw new InternalServerError3("Unable to update work order.");
|
|
1184
1190
|
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
logger5.info(`Cache deleted for key: ${cacheKey}`);
|
|
1191
|
+
delNamespace().then(() => {
|
|
1192
|
+
logger5.info(`Cache cleared for namespace: ${namespace_collection}`);
|
|
1188
1193
|
}).catch((err) => {
|
|
1189
|
-
logger5.error(
|
|
1194
|
+
logger5.error(
|
|
1195
|
+
`Failed to clear cache for namespace: ${namespace_collection}`,
|
|
1196
|
+
err
|
|
1197
|
+
);
|
|
1198
|
+
});
|
|
1199
|
+
_delDashboardNameSpace().then(() => {
|
|
1200
|
+
logger5.info(`Cache cleared for namespace: dashboard`);
|
|
1201
|
+
}).catch((err) => {
|
|
1202
|
+
logger5.error(`Failed to clear cache for namespace: dashboard`, err);
|
|
1190
1203
|
});
|
|
1191
1204
|
return res.modifiedCount;
|
|
1192
1205
|
} catch (error) {
|
|
@@ -1209,11 +1222,18 @@ function useWorkOrderRepo() {
|
|
|
1209
1222
|
if (res.modifiedCount === 0) {
|
|
1210
1223
|
throw new InternalServerError3("Unable to update work order status.");
|
|
1211
1224
|
}
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1225
|
+
delNamespace().then(() => {
|
|
1226
|
+
logger5.info(`Cache cleared for namespace: ${namespace_collection}`);
|
|
1227
|
+
}).catch((err) => {
|
|
1228
|
+
logger5.error(
|
|
1229
|
+
`Failed to clear cache for namespace: ${namespace_collection}`,
|
|
1230
|
+
err
|
|
1231
|
+
);
|
|
1232
|
+
});
|
|
1233
|
+
_delDashboardNameSpace().then(() => {
|
|
1234
|
+
logger5.info(`Cache cleared for namespace: dashboard`);
|
|
1215
1235
|
}).catch((err) => {
|
|
1216
|
-
logger5.error(`Failed to
|
|
1236
|
+
logger5.error(`Failed to clear cache for namespace: dashboard`, err);
|
|
1217
1237
|
});
|
|
1218
1238
|
return res.modifiedCount;
|
|
1219
1239
|
} catch (error) {
|
|
@@ -1231,11 +1251,18 @@ function useWorkOrderRepo() {
|
|
|
1231
1251
|
{ $set: updateValue },
|
|
1232
1252
|
session
|
|
1233
1253
|
);
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
logger5.info(`Cache deleted for key: ${cacheKey}`);
|
|
1254
|
+
delNamespace().then(() => {
|
|
1255
|
+
logger5.info(`Cache cleared for namespace: ${namespace_collection}`);
|
|
1237
1256
|
}).catch((err) => {
|
|
1238
|
-
logger5.error(
|
|
1257
|
+
logger5.error(
|
|
1258
|
+
`Failed to clear cache for namespace: ${namespace_collection}`,
|
|
1259
|
+
err
|
|
1260
|
+
);
|
|
1261
|
+
});
|
|
1262
|
+
_delDashboardNameSpace().then(() => {
|
|
1263
|
+
logger5.info(`Cache cleared for namespace: dashboard`);
|
|
1264
|
+
}).catch((err) => {
|
|
1265
|
+
logger5.error(`Failed to clear cache for namespace: dashboard`, err);
|
|
1239
1266
|
});
|
|
1240
1267
|
return res.modifiedCount;
|
|
1241
1268
|
} catch (error) {
|
|
@@ -1265,11 +1292,18 @@ function useWorkOrderRepo() {
|
|
|
1265
1292
|
"Unable to mark work order as completed."
|
|
1266
1293
|
);
|
|
1267
1294
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1295
|
+
delNamespace().then(() => {
|
|
1296
|
+
logger5.info(`Cache cleared for namespace: ${namespace_collection}`);
|
|
1297
|
+
}).catch((err) => {
|
|
1298
|
+
logger5.error(
|
|
1299
|
+
`Failed to clear cache for namespace: ${namespace_collection}`,
|
|
1300
|
+
err
|
|
1301
|
+
);
|
|
1302
|
+
});
|
|
1303
|
+
_delDashboardNameSpace().then(() => {
|
|
1304
|
+
logger5.info(`Cache cleared for namespace: dashboard`);
|
|
1271
1305
|
}).catch((err) => {
|
|
1272
|
-
logger5.error(`Failed to
|
|
1306
|
+
logger5.error(`Failed to clear cache for namespace: dashboard`, err);
|
|
1273
1307
|
});
|
|
1274
1308
|
return res.modifiedCount;
|
|
1275
1309
|
} catch (error) {
|
|
@@ -1296,11 +1330,18 @@ function useWorkOrderRepo() {
|
|
|
1296
1330
|
if (res.modifiedCount === 0) {
|
|
1297
1331
|
throw new InternalServerError3("Unable to delete work order.");
|
|
1298
1332
|
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
logger5.info(`Cache deleted for key: ${cacheKey}`);
|
|
1333
|
+
delNamespace().then(() => {
|
|
1334
|
+
logger5.info(`Cache cleared for namespace: ${namespace_collection}`);
|
|
1302
1335
|
}).catch((err) => {
|
|
1303
|
-
logger5.error(
|
|
1336
|
+
logger5.error(
|
|
1337
|
+
`Failed to clear cache for namespace: ${namespace_collection}`,
|
|
1338
|
+
err
|
|
1339
|
+
);
|
|
1340
|
+
});
|
|
1341
|
+
_delDashboardNameSpace().then(() => {
|
|
1342
|
+
logger5.info(`Cache cleared for namespace: dashboard`);
|
|
1343
|
+
}).catch((err) => {
|
|
1344
|
+
logger5.error(`Failed to clear cache for namespace: dashboard`, err);
|
|
1304
1345
|
});
|
|
1305
1346
|
return res.modifiedCount;
|
|
1306
1347
|
} catch (error) {
|
|
@@ -2858,6 +2899,14 @@ function useVerificationRepo() {
|
|
|
2858
2899
|
throw new InternalServerError7("Error updating verification status.");
|
|
2859
2900
|
}
|
|
2860
2901
|
}
|
|
2902
|
+
async function getByStatus(status) {
|
|
2903
|
+
try {
|
|
2904
|
+
const data = await collection.find({ status }).toArray();
|
|
2905
|
+
return data;
|
|
2906
|
+
} catch (error) {
|
|
2907
|
+
return Promise.reject(error);
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2861
2910
|
return {
|
|
2862
2911
|
createIndex,
|
|
2863
2912
|
createTextIndex,
|
|
@@ -2865,7 +2914,8 @@ function useVerificationRepo() {
|
|
|
2865
2914
|
getById,
|
|
2866
2915
|
getVerifications,
|
|
2867
2916
|
getByIdByType,
|
|
2868
|
-
updateStatusById
|
|
2917
|
+
updateStatusById,
|
|
2918
|
+
getByStatus
|
|
2869
2919
|
};
|
|
2870
2920
|
}
|
|
2871
2921
|
|
|
@@ -4119,7 +4169,8 @@ function useVerificationService() {
|
|
|
4119
4169
|
const {
|
|
4120
4170
|
add,
|
|
4121
4171
|
getById: _getById,
|
|
4122
|
-
updateStatusById: _updateStatusById
|
|
4172
|
+
updateStatusById: _updateStatusById,
|
|
4173
|
+
getByStatus: _getByStatus
|
|
4123
4174
|
} = useVerificationRepo();
|
|
4124
4175
|
const { getUserByEmail } = useUserRepo();
|
|
4125
4176
|
const { getById: getOrgById, getByEmail: getOrgByEmail } = useOrgRepo();
|
|
@@ -4365,7 +4416,6 @@ function useVerificationService() {
|
|
|
4365
4416
|
}
|
|
4366
4417
|
async function cancelUserInvitation(id) {
|
|
4367
4418
|
try {
|
|
4368
|
-
await verify(id);
|
|
4369
4419
|
await updateStatusById(id, "cancelled");
|
|
4370
4420
|
} catch (error) {
|
|
4371
4421
|
throw new InternalServerError11(
|
|
@@ -4427,6 +4477,30 @@ function useVerificationService() {
|
|
|
4427
4477
|
throw error;
|
|
4428
4478
|
}
|
|
4429
4479
|
}
|
|
4480
|
+
async function checkExpiredInvitation() {
|
|
4481
|
+
const session = useAtlas10.getClient()?.startSession();
|
|
4482
|
+
session?.startTransaction();
|
|
4483
|
+
try {
|
|
4484
|
+
const verifications = await _getByStatus("pending");
|
|
4485
|
+
for (const verification of verifications) {
|
|
4486
|
+
const expiration = new Date(verification.expireAt).getTime();
|
|
4487
|
+
const now = (/* @__PURE__ */ new Date()).getTime();
|
|
4488
|
+
if (now > expiration) {
|
|
4489
|
+
await _updateStatusById(verification._id.toString(), "expired");
|
|
4490
|
+
}
|
|
4491
|
+
}
|
|
4492
|
+
return "Successfully checked for expired invitations.";
|
|
4493
|
+
} catch (error) {
|
|
4494
|
+
await session?.abortTransaction();
|
|
4495
|
+
logger14.log({
|
|
4496
|
+
level: "info",
|
|
4497
|
+
message: `Error checking expired user invitation: ${error}`
|
|
4498
|
+
});
|
|
4499
|
+
throw error;
|
|
4500
|
+
} finally {
|
|
4501
|
+
session?.endSession();
|
|
4502
|
+
}
|
|
4503
|
+
}
|
|
4430
4504
|
return {
|
|
4431
4505
|
createUserInvite,
|
|
4432
4506
|
createForgetPassword,
|
|
@@ -4435,7 +4509,8 @@ function useVerificationService() {
|
|
|
4435
4509
|
verify,
|
|
4436
4510
|
cancelUserInvitation,
|
|
4437
4511
|
updateStatusById,
|
|
4438
|
-
signUp
|
|
4512
|
+
signUp,
|
|
4513
|
+
checkExpiredInvitation
|
|
4439
4514
|
};
|
|
4440
4515
|
}
|
|
4441
4516
|
|
|
@@ -5645,6 +5720,16 @@ function useFileRepo() {
|
|
|
5645
5720
|
const namespace_collection = "files";
|
|
5646
5721
|
const collection = db.collection(namespace_collection);
|
|
5647
5722
|
const { delNamespace, getCache, setCache } = useCache13(namespace_collection);
|
|
5723
|
+
async function createIndex() {
|
|
5724
|
+
try {
|
|
5725
|
+
await collection.createIndexes([
|
|
5726
|
+
{ key: { createdAt: 1 } },
|
|
5727
|
+
{ key: { status: 1 } }
|
|
5728
|
+
]);
|
|
5729
|
+
} catch (error) {
|
|
5730
|
+
throw new InternalServerError14("Failed to create index on feedback.");
|
|
5731
|
+
}
|
|
5732
|
+
}
|
|
5648
5733
|
async function createFile(value, session) {
|
|
5649
5734
|
try {
|
|
5650
5735
|
value = new MFile(value);
|
|
@@ -5773,7 +5858,8 @@ function useFileRepo() {
|
|
|
5773
5858
|
deleteFileById,
|
|
5774
5859
|
getAllDraftedFiles,
|
|
5775
5860
|
updateStatusById,
|
|
5776
|
-
getFileById
|
|
5861
|
+
getFileById,
|
|
5862
|
+
createIndex
|
|
5777
5863
|
};
|
|
5778
5864
|
}
|
|
5779
5865
|
|
|
@@ -27647,22 +27733,31 @@ function UseAccessManagementRepo() {
|
|
|
27647
27733
|
throw new Error(error.message);
|
|
27648
27734
|
}
|
|
27649
27735
|
}
|
|
27736
|
+
function getAfterSecondSlash(term) {
|
|
27737
|
+
const first = term.indexOf("/");
|
|
27738
|
+
if (first === -1)
|
|
27739
|
+
return "";
|
|
27740
|
+
const second = term.indexOf("/", first + 1);
|
|
27741
|
+
if (second === -1)
|
|
27742
|
+
return "";
|
|
27743
|
+
return term.substring(second + 1).toLowerCase();
|
|
27744
|
+
}
|
|
27650
27745
|
function buildSearchQuery(search) {
|
|
27651
27746
|
if (!search) {
|
|
27652
27747
|
return {};
|
|
27653
27748
|
}
|
|
27654
27749
|
const terms = search.split("/").map((s) => s.trim()).filter(Boolean);
|
|
27655
|
-
if (search.includes("/")
|
|
27656
|
-
switch (
|
|
27657
|
-
case 3:
|
|
27750
|
+
if (search.includes("/")) {
|
|
27751
|
+
switch (true) {
|
|
27752
|
+
case terms.length >= 3:
|
|
27658
27753
|
return {
|
|
27659
27754
|
$and: [
|
|
27660
27755
|
{ $expr: { $eq: [{ $toLower: "$name" }, terms[0].toLowerCase()] } },
|
|
27661
27756
|
{ $expr: { $eq: [{ $toLower: "$level.level" }, terms[1].toLowerCase()] } },
|
|
27662
|
-
{ $expr: { $eq: [{ $toLower: "$level.units.name" },
|
|
27757
|
+
{ $expr: { $eq: [{ $toLower: "$level.units.name" }, getAfterSecondSlash(search)] } }
|
|
27663
27758
|
]
|
|
27664
27759
|
};
|
|
27665
|
-
case 2:
|
|
27760
|
+
case terms.length === 2:
|
|
27666
27761
|
return {
|
|
27667
27762
|
$and: [
|
|
27668
27763
|
{ $expr: { $eq: [{ $toLower: "$name" }, terms[0].toLowerCase()] } },
|
|
@@ -27893,6 +27988,172 @@ function UseAccessManagementRepo() {
|
|
|
27893
27988
|
throw new Error(error.message);
|
|
27894
27989
|
}
|
|
27895
27990
|
}
|
|
27991
|
+
async function assignedAccessCardsRepo(params) {
|
|
27992
|
+
try {
|
|
27993
|
+
const site = new ObjectId83(params.site);
|
|
27994
|
+
const userType = params.userType;
|
|
27995
|
+
const type = params.type;
|
|
27996
|
+
const search = params.search;
|
|
27997
|
+
const query = {
|
|
27998
|
+
site: { $in: [site] }
|
|
27999
|
+
};
|
|
28000
|
+
const searchQuery = buildSearchQuery(search);
|
|
28001
|
+
const result = await collectionName("buildings").aggregate([
|
|
28002
|
+
// ✅ Match early with index-friendly query
|
|
28003
|
+
{
|
|
28004
|
+
$match: {
|
|
28005
|
+
...query,
|
|
28006
|
+
status: { $ne: "deleted" }
|
|
28007
|
+
}
|
|
28008
|
+
},
|
|
28009
|
+
// ✅ Only project needed fields before heavy lookups
|
|
28010
|
+
{
|
|
28011
|
+
$project: {
|
|
28012
|
+
_id: 1,
|
|
28013
|
+
name: 1,
|
|
28014
|
+
site: 1
|
|
28015
|
+
}
|
|
28016
|
+
},
|
|
28017
|
+
// ✅ Use localField/foreignField for better index usage
|
|
28018
|
+
{
|
|
28019
|
+
$lookup: {
|
|
28020
|
+
from: "building-levels",
|
|
28021
|
+
localField: "_id",
|
|
28022
|
+
foreignField: "block",
|
|
28023
|
+
pipeline: [
|
|
28024
|
+
{ $match: { status: { $ne: "deleted" } } },
|
|
28025
|
+
{
|
|
28026
|
+
$lookup: {
|
|
28027
|
+
from: "building-units",
|
|
28028
|
+
localField: "_id",
|
|
28029
|
+
foreignField: "level",
|
|
28030
|
+
pipeline: [
|
|
28031
|
+
{ $match: { status: { $ne: "deleted" } } },
|
|
28032
|
+
{ $project: { _id: 1, name: 1 } },
|
|
28033
|
+
{
|
|
28034
|
+
$lookup: {
|
|
28035
|
+
from: "access-cards",
|
|
28036
|
+
localField: "_id",
|
|
28037
|
+
foreignField: "assignedUnit",
|
|
28038
|
+
pipeline: [
|
|
28039
|
+
{
|
|
28040
|
+
$match: {
|
|
28041
|
+
isActivated: true,
|
|
28042
|
+
userType,
|
|
28043
|
+
type
|
|
28044
|
+
}
|
|
28045
|
+
},
|
|
28046
|
+
{
|
|
28047
|
+
$group: {
|
|
28048
|
+
_id: null,
|
|
28049
|
+
accessLevels: { $addToSet: "$accessLevel" },
|
|
28050
|
+
liftAccessLevels: { $addToSet: "$liftAccessLevel" },
|
|
28051
|
+
doorNames: { $addToSet: "$doorName" },
|
|
28052
|
+
liftNames: { $addToSet: "$liftName" },
|
|
28053
|
+
cards: {
|
|
28054
|
+
$push: {
|
|
28055
|
+
_id: "$_id",
|
|
28056
|
+
cardNo: "$cardNo",
|
|
28057
|
+
accessLevel: "$accessLevel",
|
|
28058
|
+
liftAccessLevel: "$liftAccessLevel",
|
|
28059
|
+
doorName: "$doorName",
|
|
28060
|
+
liftName: "$liftName"
|
|
28061
|
+
}
|
|
28062
|
+
}
|
|
28063
|
+
}
|
|
28064
|
+
},
|
|
28065
|
+
{
|
|
28066
|
+
$project: {
|
|
28067
|
+
_id: 0,
|
|
28068
|
+
accessCardCount: {
|
|
28069
|
+
$size: "$cards"
|
|
28070
|
+
},
|
|
28071
|
+
accessLevels: 1,
|
|
28072
|
+
liftAccessLevels: 1,
|
|
28073
|
+
doorNames: 1,
|
|
28074
|
+
liftNames: 1
|
|
28075
|
+
}
|
|
28076
|
+
}
|
|
28077
|
+
],
|
|
28078
|
+
as: "fAccessCards"
|
|
28079
|
+
}
|
|
28080
|
+
},
|
|
28081
|
+
{
|
|
28082
|
+
$match: {
|
|
28083
|
+
"fAccessCards.0": { $exists: true }
|
|
28084
|
+
}
|
|
28085
|
+
}
|
|
28086
|
+
],
|
|
28087
|
+
as: "units"
|
|
28088
|
+
}
|
|
28089
|
+
},
|
|
28090
|
+
{
|
|
28091
|
+
$match: { "units.0": { $exists: true } }
|
|
28092
|
+
},
|
|
28093
|
+
{
|
|
28094
|
+
$project: {
|
|
28095
|
+
_id: 1,
|
|
28096
|
+
level: 1,
|
|
28097
|
+
units: 1
|
|
28098
|
+
}
|
|
28099
|
+
}
|
|
28100
|
+
],
|
|
28101
|
+
as: "level"
|
|
28102
|
+
}
|
|
28103
|
+
},
|
|
28104
|
+
// ✅ Filter out buildings with no levels early
|
|
28105
|
+
{
|
|
28106
|
+
$match: { "level.0": { $exists: true } }
|
|
28107
|
+
},
|
|
28108
|
+
// ✅ Unwind to flatten the hierarchy
|
|
28109
|
+
{
|
|
28110
|
+
$unwind: {
|
|
28111
|
+
path: "$level",
|
|
28112
|
+
preserveNullAndEmptyArrays: false
|
|
28113
|
+
}
|
|
28114
|
+
},
|
|
28115
|
+
{
|
|
28116
|
+
$unwind: {
|
|
28117
|
+
path: "$level.units",
|
|
28118
|
+
preserveNullAndEmptyArrays: false
|
|
28119
|
+
}
|
|
28120
|
+
},
|
|
28121
|
+
{
|
|
28122
|
+
$unwind: {
|
|
28123
|
+
path: "$level.units.fAccessCards",
|
|
28124
|
+
preserveNullAndEmptyArrays: false
|
|
28125
|
+
}
|
|
28126
|
+
},
|
|
28127
|
+
// // Groups by unit _id and keeps only the first occurrence
|
|
28128
|
+
{
|
|
28129
|
+
$group: {
|
|
28130
|
+
_id: "$level.units._id",
|
|
28131
|
+
doc: { $first: "$$ROOT" }
|
|
28132
|
+
}
|
|
28133
|
+
},
|
|
28134
|
+
{
|
|
28135
|
+
$replaceRoot: { newRoot: "$doc" }
|
|
28136
|
+
},
|
|
28137
|
+
// ✅ Apply search filter
|
|
28138
|
+
{
|
|
28139
|
+
$match: {
|
|
28140
|
+
...searchQuery
|
|
28141
|
+
}
|
|
28142
|
+
},
|
|
28143
|
+
{
|
|
28144
|
+
$project: {
|
|
28145
|
+
name: 1,
|
|
28146
|
+
"level.level": 1,
|
|
28147
|
+
"level.units.name": 1,
|
|
28148
|
+
"level.units.fAccessCards": 1
|
|
28149
|
+
}
|
|
28150
|
+
}
|
|
28151
|
+
], { allowDiskUse: true }).toArray();
|
|
28152
|
+
return result;
|
|
28153
|
+
} catch (error) {
|
|
28154
|
+
throw new Error(error.message);
|
|
28155
|
+
}
|
|
28156
|
+
}
|
|
27896
28157
|
return {
|
|
27897
28158
|
createIndexes,
|
|
27898
28159
|
createIndexForEntrypass,
|
|
@@ -27901,7 +28162,8 @@ function UseAccessManagementRepo() {
|
|
|
27901
28162
|
accessManagementSettingsRepo,
|
|
27902
28163
|
allAccessCardsCountsRepo,
|
|
27903
28164
|
availableAccessCardsRepo,
|
|
27904
|
-
userTypeAccessCardsRepo
|
|
28165
|
+
userTypeAccessCardsRepo,
|
|
28166
|
+
assignedAccessCardsRepo
|
|
27905
28167
|
};
|
|
27906
28168
|
}
|
|
27907
28169
|
|
|
@@ -28006,6 +28268,8 @@ var formatAccessGroup = (data, search) => {
|
|
|
28006
28268
|
|
|
28007
28269
|
// src/services/access-management.service.ts
|
|
28008
28270
|
import { parseStringPromise } from "xml2js";
|
|
28271
|
+
import { useCache as useCache47 } from "@7365admin1/node-server-utils";
|
|
28272
|
+
var namespace = "cache:acm";
|
|
28009
28273
|
function useAccessManagementSvc() {
|
|
28010
28274
|
const {
|
|
28011
28275
|
addPhysicalCardRepo,
|
|
@@ -28013,7 +28277,8 @@ function useAccessManagementSvc() {
|
|
|
28013
28277
|
accessManagementSettingsRepo,
|
|
28014
28278
|
allAccessCardsCountsRepo,
|
|
28015
28279
|
availableAccessCardsRepo,
|
|
28016
|
-
userTypeAccessCardsRepo
|
|
28280
|
+
userTypeAccessCardsRepo,
|
|
28281
|
+
assignedAccessCardsRepo
|
|
28017
28282
|
} = UseAccessManagementRepo();
|
|
28018
28283
|
const addPhysicalCardSvc = async (payload) => {
|
|
28019
28284
|
try {
|
|
@@ -28031,12 +28296,34 @@ function useAccessManagementSvc() {
|
|
|
28031
28296
|
throw new Error(err.message);
|
|
28032
28297
|
}
|
|
28033
28298
|
};
|
|
28299
|
+
const setCache = async (params) => {
|
|
28300
|
+
const { key, data, ttlSeconds = 60, redis } = params;
|
|
28301
|
+
const jsonData = JSON.stringify(data);
|
|
28302
|
+
await redis.set(key, jsonData, "EX", ttlSeconds);
|
|
28303
|
+
};
|
|
28304
|
+
const getCache = async (params) => {
|
|
28305
|
+
const { key, redis } = params;
|
|
28306
|
+
const result = await redis.get(key);
|
|
28307
|
+
return result ? JSON.parse(result) : null;
|
|
28308
|
+
};
|
|
28034
28309
|
const doorAccessLevelsSvc = async (params) => {
|
|
28035
28310
|
try {
|
|
28311
|
+
const key = `${namespace}:${params.user}:door-levels`;
|
|
28312
|
+
const listKey = `${namespace}:${params.user}:list`;
|
|
28313
|
+
const { redis } = useCache47(key);
|
|
28314
|
+
const cachedData = await getCache({ key, redis });
|
|
28315
|
+
if (cachedData) {
|
|
28316
|
+
console.log("\u26A1 Cache hit:", key);
|
|
28317
|
+
redis.expire(key, 60).catch(console.error);
|
|
28318
|
+
redis.lrem(listKey, 0, key).then(() => redis.lpush(listKey, key)).then(() => redis.ltrim(listKey, 0, 9)).catch(console.error);
|
|
28319
|
+
return cachedData;
|
|
28320
|
+
}
|
|
28036
28321
|
const command = readTemplate("door-levels");
|
|
28037
28322
|
const response = await sendCommand(command, params.acm_url);
|
|
28038
28323
|
const res = await parseStringPromise(response, { explicitArray: false });
|
|
28039
28324
|
const format = await formatDoorAccessLevels(res);
|
|
28325
|
+
await setCache({ key, data: format, ttlSeconds: 60, redis });
|
|
28326
|
+
redis.lrem(listKey, 0, key).then(() => redis.lpush(listKey, key)).then(() => redis.ltrim(listKey, 0, 9)).catch(console.error);
|
|
28040
28327
|
return format;
|
|
28041
28328
|
} catch (err) {
|
|
28042
28329
|
throw new Error(err.message);
|
|
@@ -28044,10 +28331,22 @@ function useAccessManagementSvc() {
|
|
|
28044
28331
|
};
|
|
28045
28332
|
const liftAccessLevelsSvc = async (params) => {
|
|
28046
28333
|
try {
|
|
28334
|
+
const key = `${namespace}:${params.user}:lift-levels`;
|
|
28335
|
+
const listKey = `${namespace}:${params.user}:list`;
|
|
28336
|
+
const { redis } = useCache47(key);
|
|
28337
|
+
const cachedData = await getCache({ key, redis });
|
|
28338
|
+
if (cachedData) {
|
|
28339
|
+
console.log("\u26A1 Cache hit:", key);
|
|
28340
|
+
redis.expire(key, 60).catch(console.error);
|
|
28341
|
+
redis.lrem(listKey, 0, key).then(() => redis.lpush(listKey, key)).then(() => redis.ltrim(listKey, 0, 9)).catch(console.error);
|
|
28342
|
+
return cachedData;
|
|
28343
|
+
}
|
|
28047
28344
|
const command = readTemplate("lift-levels");
|
|
28048
28345
|
const response = await sendCommand(command, params.acm_url);
|
|
28049
28346
|
const res = await parseStringPromise(response, { explicitArray: false });
|
|
28050
28347
|
const format = await formatLiftAccessLevels(res);
|
|
28348
|
+
await setCache({ key, data: format, ttlSeconds: 60, redis });
|
|
28349
|
+
redis.lrem(listKey, 0, key).then(() => redis.lpush(listKey, key)).then(() => redis.ltrim(listKey, 0, 9)).catch(console.error);
|
|
28051
28350
|
return format;
|
|
28052
28351
|
} catch (error) {
|
|
28053
28352
|
throw new Error(error.message);
|
|
@@ -28096,6 +28395,14 @@ function useAccessManagementSvc() {
|
|
|
28096
28395
|
throw new Error(err.message);
|
|
28097
28396
|
}
|
|
28098
28397
|
};
|
|
28398
|
+
const assignedAccessCardsSvc = async (params) => {
|
|
28399
|
+
try {
|
|
28400
|
+
const response = await assignedAccessCardsRepo({ ...params });
|
|
28401
|
+
return response;
|
|
28402
|
+
} catch (err) {
|
|
28403
|
+
throw new Error(err.message);
|
|
28404
|
+
}
|
|
28405
|
+
};
|
|
28099
28406
|
return {
|
|
28100
28407
|
addPhysicalCardSvc,
|
|
28101
28408
|
addNonPhysicalCardSvc,
|
|
@@ -28105,7 +28412,8 @@ function useAccessManagementSvc() {
|
|
|
28105
28412
|
accessManagementSettingsSvc,
|
|
28106
28413
|
allAccessCardsCountsSvc,
|
|
28107
28414
|
availableAccessCardsSvc,
|
|
28108
|
-
userTypeAccessCardsSvc
|
|
28415
|
+
userTypeAccessCardsSvc,
|
|
28416
|
+
assignedAccessCardsSvc
|
|
28109
28417
|
};
|
|
28110
28418
|
}
|
|
28111
28419
|
|
|
@@ -28120,7 +28428,8 @@ function useAccessManagementController() {
|
|
|
28120
28428
|
accessManagementSettingsSvc,
|
|
28121
28429
|
allAccessCardsCountsSvc,
|
|
28122
28430
|
availableAccessCardsSvc,
|
|
28123
|
-
userTypeAccessCardsSvc
|
|
28431
|
+
userTypeAccessCardsSvc,
|
|
28432
|
+
assignedAccessCardsSvc
|
|
28124
28433
|
} = useAccessManagementSvc();
|
|
28125
28434
|
const addPhysicalCard = async (req, res) => {
|
|
28126
28435
|
try {
|
|
@@ -28251,10 +28560,11 @@ function useAccessManagementController() {
|
|
|
28251
28560
|
const doorAccessLevels = async (req, res) => {
|
|
28252
28561
|
try {
|
|
28253
28562
|
const { acm_url } = req.query;
|
|
28563
|
+
const user = req.cookies?.sid;
|
|
28254
28564
|
if (!acm_url || typeof acm_url !== "string") {
|
|
28255
28565
|
throw new Error("Access Control URL is required");
|
|
28256
28566
|
}
|
|
28257
|
-
const result = await doorAccessLevelsSvc({ acm_url });
|
|
28567
|
+
const result = await doorAccessLevelsSvc({ acm_url, user });
|
|
28258
28568
|
return res.status(200).json({ message: "Success", data: result });
|
|
28259
28569
|
} catch (error) {
|
|
28260
28570
|
return res.status(400).json({
|
|
@@ -28266,10 +28576,11 @@ function useAccessManagementController() {
|
|
|
28266
28576
|
const liftAccessLevels = async (req, res) => {
|
|
28267
28577
|
try {
|
|
28268
28578
|
const { acm_url } = req.query;
|
|
28579
|
+
const user = req.cookies?.sid;
|
|
28269
28580
|
if (!acm_url || typeof acm_url !== "string") {
|
|
28270
28581
|
throw new Error("Access Control URL is required");
|
|
28271
28582
|
}
|
|
28272
|
-
const result = await liftAccessLevelsSvc({ acm_url });
|
|
28583
|
+
const result = await liftAccessLevelsSvc({ acm_url, user });
|
|
28273
28584
|
return res.status(200).json({ message: "Success", data: result });
|
|
28274
28585
|
} catch (error) {
|
|
28275
28586
|
return res.status(400).json({
|
|
@@ -28377,6 +28688,28 @@ function useAccessManagementController() {
|
|
|
28377
28688
|
});
|
|
28378
28689
|
}
|
|
28379
28690
|
};
|
|
28691
|
+
const assignedAccessCards = async (req, res) => {
|
|
28692
|
+
try {
|
|
28693
|
+
const { site, userType, type, search = "" } = req.query;
|
|
28694
|
+
const schema2 = Joi85.object({
|
|
28695
|
+
site: Joi85.string().hex().required(),
|
|
28696
|
+
userType: Joi85.string().required(),
|
|
28697
|
+
type: Joi85.string().required(),
|
|
28698
|
+
search: Joi85.string().optional().allow("", null)
|
|
28699
|
+
});
|
|
28700
|
+
const { error } = schema2.validate({ site, userType, type, search });
|
|
28701
|
+
if (error) {
|
|
28702
|
+
return res.status(400).json({ message: error.message });
|
|
28703
|
+
}
|
|
28704
|
+
const result = await assignedAccessCardsSvc({ site, userType, type, search });
|
|
28705
|
+
return res.status(200).json({ message: "Success", data: result });
|
|
28706
|
+
} catch (error) {
|
|
28707
|
+
return res.status(500).json({
|
|
28708
|
+
data: null,
|
|
28709
|
+
message: error.message
|
|
28710
|
+
});
|
|
28711
|
+
}
|
|
28712
|
+
};
|
|
28380
28713
|
return {
|
|
28381
28714
|
addPhysicalCard,
|
|
28382
28715
|
addNonPhysicalCard,
|
|
@@ -28386,7 +28719,8 @@ function useAccessManagementController() {
|
|
|
28386
28719
|
accessManagementSettings,
|
|
28387
28720
|
allAccessCardsCounts,
|
|
28388
28721
|
availableAccessCards,
|
|
28389
|
-
userTypeAccessCards
|
|
28722
|
+
userTypeAccessCards,
|
|
28723
|
+
assignedAccessCards
|
|
28390
28724
|
};
|
|
28391
28725
|
}
|
|
28392
28726
|
|
|
@@ -28456,7 +28790,7 @@ import {
|
|
|
28456
28790
|
makeCacheKey as makeCacheKey45,
|
|
28457
28791
|
paginate as paginate39,
|
|
28458
28792
|
useAtlas as useAtlas75,
|
|
28459
|
-
useCache as
|
|
28793
|
+
useCache as useCache48
|
|
28460
28794
|
} from "@7365admin1/node-server-utils";
|
|
28461
28795
|
import { ObjectId as ObjectId85 } from "mongodb";
|
|
28462
28796
|
function useNfcPatrolTagRepo() {
|
|
@@ -28467,8 +28801,8 @@ function useNfcPatrolTagRepo() {
|
|
|
28467
28801
|
const namespace_collection = "nfc-patrol-tags";
|
|
28468
28802
|
const namespace_collection_nfc_patrol_routes = "nfc-patrol-routes";
|
|
28469
28803
|
const collection = db.collection(namespace_collection);
|
|
28470
|
-
const { delNamespace, getCache, setCache } =
|
|
28471
|
-
const { delNamespace: delNamespaceNfcPatrolRoutes } =
|
|
28804
|
+
const { delNamespace, getCache, setCache } = useCache48(namespace_collection);
|
|
28805
|
+
const { delNamespace: delNamespaceNfcPatrolRoutes } = useCache48(
|
|
28472
28806
|
namespace_collection_nfc_patrol_routes
|
|
28473
28807
|
);
|
|
28474
28808
|
async function createIndexes() {
|
|
@@ -28915,7 +29249,7 @@ import {
|
|
|
28915
29249
|
NotFoundError as NotFoundError37,
|
|
28916
29250
|
paginate as paginate40,
|
|
28917
29251
|
useAtlas as useAtlas77,
|
|
28918
|
-
useCache as
|
|
29252
|
+
useCache as useCache49
|
|
28919
29253
|
} from "@7365admin1/node-server-utils";
|
|
28920
29254
|
import { ObjectId as ObjectId87 } from "mongodb";
|
|
28921
29255
|
function useOccurrenceBookRepo() {
|
|
@@ -28947,7 +29281,7 @@ function useOccurrenceBookRepo() {
|
|
|
28947
29281
|
}
|
|
28948
29282
|
const namespace_collection = "occurrence-books";
|
|
28949
29283
|
const collection = db.collection(namespace_collection);
|
|
28950
|
-
const { delNamespace, getCache, setCache } =
|
|
29284
|
+
const { delNamespace, getCache, setCache } = useCache49(namespace_collection);
|
|
28951
29285
|
async function add(value, session) {
|
|
28952
29286
|
try {
|
|
28953
29287
|
value = MOccurrenceBook(value);
|
|
@@ -29525,7 +29859,7 @@ import {
|
|
|
29525
29859
|
NotFoundError as NotFoundError38,
|
|
29526
29860
|
paginate as paginate41,
|
|
29527
29861
|
useAtlas as useAtlas79,
|
|
29528
|
-
useCache as
|
|
29862
|
+
useCache as useCache50
|
|
29529
29863
|
} from "@7365admin1/node-server-utils";
|
|
29530
29864
|
import { ObjectId as ObjectId89 } from "mongodb";
|
|
29531
29865
|
function useBulletinVideoRepo() {
|
|
@@ -29544,7 +29878,7 @@ function useBulletinVideoRepo() {
|
|
|
29544
29878
|
}
|
|
29545
29879
|
const namespace_collection = "bulletin-videos";
|
|
29546
29880
|
const collection = db.collection(namespace_collection);
|
|
29547
|
-
const { delNamespace, getCache, setCache } =
|
|
29881
|
+
const { delNamespace, getCache, setCache } = useCache50(namespace_collection);
|
|
29548
29882
|
async function add(value, session) {
|
|
29549
29883
|
try {
|
|
29550
29884
|
value = MBulletinVideo(value);
|
|
@@ -30076,7 +30410,7 @@ import {
|
|
|
30076
30410
|
InternalServerError as InternalServerError51,
|
|
30077
30411
|
logger as logger127,
|
|
30078
30412
|
useAtlas as useAtlas81,
|
|
30079
|
-
useCache as
|
|
30413
|
+
useCache as useCache51,
|
|
30080
30414
|
paginate as paginate42,
|
|
30081
30415
|
makeCacheKey as makeCacheKey48
|
|
30082
30416
|
} from "@7365admin1/node-server-utils";
|
|
@@ -30088,7 +30422,7 @@ function useStatementOfAccountRepo() {
|
|
|
30088
30422
|
}
|
|
30089
30423
|
const namespace_collection = "site.statement-of-accounts";
|
|
30090
30424
|
const collection = db.collection(namespace_collection);
|
|
30091
|
-
const { delNamespace, getCache, setCache } =
|
|
30425
|
+
const { delNamespace, getCache, setCache } = useCache51(namespace_collection);
|
|
30092
30426
|
async function createTextIndex() {
|
|
30093
30427
|
try {
|
|
30094
30428
|
await collection.createIndex({
|
|
@@ -30851,7 +31185,7 @@ import {
|
|
|
30851
31185
|
NotFoundError as NotFoundError40,
|
|
30852
31186
|
paginate as paginate43,
|
|
30853
31187
|
useAtlas as useAtlas83,
|
|
30854
|
-
useCache as
|
|
31188
|
+
useCache as useCache52
|
|
30855
31189
|
} from "@7365admin1/node-server-utils";
|
|
30856
31190
|
import { ObjectId as ObjectId93 } from "mongodb";
|
|
30857
31191
|
function useEntryPassSettingsRepo() {
|
|
@@ -30861,7 +31195,7 @@ function useEntryPassSettingsRepo() {
|
|
|
30861
31195
|
}
|
|
30862
31196
|
const namespace_collection = "site.entrypass-settings";
|
|
30863
31197
|
const collection = db.collection(namespace_collection);
|
|
30864
|
-
const { delNamespace, getCache, setCache } =
|
|
31198
|
+
const { delNamespace, getCache, setCache } = useCache52(namespace_collection);
|
|
30865
31199
|
async function createTextIndex() {
|
|
30866
31200
|
try {
|
|
30867
31201
|
await collection.createIndex({
|
|
@@ -31423,7 +31757,7 @@ import {
|
|
|
31423
31757
|
logger as logger133,
|
|
31424
31758
|
makeCacheKey as makeCacheKey50,
|
|
31425
31759
|
useAtlas as useAtlas84,
|
|
31426
|
-
useCache as
|
|
31760
|
+
useCache as useCache53
|
|
31427
31761
|
} from "@7365admin1/node-server-utils";
|
|
31428
31762
|
function useDashboardRepo() {
|
|
31429
31763
|
const db = useAtlas84.getDb();
|
|
@@ -31434,7 +31768,7 @@ function useDashboardRepo() {
|
|
|
31434
31768
|
const work_order_collection = db.collection("work-orders");
|
|
31435
31769
|
const visitor_collection = db.collection("visitor.transactions");
|
|
31436
31770
|
const namespace_collection = "dashboard";
|
|
31437
|
-
const { delNamespace, getCache, setCache } =
|
|
31771
|
+
const { delNamespace, getCache, setCache } = useCache53(namespace_collection);
|
|
31438
31772
|
async function getAll({
|
|
31439
31773
|
site = ""
|
|
31440
31774
|
}, session) {
|
|
@@ -31598,7 +31932,7 @@ import {
|
|
|
31598
31932
|
makeCacheKey as makeCacheKey51,
|
|
31599
31933
|
paginate as paginate44,
|
|
31600
31934
|
useAtlas as useAtlas85,
|
|
31601
|
-
useCache as
|
|
31935
|
+
useCache as useCache54
|
|
31602
31936
|
} from "@7365admin1/node-server-utils";
|
|
31603
31937
|
import { ObjectId as ObjectId95 } from "mongodb";
|
|
31604
31938
|
function useNfcPatrolRouteRepo() {
|
|
@@ -31608,7 +31942,7 @@ function useNfcPatrolRouteRepo() {
|
|
|
31608
31942
|
}
|
|
31609
31943
|
const namespace_collection = "nfc-patrol-routes";
|
|
31610
31944
|
const collection = db.collection(namespace_collection);
|
|
31611
|
-
const { delNamespace, getCache, setCache } =
|
|
31945
|
+
const { delNamespace, getCache, setCache } = useCache54(namespace_collection);
|
|
31612
31946
|
async function createIndexes() {
|
|
31613
31947
|
try {
|
|
31614
31948
|
await collection.createIndexes([
|
|
@@ -32345,7 +32679,7 @@ import {
|
|
|
32345
32679
|
NotFoundError as NotFoundError43,
|
|
32346
32680
|
paginate as paginate45,
|
|
32347
32681
|
useAtlas as useAtlas87,
|
|
32348
|
-
useCache as
|
|
32682
|
+
useCache as useCache55
|
|
32349
32683
|
} from "@7365admin1/node-server-utils";
|
|
32350
32684
|
import { ObjectId as ObjectId97 } from "mongodb";
|
|
32351
32685
|
function useIncidentReportRepo() {
|
|
@@ -32376,7 +32710,7 @@ function useIncidentReportRepo() {
|
|
|
32376
32710
|
}
|
|
32377
32711
|
const namespace_collection = "incident-reports";
|
|
32378
32712
|
const collection = db.collection(namespace_collection);
|
|
32379
|
-
const { delNamespace, getCache, setCache } =
|
|
32713
|
+
const { delNamespace, getCache, setCache } = useCache55(namespace_collection);
|
|
32380
32714
|
async function add(value, session) {
|
|
32381
32715
|
try {
|
|
32382
32716
|
value = MIncidentReport(value);
|
|
@@ -33117,7 +33451,7 @@ import {
|
|
|
33117
33451
|
makeCacheKey as makeCacheKey53,
|
|
33118
33452
|
NotFoundError as NotFoundError45,
|
|
33119
33453
|
useAtlas as useAtlas89,
|
|
33120
|
-
useCache as
|
|
33454
|
+
useCache as useCache56
|
|
33121
33455
|
} from "@7365admin1/node-server-utils";
|
|
33122
33456
|
import { ObjectId as ObjectId99 } from "mongodb";
|
|
33123
33457
|
function useNfcPatrolSettingsRepository() {
|
|
@@ -33127,7 +33461,7 @@ function useNfcPatrolSettingsRepository() {
|
|
|
33127
33461
|
}
|
|
33128
33462
|
const namespace_collection = "site.nfc-patrol-settings";
|
|
33129
33463
|
const collection = db.collection(namespace_collection);
|
|
33130
|
-
const { delNamespace, setCache, getCache } =
|
|
33464
|
+
const { delNamespace, setCache, getCache } = useCache56(namespace_collection);
|
|
33131
33465
|
async function createIndexes() {
|
|
33132
33466
|
try {
|
|
33133
33467
|
await collection.createIndexes([{ key: { site: 1 }, unique: true }]);
|
|
@@ -33372,7 +33706,7 @@ import {
|
|
|
33372
33706
|
NotFoundError as NotFoundError46,
|
|
33373
33707
|
paginate as paginate46,
|
|
33374
33708
|
useAtlas as useAtlas91,
|
|
33375
|
-
useCache as
|
|
33709
|
+
useCache as useCache57
|
|
33376
33710
|
} from "@7365admin1/node-server-utils";
|
|
33377
33711
|
|
|
33378
33712
|
// src/models/occurrence-subject.model.ts
|
|
@@ -33449,7 +33783,7 @@ function useOccurrenceSubjectRepo() {
|
|
|
33449
33783
|
}
|
|
33450
33784
|
const namespace_collection = "occurrence-subjects";
|
|
33451
33785
|
const collection = db.collection(namespace_collection);
|
|
33452
|
-
const { delNamespace, getCache, setCache } =
|
|
33786
|
+
const { delNamespace, getCache, setCache } = useCache57(namespace_collection);
|
|
33453
33787
|
async function add(value, session) {
|
|
33454
33788
|
try {
|
|
33455
33789
|
value = MOccurrenceSubject(value);
|
|
@@ -34017,7 +34351,7 @@ import {
|
|
|
34017
34351
|
NotFoundError as NotFoundError47,
|
|
34018
34352
|
paginate as paginate47,
|
|
34019
34353
|
useAtlas as useAtlas93,
|
|
34020
|
-
useCache as
|
|
34354
|
+
useCache as useCache58
|
|
34021
34355
|
} from "@7365admin1/node-server-utils";
|
|
34022
34356
|
import { ObjectId as ObjectId103 } from "mongodb";
|
|
34023
34357
|
function useOnlineFormRepo() {
|
|
@@ -34027,7 +34361,7 @@ function useOnlineFormRepo() {
|
|
|
34027
34361
|
}
|
|
34028
34362
|
const namespace_collection = "online-forms";
|
|
34029
34363
|
const collection = db.collection(namespace_collection);
|
|
34030
|
-
const { delNamespace, getCache, setCache } =
|
|
34364
|
+
const { delNamespace, getCache, setCache } = useCache58(namespace_collection);
|
|
34031
34365
|
async function createTextIndex() {
|
|
34032
34366
|
try {
|
|
34033
34367
|
await collection.createIndex({
|
|
@@ -34763,7 +35097,7 @@ import {
|
|
|
34763
35097
|
makeCacheKey as makeCacheKey56,
|
|
34764
35098
|
paginate as paginate48,
|
|
34765
35099
|
useAtlas as useAtlas95,
|
|
34766
|
-
useCache as
|
|
35100
|
+
useCache as useCache59
|
|
34767
35101
|
} from "@7365admin1/node-server-utils";
|
|
34768
35102
|
import { ObjectId as ObjectId105 } from "mongodb";
|
|
34769
35103
|
function useNfcPatrolLogRepo() {
|
|
@@ -34773,7 +35107,7 @@ function useNfcPatrolLogRepo() {
|
|
|
34773
35107
|
}
|
|
34774
35108
|
const namespace_collection = "nfc-patrol-logs";
|
|
34775
35109
|
const collection = db.collection(namespace_collection);
|
|
34776
|
-
const { delNamespace, getCache, setCache } =
|
|
35110
|
+
const { delNamespace, getCache, setCache } = useCache59(namespace_collection);
|
|
34777
35111
|
async function createIndexes() {
|
|
34778
35112
|
try {
|
|
34779
35113
|
await collection.createIndexes([
|