@7365admin1/core 3.136.2 → 3.137.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 +56 -1
- package/dist/index.js +236 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +344 -119
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/harness.mjs +6 -0
- package/test/e2e/service-provider-invite-email-new-company.e2e.test.mjs +139 -0
- package/test/service-provider-invite.test.mjs +9 -0
package/dist/index.mjs
CHANGED
|
@@ -8723,6 +8723,9 @@ function serviceProviderNatureFor(app) {
|
|
|
8723
8723
|
const nature = PROVIDER_NATURE_ALIASES[key] ?? key;
|
|
8724
8724
|
return nature !== "property_management_agency" && SERVICE_TYPE_LABELS[nature] ? nature : "";
|
|
8725
8725
|
}
|
|
8726
|
+
function sanitizeCompanyName(value) {
|
|
8727
|
+
return String(value ?? "").replace(/[\u0000-\u001f\u007f<>]/g, " ").replace(/\s+/g, " ").trim().slice(0, 120).trim();
|
|
8728
|
+
}
|
|
8726
8729
|
|
|
8727
8730
|
// src/utils/invite-actor.util.ts
|
|
8728
8731
|
import { useAtlas as useAtlas17 } from "@7365admin1/node-server-utils";
|
|
@@ -9065,7 +9068,8 @@ import {
|
|
|
9065
9068
|
getDirectory,
|
|
9066
9069
|
logger as logger36,
|
|
9067
9070
|
useMailer as useMailer2,
|
|
9068
|
-
useAtlas as useAtlas38
|
|
9071
|
+
useAtlas as useAtlas38,
|
|
9072
|
+
useCache as useCache21
|
|
9069
9073
|
} from "@7365admin1/node-server-utils";
|
|
9070
9074
|
import { ObjectId as ObjectId56 } from "mongodb";
|
|
9071
9075
|
|
|
@@ -24562,10 +24566,36 @@ function useServiceProviderInviteService() {
|
|
|
24562
24566
|
);
|
|
24563
24567
|
}
|
|
24564
24568
|
const user = await getUserById(actor.id).catch(() => null);
|
|
24565
|
-
const
|
|
24569
|
+
const { orgId } = await createProviderCompany({
|
|
24570
|
+
invite,
|
|
24571
|
+
nature,
|
|
24572
|
+
user,
|
|
24573
|
+
companyName,
|
|
24574
|
+
country
|
|
24575
|
+
});
|
|
24576
|
+
const result = await accept({ id, userId: actor.id, org: orgId });
|
|
24577
|
+
return {
|
|
24578
|
+
...result,
|
|
24579
|
+
orgId,
|
|
24580
|
+
nature,
|
|
24581
|
+
companyName: (await getOrgById(orgId).catch(() => null))?.name ?? "",
|
|
24582
|
+
siteId: invite.metadata?.siteId?.toString?.() ?? "",
|
|
24583
|
+
siteName: String(invite.metadata?.siteName ?? "")
|
|
24584
|
+
};
|
|
24585
|
+
}
|
|
24586
|
+
async function createProviderCompany({
|
|
24587
|
+
invite,
|
|
24588
|
+
nature,
|
|
24589
|
+
user,
|
|
24590
|
+
companyName,
|
|
24591
|
+
country
|
|
24592
|
+
}) {
|
|
24593
|
+
const inviteeId = String(user?._id ?? "");
|
|
24594
|
+
const name = sanitizeCompanyName(companyName) || sanitizeCompanyName(invite.metadata?.name) || sanitizeCompanyName(user?.name);
|
|
24566
24595
|
if (!name)
|
|
24567
24596
|
throw new BadRequestError47("Enter your company's name.");
|
|
24568
24597
|
const email = String(invite.email ?? "").trim().toLowerCase();
|
|
24598
|
+
const actor = { id: inviteeId };
|
|
24569
24599
|
const orgId = String(
|
|
24570
24600
|
await addOrg({
|
|
24571
24601
|
name,
|
|
@@ -24607,15 +24637,9 @@ function useServiceProviderInviteService() {
|
|
|
24607
24637
|
await useUserRepo().updateUserFieldById({ _id: actor.id, field: "defaultOrg", value: orgId }).catch(() => void 0);
|
|
24608
24638
|
logger36.log({
|
|
24609
24639
|
level: "info",
|
|
24610
|
-
message: `[sp-invite] invite=${
|
|
24640
|
+
message: `[sp-invite] invite=${String(invite._id)} new company org=${orgId} nature=${nature}`
|
|
24611
24641
|
});
|
|
24612
|
-
|
|
24613
|
-
return {
|
|
24614
|
-
...result,
|
|
24615
|
-
orgId,
|
|
24616
|
-
nature,
|
|
24617
|
-
siteId: invite.metadata?.siteId?.toString?.() ?? ""
|
|
24618
|
-
};
|
|
24642
|
+
return { orgId, name };
|
|
24619
24643
|
}
|
|
24620
24644
|
async function wrongJoinContext(id, userId) {
|
|
24621
24645
|
const actor = await actorFor(userId);
|
|
@@ -24684,7 +24708,8 @@ function useServiceProviderInviteService() {
|
|
|
24684
24708
|
async function repairWrongJoin({ id, userId }) {
|
|
24685
24709
|
const { actor, invite, senderOrg, user } = await wrongJoinContext(id, userId);
|
|
24686
24710
|
const rows = await wrongJoinRows(invite, senderOrg, user);
|
|
24687
|
-
|
|
24711
|
+
const defaultOrgIsSender = !!user?._id && String(user?.defaultOrg ?? "") === senderOrg;
|
|
24712
|
+
if (!rows.length && !defaultOrgIsSender) {
|
|
24688
24713
|
return {
|
|
24689
24714
|
message: "Nothing to repair: this account is not in the sender's organisation.",
|
|
24690
24715
|
changed: 0
|
|
@@ -24693,12 +24718,15 @@ function useServiceProviderInviteService() {
|
|
|
24693
24718
|
const { updateMemberStatus } = useMemberRepo();
|
|
24694
24719
|
for (const row of rows)
|
|
24695
24720
|
await updateMemberStatus(row._id, { status: "inactive" });
|
|
24721
|
+
if (defaultOrgIsSender)
|
|
24722
|
+
await setDefaultOrg(String(user._id), "");
|
|
24696
24723
|
await _transition({
|
|
24697
24724
|
id,
|
|
24698
24725
|
from: [],
|
|
24699
24726
|
event: {
|
|
24700
24727
|
...event("wrong-join-repaired", actor),
|
|
24701
|
-
memberIds: rows.map((row) => row._id)
|
|
24728
|
+
memberIds: rows.map((row) => row._id),
|
|
24729
|
+
...defaultOrgIsSender ? { defaultOrgWas: senderOrg } : {}
|
|
24702
24730
|
}
|
|
24703
24731
|
});
|
|
24704
24732
|
logger36.log({
|
|
@@ -24719,12 +24747,170 @@ function useServiceProviderInviteService() {
|
|
|
24719
24747
|
const ids2 = (repaired.memberIds ?? []).filter((m) => ObjectId56.isValid(m));
|
|
24720
24748
|
for (const m of ids2)
|
|
24721
24749
|
await updateMemberStatus(m, { status: "active" }).catch(() => 0);
|
|
24750
|
+
const { user } = await wrongJoinContext(id, userId);
|
|
24751
|
+
if (repaired.defaultOrgWas && user?._id && !String(user.defaultOrg ?? "")) {
|
|
24752
|
+
await setDefaultOrg(String(user._id), String(repaired.defaultOrgWas));
|
|
24753
|
+
}
|
|
24722
24754
|
await _transition({ id, from: [], event: event("wrong-join-undone", actor) });
|
|
24723
24755
|
return {
|
|
24724
24756
|
message: `Undone: ${ids2.length} membership${ids2.length === 1 ? "" : "s"} active again.`,
|
|
24725
24757
|
changed: ids2.length
|
|
24726
24758
|
};
|
|
24727
24759
|
}
|
|
24760
|
+
async function setDefaultOrg(userId, orgId) {
|
|
24761
|
+
if (!orgId) {
|
|
24762
|
+
await useAtlas38.getDb()?.collection("users").updateOne(
|
|
24763
|
+
{ _id: new ObjectId56(userId) },
|
|
24764
|
+
{ $unset: { defaultOrg: "" }, $set: { updatedAt: (/* @__PURE__ */ new Date()).toISOString() } }
|
|
24765
|
+
);
|
|
24766
|
+
await useCache21("users").delNamespace().catch(() => void 0);
|
|
24767
|
+
return;
|
|
24768
|
+
}
|
|
24769
|
+
await useUserRepo().updateUserFieldById({ _id: userId, field: "defaultOrg", value: orgId }).catch(() => void 0);
|
|
24770
|
+
}
|
|
24771
|
+
async function finishSetupContext(id, userId) {
|
|
24772
|
+
const ctx = await wrongJoinContext(id, userId);
|
|
24773
|
+
const { invite, user, senderOrg } = ctx;
|
|
24774
|
+
const nature = serviceProviderNatureFor(invite.metadata?.app);
|
|
24775
|
+
const existing = user?._id && nature ? await getByCreatorAndNature(String(user._id), nature).catch(() => null) : null;
|
|
24776
|
+
const stillInSender = await wrongJoinRows(invite, senderOrg, user);
|
|
24777
|
+
let blocked = "";
|
|
24778
|
+
if (!user?._id) {
|
|
24779
|
+
blocked = "This email has no account yet. The invitee signs up from the invitation email.";
|
|
24780
|
+
} else if (!nature) {
|
|
24781
|
+
blocked = "This invitation does not say which service the company provides.";
|
|
24782
|
+
} else if (invite.deletedAt) {
|
|
24783
|
+
blocked = "This invitation was deleted by the sender.";
|
|
24784
|
+
} else if (invite.status === "awaiting-approval" /* AWAITING_APPROVAL */) {
|
|
24785
|
+
blocked = "Approve the invitation first.";
|
|
24786
|
+
} else if (invite.status !== "pending" /* PENDING */) {
|
|
24787
|
+
blocked = `This invitation is ${serviceProviderInviteLabel(invite.status)}, not waiting for an answer.`;
|
|
24788
|
+
} else if (isServiceProviderInviteExpired(invite)) {
|
|
24789
|
+
blocked = "This invitation has expired. Press Resend email first.";
|
|
24790
|
+
} else if (stillInSender.length) {
|
|
24791
|
+
blocked = "The account is still inside the sender's organisation. Press Check account, then Repair, first.";
|
|
24792
|
+
}
|
|
24793
|
+
return { ...ctx, nature, existing, blocked };
|
|
24794
|
+
}
|
|
24795
|
+
function lastFinishSetup(invite) {
|
|
24796
|
+
const history = invite.history ?? [];
|
|
24797
|
+
const last = [...history].reverse().find((e) => ["finish-setup-applied", "finish-setup-undone"].includes(e?.action));
|
|
24798
|
+
return last?.action === "finish-setup-applied" ? last : null;
|
|
24799
|
+
}
|
|
24800
|
+
async function finishSetupPreview({
|
|
24801
|
+
id,
|
|
24802
|
+
userId,
|
|
24803
|
+
companyName
|
|
24804
|
+
}) {
|
|
24805
|
+
const { invite, user, senderOrg, nature, existing, blocked } = await finishSetupContext(id, userId);
|
|
24806
|
+
const [sender, currentDefault] = await Promise.all([
|
|
24807
|
+
getOrgById(senderOrg).catch(() => null),
|
|
24808
|
+
user?.defaultOrg ? getOrgById(String(user.defaultOrg)).catch(() => null) : null
|
|
24809
|
+
]);
|
|
24810
|
+
const applied = lastFinishSetup(invite);
|
|
24811
|
+
return {
|
|
24812
|
+
invitationId: id,
|
|
24813
|
+
email: String(invite.email ?? ""),
|
|
24814
|
+
account: user?._id ? String(user.name || user.email || "") : "",
|
|
24815
|
+
service: nature,
|
|
24816
|
+
serviceLabel: nature ? serviceTypeLabel(nature) : "",
|
|
24817
|
+
senderOrgName: String(sender?.name ?? ""),
|
|
24818
|
+
siteName: String(invite.metadata?.siteName ?? ""),
|
|
24819
|
+
companyName: existing ? String(existing.name ?? "") : sanitizeCompanyName(companyName) || sanitizeCompanyName(invite.metadata?.name) || sanitizeCompanyName(user?.name),
|
|
24820
|
+
usesExistingCompany: !!existing,
|
|
24821
|
+
currentDefaultOrgName: String(currentDefault?.name ?? ""),
|
|
24822
|
+
status: String(invite.status ?? ""),
|
|
24823
|
+
canApply: !blocked,
|
|
24824
|
+
blocked,
|
|
24825
|
+
applied: applied ? { at: applied.at, by: applied.byName, orgId: applied.orgId, companyName: applied.companyName } : null
|
|
24826
|
+
};
|
|
24827
|
+
}
|
|
24828
|
+
async function finishSetupApply({
|
|
24829
|
+
id,
|
|
24830
|
+
userId,
|
|
24831
|
+
companyName,
|
|
24832
|
+
country
|
|
24833
|
+
}) {
|
|
24834
|
+
const { actor, invite, user, nature, existing, blocked } = await finishSetupContext(id, userId);
|
|
24835
|
+
if (blocked)
|
|
24836
|
+
throw new BadRequestError47(blocked);
|
|
24837
|
+
const defaultOrgWas = String(user.defaultOrg ?? "");
|
|
24838
|
+
let orgId = existing ? String(existing._id) : "";
|
|
24839
|
+
let name = existing ? String(existing.name ?? "") : "";
|
|
24840
|
+
if (!orgId) {
|
|
24841
|
+
({ orgId, name } = await createProviderCompany({ invite, nature, user, companyName, country }));
|
|
24842
|
+
} else {
|
|
24843
|
+
await setDefaultOrg(String(user._id), orgId);
|
|
24844
|
+
}
|
|
24845
|
+
const result = await useCustomerSiteService().addViaInvite(
|
|
24846
|
+
id,
|
|
24847
|
+
{ id: actor.id, name: actor.name },
|
|
24848
|
+
orgId
|
|
24849
|
+
);
|
|
24850
|
+
await _transition({
|
|
24851
|
+
id,
|
|
24852
|
+
from: [],
|
|
24853
|
+
event: {
|
|
24854
|
+
...event("finish-setup-applied", actor),
|
|
24855
|
+
orgId,
|
|
24856
|
+
companyName: name,
|
|
24857
|
+
created: !existing,
|
|
24858
|
+
defaultOrgWas
|
|
24859
|
+
}
|
|
24860
|
+
});
|
|
24861
|
+
if (result.accepted)
|
|
24862
|
+
await notifyInviter(invite, true, name);
|
|
24863
|
+
const siteName = String(invite.metadata?.siteName ?? "");
|
|
24864
|
+
logger36.log({
|
|
24865
|
+
level: "info",
|
|
24866
|
+
message: `[sp-invite] finish-setup invite=${id} org=${orgId} created=${!existing} by=${actor.id}`
|
|
24867
|
+
});
|
|
24868
|
+
return {
|
|
24869
|
+
message: `${name} is set up and linked to ${siteName || "the site"}.`,
|
|
24870
|
+
orgId,
|
|
24871
|
+
companyName: name,
|
|
24872
|
+
nature,
|
|
24873
|
+
created: !existing
|
|
24874
|
+
};
|
|
24875
|
+
}
|
|
24876
|
+
async function finishSetupUndo({ id, userId }) {
|
|
24877
|
+
const { actor, invite, user } = await wrongJoinContext(id, userId);
|
|
24878
|
+
const applied = lastFinishSetup(invite);
|
|
24879
|
+
if (!applied)
|
|
24880
|
+
throw new BadRequestError47("There is no Finish setup to undo on this invitation.");
|
|
24881
|
+
const orgId = String(applied.orgId ?? "");
|
|
24882
|
+
const siteId = invite.metadata?.siteId?.toString?.() ?? "";
|
|
24883
|
+
const db2 = useAtlas38.getDb();
|
|
24884
|
+
if (!db2 || !ObjectId56.isValid(orgId))
|
|
24885
|
+
throw new BadRequestError47("Nothing to undo.");
|
|
24886
|
+
if (ObjectId56.isValid(siteId)) {
|
|
24887
|
+
await db2.collection("customer.sites").updateMany(
|
|
24888
|
+
{ org: new ObjectId56(orgId), site: new ObjectId56(siteId), status: "active" },
|
|
24889
|
+
{ $set: { status: "inactive", updatedAt: (/* @__PURE__ */ new Date()).toISOString() } }
|
|
24890
|
+
);
|
|
24891
|
+
await useCache21("customer.sites").delNamespace().catch(() => void 0);
|
|
24892
|
+
}
|
|
24893
|
+
if (applied.created) {
|
|
24894
|
+
const { updateMemberStatus } = useMemberRepo();
|
|
24895
|
+
const members = await db2.collection("members").find({ org: { $in: [new ObjectId56(orgId), orgId] }, status: "active" }).toArray();
|
|
24896
|
+
for (const m of members) {
|
|
24897
|
+
await updateMemberStatus(m._id.toString(), { status: "inactive" });
|
|
24898
|
+
}
|
|
24899
|
+
await useOrgRepo().updateStatusById(orgId, "deleted").catch(() => void 0);
|
|
24900
|
+
}
|
|
24901
|
+
if (user?._id && String(user.defaultOrg ?? "") === orgId) {
|
|
24902
|
+
await setDefaultOrg(String(user._id), String(applied.defaultOrgWas ?? ""));
|
|
24903
|
+
}
|
|
24904
|
+
await _transition({
|
|
24905
|
+
id,
|
|
24906
|
+
from: ["complete" /* COMPLETE */],
|
|
24907
|
+
to: "pending" /* PENDING */,
|
|
24908
|
+
event: event("finish-setup-undone", actor)
|
|
24909
|
+
});
|
|
24910
|
+
return {
|
|
24911
|
+
message: "Undone: the site is off the company's list and the invitation is open again."
|
|
24912
|
+
};
|
|
24913
|
+
}
|
|
24728
24914
|
async function notifyInviter(invite, accepted, providerName) {
|
|
24729
24915
|
try {
|
|
24730
24916
|
const to = invite.metadata?.invitedBy?.toString?.() ?? "";
|
|
@@ -24938,6 +25124,9 @@ function useServiceProviderInviteService() {
|
|
|
24938
25124
|
wrongJoinPreview,
|
|
24939
25125
|
repairWrongJoin,
|
|
24940
25126
|
undoWrongJoin,
|
|
25127
|
+
finishSetupPreview,
|
|
25128
|
+
finishSetupApply,
|
|
25129
|
+
finishSetupUndo,
|
|
24941
25130
|
linkSite,
|
|
24942
25131
|
listReceived,
|
|
24943
25132
|
getForProvider,
|
|
@@ -26024,7 +26213,7 @@ import {
|
|
|
26024
26213
|
makeCacheKey as makeCacheKey17,
|
|
26025
26214
|
paginate as paginate19,
|
|
26026
26215
|
useAtlas as useAtlas41,
|
|
26027
|
-
useCache as
|
|
26216
|
+
useCache as useCache22,
|
|
26028
26217
|
AppError as AppError12,
|
|
26029
26218
|
toObjectId as toObjectId9
|
|
26030
26219
|
} from "@7365admin1/node-server-utils";
|
|
@@ -26047,7 +26236,7 @@ function usePersonRepo() {
|
|
|
26047
26236
|
}
|
|
26048
26237
|
const collection = db2.collection(site_people_namespace_collection);
|
|
26049
26238
|
const vehiclesCollection = db2.collection("vehicles");
|
|
26050
|
-
const { delNamespace, getCache, setCache } =
|
|
26239
|
+
const { delNamespace, getCache, setCache } = useCache22(
|
|
26051
26240
|
site_people_namespace_collection
|
|
26052
26241
|
);
|
|
26053
26242
|
async function withoutDeletedPlates(people) {
|
|
@@ -29941,7 +30130,7 @@ import {
|
|
|
29941
30130
|
makeCacheKey as makeCacheKey18,
|
|
29942
30131
|
paginate as paginate20,
|
|
29943
30132
|
useAtlas as useAtlas47,
|
|
29944
|
-
useCache as
|
|
30133
|
+
useCache as useCache23
|
|
29945
30134
|
} from "@7365admin1/node-server-utils";
|
|
29946
30135
|
|
|
29947
30136
|
// src/models/subscription.model.ts
|
|
@@ -30103,7 +30292,7 @@ function useSubscriptionRepo() {
|
|
|
30103
30292
|
);
|
|
30104
30293
|
}
|
|
30105
30294
|
}
|
|
30106
|
-
const { delNamespace, setCache, getCache, delCache } =
|
|
30295
|
+
const { delNamespace, setCache, getCache, delCache } = useCache23(namespace_collection3);
|
|
30107
30296
|
async function add(value, session) {
|
|
30108
30297
|
try {
|
|
30109
30298
|
value = MSubscription(value);
|
|
@@ -31758,7 +31947,7 @@ import {
|
|
|
31758
31947
|
logger as logger49,
|
|
31759
31948
|
makeCacheKey as makeCacheKey19,
|
|
31760
31949
|
useAtlas as useAtlas49,
|
|
31761
|
-
useCache as
|
|
31950
|
+
useCache as useCache24
|
|
31762
31951
|
} from "@7365admin1/node-server-utils";
|
|
31763
31952
|
|
|
31764
31953
|
// src/models/address.model.ts
|
|
@@ -31809,7 +31998,7 @@ function useAddressRepo() {
|
|
|
31809
31998
|
throw new InternalServerError28("Failed to create index on address.");
|
|
31810
31999
|
}
|
|
31811
32000
|
}
|
|
31812
|
-
const { delNamespace, getCache, setCache } =
|
|
32001
|
+
const { delNamespace, getCache, setCache } = useCache24(namespace_collection3);
|
|
31813
32002
|
async function add(value, session) {
|
|
31814
32003
|
try {
|
|
31815
32004
|
value = MAddress(value);
|
|
@@ -31867,7 +32056,7 @@ import {
|
|
|
31867
32056
|
NotFoundError as NotFoundError21,
|
|
31868
32057
|
paginate as paginate21,
|
|
31869
32058
|
useAtlas as useAtlas50,
|
|
31870
|
-
useCache as
|
|
32059
|
+
useCache as useCache25
|
|
31871
32060
|
} from "@7365admin1/node-server-utils";
|
|
31872
32061
|
|
|
31873
32062
|
// src/models/promo-code.model.ts
|
|
@@ -32040,7 +32229,7 @@ function usePromoCodeRepo() {
|
|
|
32040
32229
|
);
|
|
32041
32230
|
}
|
|
32042
32231
|
}
|
|
32043
|
-
const { delNamespace, setCache, getCache, delCache } =
|
|
32232
|
+
const { delNamespace, setCache, getCache, delCache } = useCache25(namespace_collection3);
|
|
32044
32233
|
async function invalidate(context) {
|
|
32045
32234
|
try {
|
|
32046
32235
|
await delNamespace();
|
|
@@ -32303,7 +32492,7 @@ import {
|
|
|
32303
32492
|
makeCacheKey as makeCacheKey21,
|
|
32304
32493
|
paginate as paginate22,
|
|
32305
32494
|
useAtlas as useAtlas51,
|
|
32306
|
-
useCache as
|
|
32495
|
+
useCache as useCache26
|
|
32307
32496
|
} from "@7365admin1/node-server-utils";
|
|
32308
32497
|
|
|
32309
32498
|
// src/models/invoice.model.ts
|
|
@@ -32416,7 +32605,7 @@ function useInvoiceRepo() {
|
|
|
32416
32605
|
}
|
|
32417
32606
|
const namespace_collection3 = "invoices";
|
|
32418
32607
|
const { collection, createInvoice } = useInvoiceModel(db2);
|
|
32419
|
-
const { delNamespace, getCache, setCache } =
|
|
32608
|
+
const { delNamespace, getCache, setCache } = useCache26(namespace_collection3);
|
|
32420
32609
|
async function createIndex() {
|
|
32421
32610
|
try {
|
|
32422
32611
|
await collection.createIndexes([
|
|
@@ -32602,7 +32791,7 @@ import {
|
|
|
32602
32791
|
logger as logger52,
|
|
32603
32792
|
makeCacheKey as makeCacheKey22,
|
|
32604
32793
|
useAtlas as useAtlas52,
|
|
32605
|
-
useCache as
|
|
32794
|
+
useCache as useCache27
|
|
32606
32795
|
} from "@7365admin1/node-server-utils";
|
|
32607
32796
|
|
|
32608
32797
|
// src/models/counter.model.ts
|
|
@@ -32647,7 +32836,7 @@ function useCounterRepo() {
|
|
|
32647
32836
|
}
|
|
32648
32837
|
const namespace_collection3 = "counters";
|
|
32649
32838
|
const { collection, createCounter } = useCounterModel(db2);
|
|
32650
|
-
const { delNamespace, getCache, setCache } =
|
|
32839
|
+
const { delNamespace, getCache, setCache } = useCache27(namespace_collection3);
|
|
32651
32840
|
async function createIndex() {
|
|
32652
32841
|
try {
|
|
32653
32842
|
await collection.createIndexes([{ key: { type: 1 } }]);
|
|
@@ -32764,7 +32953,7 @@ import {
|
|
|
32764
32953
|
makeCacheKey as makeCacheKey23,
|
|
32765
32954
|
paginate as paginate23,
|
|
32766
32955
|
useAtlas as useAtlas53,
|
|
32767
|
-
useCache as
|
|
32956
|
+
useCache as useCache28
|
|
32768
32957
|
} from "@7365admin1/node-server-utils";
|
|
32769
32958
|
|
|
32770
32959
|
// src/models/payment.model.ts
|
|
@@ -32897,7 +33086,7 @@ function usePaymentRepo() {
|
|
|
32897
33086
|
}
|
|
32898
33087
|
const namespace_collection3 = "payments";
|
|
32899
33088
|
const { collection, createPayment } = usePaymentModel(db2);
|
|
32900
|
-
const { delNamespace, getCache, setCache } =
|
|
33089
|
+
const { delNamespace, getCache, setCache } = useCache28(namespace_collection3);
|
|
32901
33090
|
async function createIndex() {
|
|
32902
33091
|
try {
|
|
32903
33092
|
await collection.createIndexes([
|
|
@@ -33044,7 +33233,7 @@ import {
|
|
|
33044
33233
|
makeCacheKey as makeCacheKey24,
|
|
33045
33234
|
NotFoundError as NotFoundError22,
|
|
33046
33235
|
useAtlas as useAtlas54,
|
|
33047
|
-
useCache as
|
|
33236
|
+
useCache as useCache29
|
|
33048
33237
|
} from "@7365admin1/node-server-utils";
|
|
33049
33238
|
|
|
33050
33239
|
// src/models/price.model.ts
|
|
@@ -33120,7 +33309,7 @@ function usePriceRepo() {
|
|
|
33120
33309
|
throw new InternalServerError33("Failed to create price unique index.");
|
|
33121
33310
|
}
|
|
33122
33311
|
}
|
|
33123
|
-
const { delNamespace, setCache, getCache, delCache } =
|
|
33312
|
+
const { delNamespace, setCache, getCache, delCache } = useCache29(namespace_collection3);
|
|
33124
33313
|
async function add(value) {
|
|
33125
33314
|
try {
|
|
33126
33315
|
value = createPrice(value);
|
|
@@ -33928,7 +34117,7 @@ import {
|
|
|
33928
34117
|
NotFoundError as NotFoundError23,
|
|
33929
34118
|
paginate as paginate24,
|
|
33930
34119
|
useAtlas as useAtlas56,
|
|
33931
|
-
useCache as
|
|
34120
|
+
useCache as useCache30
|
|
33932
34121
|
} from "@7365admin1/node-server-utils";
|
|
33933
34122
|
|
|
33934
34123
|
// src/models/subscription-plan.model.ts
|
|
@@ -33992,7 +34181,7 @@ function useSubscriptionPlanRepo() {
|
|
|
33992
34181
|
}
|
|
33993
34182
|
const namespace_collection3 = "subscription-plans";
|
|
33994
34183
|
const collection = db2.collection(namespace_collection3);
|
|
33995
|
-
const { delNamespace, getCache, setCache } =
|
|
34184
|
+
const { delNamespace, getCache, setCache } = useCache30(namespace_collection3);
|
|
33996
34185
|
async function createIndex() {
|
|
33997
34186
|
try {
|
|
33998
34187
|
await collection.createIndex([
|
|
@@ -36457,7 +36646,7 @@ import {
|
|
|
36457
36646
|
BadRequestError as BadRequestError91,
|
|
36458
36647
|
paginate as paginate26,
|
|
36459
36648
|
NotFoundError as NotFoundError25,
|
|
36460
|
-
useCache as
|
|
36649
|
+
useCache as useCache31,
|
|
36461
36650
|
logger as logger66,
|
|
36462
36651
|
makeCacheKey as makeCacheKey26
|
|
36463
36652
|
} from "@7365admin1/node-server-utils";
|
|
@@ -36469,7 +36658,7 @@ function useCustomerRepo() {
|
|
|
36469
36658
|
}
|
|
36470
36659
|
const namespace_collection3 = "customers";
|
|
36471
36660
|
const collection = db2.collection(namespace_collection3);
|
|
36472
|
-
const { delNamespace, getCache, setCache } =
|
|
36661
|
+
const { delNamespace, getCache, setCache } = useCache31(namespace_collection3);
|
|
36473
36662
|
async function createIndex() {
|
|
36474
36663
|
try {
|
|
36475
36664
|
await collection.createIndexes([
|
|
@@ -36929,7 +37118,7 @@ import {
|
|
|
36929
37118
|
paginate as paginate27,
|
|
36930
37119
|
toObjectId as toObjectId12,
|
|
36931
37120
|
useAtlas as useAtlas61,
|
|
36932
|
-
useCache as
|
|
37121
|
+
useCache as useCache32
|
|
36933
37122
|
} from "@7365admin1/node-server-utils";
|
|
36934
37123
|
|
|
36935
37124
|
// src/models/building.model.ts
|
|
@@ -37145,7 +37334,7 @@ function useBuildingUnitRepo() {
|
|
|
37145
37334
|
const buildingUnitCollection = db2.collection(
|
|
37146
37335
|
site_people_namespace_collection
|
|
37147
37336
|
);
|
|
37148
|
-
const { getCache, setCache, delNamespace, delCache } =
|
|
37337
|
+
const { getCache, setCache, delNamespace, delCache } = useCache32(
|
|
37149
37338
|
building_units_namespace_collection
|
|
37150
37339
|
);
|
|
37151
37340
|
async function createIndexes() {
|
|
@@ -40895,7 +41084,7 @@ function MChat(value) {
|
|
|
40895
41084
|
import {
|
|
40896
41085
|
useAtlas as useAtlas66,
|
|
40897
41086
|
InternalServerError as InternalServerError37,
|
|
40898
|
-
useCache as
|
|
41087
|
+
useCache as useCache33,
|
|
40899
41088
|
logger as logger74
|
|
40900
41089
|
} from "@7365admin1/node-server-utils";
|
|
40901
41090
|
function useChatRepo() {
|
|
@@ -40905,7 +41094,7 @@ function useChatRepo() {
|
|
|
40905
41094
|
}
|
|
40906
41095
|
const namespace_collection3 = "chats";
|
|
40907
41096
|
const collection = db2.collection(namespace_collection3);
|
|
40908
|
-
const { delNamespace } =
|
|
41097
|
+
const { delNamespace } = useCache33(namespace_collection3);
|
|
40909
41098
|
async function createChat(value, session) {
|
|
40910
41099
|
try {
|
|
40911
41100
|
value = MChat(value);
|
|
@@ -40970,7 +41159,7 @@ import {
|
|
|
40970
41159
|
makeCacheKey as makeCacheKey28,
|
|
40971
41160
|
paginate as paginate28,
|
|
40972
41161
|
useAtlas as useAtlas67,
|
|
40973
|
-
useCache as
|
|
41162
|
+
useCache as useCache34
|
|
40974
41163
|
} from "@7365admin1/node-server-utils";
|
|
40975
41164
|
import { ObjectId as ObjectId86 } from "mongodb";
|
|
40976
41165
|
var buildings_namespace_collection = "buildings";
|
|
@@ -40983,7 +41172,7 @@ function useBuildingRepo() {
|
|
|
40983
41172
|
const buildingUnitCollection = db2.collection(
|
|
40984
41173
|
building_units_namespace_collection
|
|
40985
41174
|
);
|
|
40986
|
-
const { getCache, setCache, delNamespace } =
|
|
41175
|
+
const { getCache, setCache, delNamespace } = useCache34(
|
|
40987
41176
|
buildings_namespace_collection
|
|
40988
41177
|
);
|
|
40989
41178
|
async function createIndexes() {
|
|
@@ -41716,7 +41905,7 @@ import {
|
|
|
41716
41905
|
paginate as paginate29,
|
|
41717
41906
|
toObjectId as toObjectId14,
|
|
41718
41907
|
useAtlas as useAtlas68,
|
|
41719
|
-
useCache as
|
|
41908
|
+
useCache as useCache35
|
|
41720
41909
|
} from "@7365admin1/node-server-utils";
|
|
41721
41910
|
import { ObjectId as ObjectId88 } from "mongodb";
|
|
41722
41911
|
|
|
@@ -41798,13 +41987,13 @@ function useBuildingLevelRepo() {
|
|
|
41798
41987
|
const buildingUnitCollection = db2.collection(
|
|
41799
41988
|
building_units_namespace_collection
|
|
41800
41989
|
);
|
|
41801
|
-
const { getCache, setCache, delNamespace, delCache } =
|
|
41990
|
+
const { getCache, setCache, delNamespace, delCache } = useCache35(
|
|
41802
41991
|
building_level_namespace_collection
|
|
41803
41992
|
);
|
|
41804
|
-
const { delNamespace: delBuildingNamespace } =
|
|
41993
|
+
const { delNamespace: delBuildingNamespace } = useCache35(
|
|
41805
41994
|
buildings_namespace_collection
|
|
41806
41995
|
);
|
|
41807
|
-
const { delNamespace: delUnitNamespace } =
|
|
41996
|
+
const { delNamespace: delUnitNamespace } = useCache35(
|
|
41808
41997
|
building_units_namespace_collection
|
|
41809
41998
|
);
|
|
41810
41999
|
async function createIndexes() {
|
|
@@ -46115,7 +46304,7 @@ import {
|
|
|
46115
46304
|
useAtlas as useAtlas72,
|
|
46116
46305
|
InternalServerError as InternalServerError40,
|
|
46117
46306
|
BadRequestError as BadRequestError114,
|
|
46118
|
-
useCache as
|
|
46307
|
+
useCache as useCache36,
|
|
46119
46308
|
logger as logger87,
|
|
46120
46309
|
makeCacheKey as makeCacheKey30,
|
|
46121
46310
|
NotFoundError as NotFoundError33
|
|
@@ -46127,7 +46316,7 @@ function useAttendanceSettingsRepository() {
|
|
|
46127
46316
|
}
|
|
46128
46317
|
const namespace_collection3 = "site.attendance-settings";
|
|
46129
46318
|
const collection = db2.collection(namespace_collection3);
|
|
46130
|
-
const { delNamespace, setCache, getCache } =
|
|
46319
|
+
const { delNamespace, setCache, getCache } = useCache36(namespace_collection3);
|
|
46131
46320
|
async function createIndex() {
|
|
46132
46321
|
try {
|
|
46133
46322
|
await collection.createIndexes([
|
|
@@ -46402,7 +46591,7 @@ import {
|
|
|
46402
46591
|
InternalServerError as InternalServerError41,
|
|
46403
46592
|
paginate as paginate30,
|
|
46404
46593
|
BadRequestError as BadRequestError117,
|
|
46405
|
-
useCache as
|
|
46594
|
+
useCache as useCache37,
|
|
46406
46595
|
logger as logger91,
|
|
46407
46596
|
makeCacheKey as makeCacheKey31,
|
|
46408
46597
|
NotFoundError as NotFoundError34
|
|
@@ -46414,7 +46603,7 @@ function useAttendanceRepository() {
|
|
|
46414
46603
|
}
|
|
46415
46604
|
const namespace_collection3 = "site.attendances";
|
|
46416
46605
|
const collection = db2.collection(namespace_collection3);
|
|
46417
|
-
const { delNamespace, setCache, getCache, delCache } =
|
|
46606
|
+
const { delNamespace, setCache, getCache, delCache } = useCache37(namespace_collection3);
|
|
46418
46607
|
async function createIndex() {
|
|
46419
46608
|
try {
|
|
46420
46609
|
await collection.createIndexes([
|
|
@@ -60171,7 +60360,7 @@ function UseAccessManagementRepo() {
|
|
|
60171
60360
|
|
|
60172
60361
|
// src/services/access-management.service.ts
|
|
60173
60362
|
import { parseStringPromise as parseStringPromise3 } from "xml2js";
|
|
60174
|
-
import { logger as logger100, makeCacheKey as makeCacheKey33, useCache as
|
|
60363
|
+
import { logger as logger100, makeCacheKey as makeCacheKey33, useCache as useCache39 } from "@7365admin1/node-server-utils";
|
|
60175
60364
|
import { Readable } from "stream";
|
|
60176
60365
|
import * as xlsx from "xlsx";
|
|
60177
60366
|
var namespace = "cache:acm";
|
|
@@ -60245,7 +60434,7 @@ function useAccessManagementSvc() {
|
|
|
60245
60434
|
return result ? JSON.parse(result) : null;
|
|
60246
60435
|
};
|
|
60247
60436
|
const doorAccessLevelsSvc = async (params) => {
|
|
60248
|
-
const { getCache: getCache2, setCache: setCache2 } =
|
|
60437
|
+
const { getCache: getCache2, setCache: setCache2 } = useCache39(namespace);
|
|
60249
60438
|
const cacheKey = makeCacheKey33(namespace, {
|
|
60250
60439
|
user: params.user,
|
|
60251
60440
|
resource: "door-levels"
|
|
@@ -60271,7 +60460,7 @@ function useAccessManagementSvc() {
|
|
|
60271
60460
|
}
|
|
60272
60461
|
};
|
|
60273
60462
|
const liftAccessLevelsSvc = async (params) => {
|
|
60274
|
-
const { getCache: getCache2, setCache: setCache2 } =
|
|
60463
|
+
const { getCache: getCache2, setCache: setCache2 } = useCache39(namespace);
|
|
60275
60464
|
const cacheKey = makeCacheKey33(namespace, {
|
|
60276
60465
|
user: params.user,
|
|
60277
60466
|
resource: "lift-levels"
|
|
@@ -60297,7 +60486,7 @@ function useAccessManagementSvc() {
|
|
|
60297
60486
|
}
|
|
60298
60487
|
};
|
|
60299
60488
|
const accessGroupsSvc = async (params) => {
|
|
60300
|
-
const { getCache: getCache2, setCache: setCache2 } =
|
|
60489
|
+
const { getCache: getCache2, setCache: setCache2 } = useCache39(namespace);
|
|
60301
60490
|
const cacheKey = makeCacheKey33(namespace, {
|
|
60302
60491
|
user: params.user,
|
|
60303
60492
|
resource: "access-groups"
|
|
@@ -61657,7 +61846,7 @@ import {
|
|
|
61657
61846
|
makeCacheKey as makeCacheKey34,
|
|
61658
61847
|
paginate as paginate33,
|
|
61659
61848
|
useAtlas as useAtlas81,
|
|
61660
|
-
useCache as
|
|
61849
|
+
useCache as useCache40
|
|
61661
61850
|
} from "@7365admin1/node-server-utils";
|
|
61662
61851
|
import { ObjectId as ObjectId107 } from "mongodb";
|
|
61663
61852
|
var guests_namespace_collection = "visitor.guests";
|
|
@@ -61667,7 +61856,7 @@ function useGuestManagementRepo() {
|
|
|
61667
61856
|
throw new InternalServerError48("Unable to connect to server.");
|
|
61668
61857
|
}
|
|
61669
61858
|
const collection = db2.collection(guests_namespace_collection);
|
|
61670
|
-
const { delNamespace, getCache, setCache } =
|
|
61859
|
+
const { delNamespace, getCache, setCache } = useCache40(
|
|
61671
61860
|
guests_namespace_collection
|
|
61672
61861
|
);
|
|
61673
61862
|
async function createTextIndex() {
|
|
@@ -62718,7 +62907,7 @@ import {
|
|
|
62718
62907
|
paginate as paginate34,
|
|
62719
62908
|
BadRequestError as BadRequestError134,
|
|
62720
62909
|
NotFoundError as NotFoundError42,
|
|
62721
|
-
useCache as
|
|
62910
|
+
useCache as useCache41,
|
|
62722
62911
|
makeCacheKey as makeCacheKey35,
|
|
62723
62912
|
logger as logger106
|
|
62724
62913
|
} from "@7365admin1/node-server-utils";
|
|
@@ -63132,7 +63321,7 @@ function useRobotRepo() {
|
|
|
63132
63321
|
}
|
|
63133
63322
|
const namespace_collection3 = "robots";
|
|
63134
63323
|
const collection = db2.collection(namespace_collection3);
|
|
63135
|
-
const { delNamespace, getCache, setCache } =
|
|
63324
|
+
const { delNamespace, getCache, setCache } = useCache41(namespace_collection3);
|
|
63136
63325
|
async function createIndex() {
|
|
63137
63326
|
try {
|
|
63138
63327
|
await collection.createIndexes([
|
|
@@ -73706,7 +73895,7 @@ import {
|
|
|
73706
73895
|
makeCacheKey as makeCacheKey36,
|
|
73707
73896
|
paginate as paginate36,
|
|
73708
73897
|
useAtlas as useAtlas86,
|
|
73709
|
-
useCache as
|
|
73898
|
+
useCache as useCache42
|
|
73710
73899
|
} from "@7365admin1/node-server-utils";
|
|
73711
73900
|
import { ObjectId as ObjectId115 } from "mongodb";
|
|
73712
73901
|
function usePatrolQuestionRepo() {
|
|
@@ -73716,7 +73905,7 @@ function usePatrolQuestionRepo() {
|
|
|
73716
73905
|
}
|
|
73717
73906
|
const namespace_collection3 = "patrol.questions";
|
|
73718
73907
|
const collection = db2.collection(namespace_collection3);
|
|
73719
|
-
const { delNamespace, getCache, setCache } =
|
|
73908
|
+
const { delNamespace, getCache, setCache } = useCache42(namespace_collection3);
|
|
73720
73909
|
async function createIndexes() {
|
|
73721
73910
|
try {
|
|
73722
73911
|
await collection.createIndexes([{ key: { site: 1, status: 1 } }]);
|
|
@@ -74171,7 +74360,7 @@ import {
|
|
|
74171
74360
|
makeCacheKey as makeCacheKey37,
|
|
74172
74361
|
paginate as paginate37,
|
|
74173
74362
|
useAtlas as useAtlas87,
|
|
74174
|
-
useCache as
|
|
74363
|
+
useCache as useCache43
|
|
74175
74364
|
} from "@7365admin1/node-server-utils";
|
|
74176
74365
|
import { ObjectId as ObjectId117 } from "mongodb";
|
|
74177
74366
|
|
|
@@ -74192,7 +74381,7 @@ function usePatrolRouteRepo() {
|
|
|
74192
74381
|
}
|
|
74193
74382
|
const namespace_collection3 = "patrol.route";
|
|
74194
74383
|
const collection = db2.collection(namespace_collection3);
|
|
74195
|
-
const { delNamespace, getCache, setCache } =
|
|
74384
|
+
const { delNamespace, getCache, setCache } = useCache43(namespace_collection3);
|
|
74196
74385
|
async function createIndexes() {
|
|
74197
74386
|
try {
|
|
74198
74387
|
await collection.createIndexes([
|
|
@@ -74951,7 +75140,7 @@ import {
|
|
|
74951
75140
|
makeCacheKey as makeCacheKey38,
|
|
74952
75141
|
paginate as paginate38,
|
|
74953
75142
|
useAtlas as useAtlas88,
|
|
74954
|
-
useCache as
|
|
75143
|
+
useCache as useCache44
|
|
74955
75144
|
} from "@7365admin1/node-server-utils";
|
|
74956
75145
|
import { ObjectId as ObjectId119 } from "mongodb";
|
|
74957
75146
|
function usePatrolLogRepo() {
|
|
@@ -74961,7 +75150,7 @@ function usePatrolLogRepo() {
|
|
|
74961
75150
|
}
|
|
74962
75151
|
const namespace_collection3 = "patrol.logs";
|
|
74963
75152
|
const collection = db2.collection(namespace_collection3);
|
|
74964
|
-
const { delNamespace, getCache, setCache } =
|
|
75153
|
+
const { delNamespace, getCache, setCache } = useCache44(namespace_collection3);
|
|
74965
75154
|
async function createIndexes() {
|
|
74966
75155
|
try {
|
|
74967
75156
|
await collection.createIndexes([
|
|
@@ -76847,7 +77036,7 @@ import {
|
|
|
76847
77036
|
NotFoundError as NotFoundError51,
|
|
76848
77037
|
paginate as paginate40,
|
|
76849
77038
|
useAtlas as useAtlas91,
|
|
76850
|
-
useCache as
|
|
77039
|
+
useCache as useCache45
|
|
76851
77040
|
} from "@7365admin1/node-server-utils";
|
|
76852
77041
|
import { ObjectId as ObjectId123 } from "mongodb";
|
|
76853
77042
|
function useSiteFacilityRepo() {
|
|
@@ -76857,7 +77046,7 @@ function useSiteFacilityRepo() {
|
|
|
76857
77046
|
}
|
|
76858
77047
|
const namespace_collection3 = "site.facilities";
|
|
76859
77048
|
const collection = db2.collection(namespace_collection3);
|
|
76860
|
-
const { delNamespace, getCache, setCache } =
|
|
77049
|
+
const { delNamespace, getCache, setCache } = useCache45(namespace_collection3);
|
|
76861
77050
|
async function createTextIndex() {
|
|
76862
77051
|
try {
|
|
76863
77052
|
await collection.createIndex({
|
|
@@ -77529,7 +77718,7 @@ import {
|
|
|
77529
77718
|
NotFoundError as NotFoundError53,
|
|
77530
77719
|
paginate as paginate41,
|
|
77531
77720
|
useAtlas as useAtlas93,
|
|
77532
|
-
useCache as
|
|
77721
|
+
useCache as useCache46
|
|
77533
77722
|
} from "@7365admin1/node-server-utils";
|
|
77534
77723
|
import { ObjectId as ObjectId125 } from "mongodb";
|
|
77535
77724
|
function useServiceProviderBillingRepo() {
|
|
@@ -77539,7 +77728,7 @@ function useServiceProviderBillingRepo() {
|
|
|
77539
77728
|
}
|
|
77540
77729
|
const namespace_collection3 = "site.service-provider.billing";
|
|
77541
77730
|
const collection = db2.collection(namespace_collection3);
|
|
77542
|
-
const { delNamespace, getCache, setCache } =
|
|
77731
|
+
const { delNamespace, getCache, setCache } = useCache46(namespace_collection3);
|
|
77543
77732
|
async function createIndexes() {
|
|
77544
77733
|
try {
|
|
77545
77734
|
await collection.createIndexes([{ key: { orgId: 1, status: 1 } }]);
|
|
@@ -78200,7 +78389,7 @@ import {
|
|
|
78200
78389
|
paginate as paginate42,
|
|
78201
78390
|
toObjectId as toObjectId18,
|
|
78202
78391
|
useAtlas as useAtlas95,
|
|
78203
|
-
useCache as
|
|
78392
|
+
useCache as useCache47
|
|
78204
78393
|
} from "@7365admin1/node-server-utils";
|
|
78205
78394
|
import { ObjectId as ObjectId127 } from "mongodb";
|
|
78206
78395
|
var facility_bookings_namespace_collection = "site.facilty-booking";
|
|
@@ -78210,7 +78399,7 @@ function useSiteFacilityBookingRepo() {
|
|
|
78210
78399
|
throw new InternalServerError58("Unable to connect to server.");
|
|
78211
78400
|
}
|
|
78212
78401
|
const collection = db2.collection(facility_bookings_namespace_collection);
|
|
78213
|
-
const { delNamespace, getCache, setCache } =
|
|
78402
|
+
const { delNamespace, getCache, setCache } = useCache47(
|
|
78214
78403
|
facility_bookings_namespace_collection
|
|
78215
78404
|
);
|
|
78216
78405
|
async function createIndexes() {
|
|
@@ -78768,7 +78957,7 @@ import {
|
|
|
78768
78957
|
NotFoundError as NotFoundError56,
|
|
78769
78958
|
paginate as paginate43,
|
|
78770
78959
|
useAtlas as useAtlas97,
|
|
78771
|
-
useCache as
|
|
78960
|
+
useCache as useCache48
|
|
78772
78961
|
} from "@7365admin1/node-server-utils";
|
|
78773
78962
|
import { ObjectId as ObjectId129 } from "mongodb";
|
|
78774
78963
|
function useDocumentManagementRepo() {
|
|
@@ -78778,7 +78967,7 @@ function useDocumentManagementRepo() {
|
|
|
78778
78967
|
}
|
|
78779
78968
|
const namespace_collection3 = "documents";
|
|
78780
78969
|
const collection = db2.collection(namespace_collection3);
|
|
78781
|
-
const { delNamespace, getCache, setCache } =
|
|
78970
|
+
const { delNamespace, getCache, setCache } = useCache48(namespace_collection3);
|
|
78782
78971
|
async function createIndex() {
|
|
78783
78972
|
try {
|
|
78784
78973
|
await collection.createIndexes([
|
|
@@ -79868,7 +80057,7 @@ import {
|
|
|
79868
80057
|
NotFoundError as NotFoundError58,
|
|
79869
80058
|
paginate as paginate44,
|
|
79870
80059
|
useAtlas as useAtlas99,
|
|
79871
|
-
useCache as
|
|
80060
|
+
useCache as useCache49
|
|
79872
80061
|
} from "@7365admin1/node-server-utils";
|
|
79873
80062
|
import { ObjectId as ObjectId132 } from "mongodb";
|
|
79874
80063
|
var bulletin_boards_namespace_collection = "bulletin-boards";
|
|
@@ -79878,7 +80067,7 @@ function useBulletinBoardRepo() {
|
|
|
79878
80067
|
throw new InternalServerError60("Unable to connect to server.");
|
|
79879
80068
|
}
|
|
79880
80069
|
const collection = db2.collection(bulletin_boards_namespace_collection);
|
|
79881
|
-
const { delNamespace, getCache, setCache } =
|
|
80070
|
+
const { delNamespace, getCache, setCache } = useCache49(
|
|
79882
80071
|
bulletin_boards_namespace_collection
|
|
79883
80072
|
);
|
|
79884
80073
|
async function createIndexes() {
|
|
@@ -80707,7 +80896,7 @@ import {
|
|
|
80707
80896
|
InternalServerError as InternalServerError61,
|
|
80708
80897
|
logger as logger142,
|
|
80709
80898
|
useAtlas as useAtlas101,
|
|
80710
|
-
useCache as
|
|
80899
|
+
useCache as useCache50,
|
|
80711
80900
|
paginate as paginate45,
|
|
80712
80901
|
makeCacheKey as makeCacheKey44
|
|
80713
80902
|
} from "@7365admin1/node-server-utils";
|
|
@@ -80719,7 +80908,7 @@ function useSiteBillingItemRepo() {
|
|
|
80719
80908
|
}
|
|
80720
80909
|
const namespace_collection3 = "site.billing.items";
|
|
80721
80910
|
const collection = db2.collection(namespace_collection3);
|
|
80722
|
-
const { delNamespace, setCache, getCache } =
|
|
80911
|
+
const { delNamespace, setCache, getCache } = useCache50(namespace_collection3);
|
|
80723
80912
|
async function createIndexes() {
|
|
80724
80913
|
try {
|
|
80725
80914
|
await collection.createIndexes([
|
|
@@ -80968,7 +81157,7 @@ import {
|
|
|
80968
81157
|
InternalServerError as InternalServerError62,
|
|
80969
81158
|
logger as logger144,
|
|
80970
81159
|
useAtlas as useAtlas102,
|
|
80971
|
-
useCache as
|
|
81160
|
+
useCache as useCache51,
|
|
80972
81161
|
paginate as paginate46,
|
|
80973
81162
|
makeCacheKey as makeCacheKey45
|
|
80974
81163
|
} from "@7365admin1/node-server-utils";
|
|
@@ -81100,7 +81289,7 @@ function useSiteBillingConfigurationRepo() {
|
|
|
81100
81289
|
}
|
|
81101
81290
|
const namespace_collection3 = "site.billing.configuration";
|
|
81102
81291
|
const collection = db2.collection(namespace_collection3);
|
|
81103
|
-
const { delNamespace, setCache, getCache } =
|
|
81292
|
+
const { delNamespace, setCache, getCache } = useCache51(namespace_collection3);
|
|
81104
81293
|
async function createIndexes() {
|
|
81105
81294
|
try {
|
|
81106
81295
|
await collection.createIndexes([{ key: { site: 1, status: 1 } }]);
|
|
@@ -81963,7 +82152,7 @@ import {
|
|
|
81963
82152
|
NotFoundError as NotFoundError63,
|
|
81964
82153
|
paginate as paginate47,
|
|
81965
82154
|
useAtlas as useAtlas105,
|
|
81966
|
-
useCache as
|
|
82155
|
+
useCache as useCache52
|
|
81967
82156
|
} from "@7365admin1/node-server-utils";
|
|
81968
82157
|
import { ObjectId as ObjectId139 } from "mongodb";
|
|
81969
82158
|
var events_namespace_collection = "event-management";
|
|
@@ -81973,7 +82162,7 @@ function useEventManagementRepo() {
|
|
|
81973
82162
|
throw new InternalServerError63("Unable to connect to server.");
|
|
81974
82163
|
}
|
|
81975
82164
|
const collection = db2.collection(events_namespace_collection);
|
|
81976
|
-
const { delNamespace, getCache, setCache } =
|
|
82165
|
+
const { delNamespace, getCache, setCache } = useCache52(
|
|
81977
82166
|
events_namespace_collection
|
|
81978
82167
|
);
|
|
81979
82168
|
async function createIndexes() {
|
|
@@ -82684,7 +82873,7 @@ import {
|
|
|
82684
82873
|
InternalServerError as InternalServerError64,
|
|
82685
82874
|
logger as logger152,
|
|
82686
82875
|
useAtlas as useAtlas107,
|
|
82687
|
-
useCache as
|
|
82876
|
+
useCache as useCache53,
|
|
82688
82877
|
paginate as paginate48,
|
|
82689
82878
|
makeCacheKey as makeCacheKey47
|
|
82690
82879
|
} from "@7365admin1/node-server-utils";
|
|
@@ -82696,7 +82885,7 @@ function useSiteUnitBillingRepo() {
|
|
|
82696
82885
|
}
|
|
82697
82886
|
const namespace_collection3 = "site.unit.billing";
|
|
82698
82887
|
const collection = db2.collection(namespace_collection3);
|
|
82699
|
-
const { delNamespace, setCache, getCache } =
|
|
82888
|
+
const { delNamespace, setCache, getCache } = useCache53(namespace_collection3);
|
|
82700
82889
|
async function createIndexes() {
|
|
82701
82890
|
try {
|
|
82702
82891
|
await collection.createIndexes([
|
|
@@ -85282,7 +85471,7 @@ import {
|
|
|
85282
85471
|
NotFoundError as NotFoundError66,
|
|
85283
85472
|
paginate as paginate49,
|
|
85284
85473
|
useAtlas as useAtlas110,
|
|
85285
|
-
useCache as
|
|
85474
|
+
useCache as useCache54
|
|
85286
85475
|
} from "@7365admin1/node-server-utils";
|
|
85287
85476
|
import { ObjectId as ObjectId145 } from "mongodb";
|
|
85288
85477
|
function useNfcPatrolTagRepo() {
|
|
@@ -85293,8 +85482,8 @@ function useNfcPatrolTagRepo() {
|
|
|
85293
85482
|
const namespace_collection3 = "nfc-patrol-tags";
|
|
85294
85483
|
const namespace_collection_nfc_patrol_routes = "nfc-patrol-routes";
|
|
85295
85484
|
const collection = db2.collection(namespace_collection3);
|
|
85296
|
-
const { delNamespace, getCache, setCache } =
|
|
85297
|
-
const { delNamespace: delNamespaceNfcPatrolRoutes } =
|
|
85485
|
+
const { delNamespace, getCache, setCache } = useCache54(namespace_collection3);
|
|
85486
|
+
const { delNamespace: delNamespaceNfcPatrolRoutes } = useCache54(
|
|
85298
85487
|
namespace_collection_nfc_patrol_routes
|
|
85299
85488
|
);
|
|
85300
85489
|
async function createIndexes() {
|
|
@@ -85518,7 +85707,7 @@ import {
|
|
|
85518
85707
|
makeCacheKey as makeCacheKey49,
|
|
85519
85708
|
paginate as paginate50,
|
|
85520
85709
|
useAtlas as useAtlas111,
|
|
85521
|
-
useCache as
|
|
85710
|
+
useCache as useCache55
|
|
85522
85711
|
} from "@7365admin1/node-server-utils";
|
|
85523
85712
|
import { ObjectId as ObjectId147 } from "mongodb";
|
|
85524
85713
|
|
|
@@ -85597,7 +85786,7 @@ function useNfcPatrolRouteRepo() {
|
|
|
85597
85786
|
}
|
|
85598
85787
|
const namespace_collection3 = "nfc-patrol-routes";
|
|
85599
85788
|
const collection = db2.collection(namespace_collection3);
|
|
85600
|
-
const { delNamespace, getCache, setCache } =
|
|
85789
|
+
const { delNamespace, getCache, setCache } = useCache55(namespace_collection3);
|
|
85601
85790
|
async function createIndexes() {
|
|
85602
85791
|
try {
|
|
85603
85792
|
await collection.createIndexes([
|
|
@@ -86435,7 +86624,7 @@ import {
|
|
|
86435
86624
|
NotFoundError as NotFoundError68,
|
|
86436
86625
|
paginate as paginate51,
|
|
86437
86626
|
useAtlas as useAtlas113,
|
|
86438
|
-
useCache as
|
|
86627
|
+
useCache as useCache56
|
|
86439
86628
|
} from "@7365admin1/node-server-utils";
|
|
86440
86629
|
import { ObjectId as ObjectId149 } from "mongodb";
|
|
86441
86630
|
function useBulletinVideoRepo() {
|
|
@@ -86454,7 +86643,7 @@ function useBulletinVideoRepo() {
|
|
|
86454
86643
|
}
|
|
86455
86644
|
const namespace_collection3 = "bulletin-videos";
|
|
86456
86645
|
const collection = db2.collection(namespace_collection3);
|
|
86457
|
-
const { delNamespace, getCache, setCache } =
|
|
86646
|
+
const { delNamespace, getCache, setCache } = useCache56(namespace_collection3);
|
|
86458
86647
|
async function add(value, session) {
|
|
86459
86648
|
try {
|
|
86460
86649
|
value = MBulletinVideo(value);
|
|
@@ -87037,7 +87226,7 @@ import {
|
|
|
87037
87226
|
InternalServerError as InternalServerError68,
|
|
87038
87227
|
logger as logger163,
|
|
87039
87228
|
useAtlas as useAtlas115,
|
|
87040
|
-
useCache as
|
|
87229
|
+
useCache as useCache57,
|
|
87041
87230
|
paginate as paginate52,
|
|
87042
87231
|
makeCacheKey as makeCacheKey51
|
|
87043
87232
|
} from "@7365admin1/node-server-utils";
|
|
@@ -87049,7 +87238,7 @@ function useStatementOfAccountRepo() {
|
|
|
87049
87238
|
}
|
|
87050
87239
|
const namespace_collection3 = "site.statement-of-accounts";
|
|
87051
87240
|
const collection = db2.collection(namespace_collection3);
|
|
87052
|
-
const { delNamespace, getCache, setCache } =
|
|
87241
|
+
const { delNamespace, getCache, setCache } = useCache57(namespace_collection3);
|
|
87053
87242
|
async function createIndexes() {
|
|
87054
87243
|
try {
|
|
87055
87244
|
await collection.createIndexes([
|
|
@@ -88054,7 +88243,7 @@ import {
|
|
|
88054
88243
|
NotFoundError as NotFoundError72,
|
|
88055
88244
|
paginate as paginate53,
|
|
88056
88245
|
useAtlas as useAtlas117,
|
|
88057
|
-
useCache as
|
|
88246
|
+
useCache as useCache58
|
|
88058
88247
|
} from "@7365admin1/node-server-utils";
|
|
88059
88248
|
import { ObjectId as ObjectId154 } from "mongodb";
|
|
88060
88249
|
function useEntryPassSettingsRepo() {
|
|
@@ -88064,7 +88253,7 @@ function useEntryPassSettingsRepo() {
|
|
|
88064
88253
|
}
|
|
88065
88254
|
const namespace_collection3 = "site.entrypass-settings";
|
|
88066
88255
|
const collection = db2.collection(namespace_collection3);
|
|
88067
|
-
const { delNamespace, getCache, setCache } =
|
|
88256
|
+
const { delNamespace, getCache, setCache } = useCache58(namespace_collection3);
|
|
88068
88257
|
async function createTextIndex() {
|
|
88069
88258
|
try {
|
|
88070
88259
|
await collection.createIndex({
|
|
@@ -88640,7 +88829,7 @@ import {
|
|
|
88640
88829
|
logger as logger169,
|
|
88641
88830
|
makeCacheKey as makeCacheKey53,
|
|
88642
88831
|
useAtlas as useAtlas118,
|
|
88643
|
-
useCache as
|
|
88832
|
+
useCache as useCache59
|
|
88644
88833
|
} from "@7365admin1/node-server-utils";
|
|
88645
88834
|
function useDashboardRepo() {
|
|
88646
88835
|
const db2 = useAtlas118.getDb();
|
|
@@ -88651,7 +88840,7 @@ function useDashboardRepo() {
|
|
|
88651
88840
|
const work_order_collection = db2.collection("work-orders");
|
|
88652
88841
|
const visitor_collection = db2.collection("visitor.transactions");
|
|
88653
88842
|
const namespace_collection3 = "dashboard";
|
|
88654
|
-
const { delNamespace, getCache, setCache } =
|
|
88843
|
+
const { delNamespace, getCache, setCache } = useCache59(namespace_collection3);
|
|
88655
88844
|
async function getAll({
|
|
88656
88845
|
site = ""
|
|
88657
88846
|
}, session) {
|
|
@@ -89294,7 +89483,7 @@ import {
|
|
|
89294
89483
|
NotFoundError as NotFoundError74,
|
|
89295
89484
|
paginate as paginate54,
|
|
89296
89485
|
useAtlas as useAtlas120,
|
|
89297
|
-
useCache as
|
|
89486
|
+
useCache as useCache60
|
|
89298
89487
|
} from "@7365admin1/node-server-utils";
|
|
89299
89488
|
import { ObjectId as ObjectId156 } from "mongodb";
|
|
89300
89489
|
var incidents_namespace_collection = "incident-reports";
|
|
@@ -89325,7 +89514,7 @@ function useIncidentReportRepo() {
|
|
|
89325
89514
|
}
|
|
89326
89515
|
}
|
|
89327
89516
|
const collection = db2.collection(incidents_namespace_collection);
|
|
89328
|
-
const { delNamespace, getCache, setCache } =
|
|
89517
|
+
const { delNamespace, getCache, setCache } = useCache60(
|
|
89329
89518
|
incidents_namespace_collection
|
|
89330
89519
|
);
|
|
89331
89520
|
async function add(value, session) {
|
|
@@ -90317,7 +90506,7 @@ import {
|
|
|
90317
90506
|
makeCacheKey as makeCacheKey55,
|
|
90318
90507
|
NotFoundError as NotFoundError76,
|
|
90319
90508
|
useAtlas as useAtlas122,
|
|
90320
|
-
useCache as
|
|
90509
|
+
useCache as useCache61
|
|
90321
90510
|
} from "@7365admin1/node-server-utils";
|
|
90322
90511
|
import { ObjectId as ObjectId158 } from "mongodb";
|
|
90323
90512
|
function useNfcPatrolSettingsRepository() {
|
|
@@ -90327,7 +90516,7 @@ function useNfcPatrolSettingsRepository() {
|
|
|
90327
90516
|
}
|
|
90328
90517
|
const namespace_collection3 = "site.nfc-patrol-settings";
|
|
90329
90518
|
const collection = db2.collection(namespace_collection3);
|
|
90330
|
-
const { delNamespace, setCache, getCache } =
|
|
90519
|
+
const { delNamespace, setCache, getCache } = useCache61(namespace_collection3);
|
|
90331
90520
|
async function createIndexes() {
|
|
90332
90521
|
try {
|
|
90333
90522
|
await collection.createIndexes([{ key: { site: 1 }, unique: true }]);
|
|
@@ -90575,7 +90764,7 @@ import {
|
|
|
90575
90764
|
NotFoundError as NotFoundError77,
|
|
90576
90765
|
paginate as paginate55,
|
|
90577
90766
|
useAtlas as useAtlas124,
|
|
90578
|
-
useCache as
|
|
90767
|
+
useCache as useCache62
|
|
90579
90768
|
} from "@7365admin1/node-server-utils";
|
|
90580
90769
|
|
|
90581
90770
|
// src/models/occurrence-subject.model.ts
|
|
@@ -90663,7 +90852,7 @@ function useOccurrenceSubjectRepo() {
|
|
|
90663
90852
|
}
|
|
90664
90853
|
const namespace_collection3 = "occurrence-subjects";
|
|
90665
90854
|
const collection = db2.collection(namespace_collection3);
|
|
90666
|
-
const { delNamespace, getCache, setCache } =
|
|
90855
|
+
const { delNamespace, getCache, setCache } = useCache62(namespace_collection3);
|
|
90667
90856
|
async function add(value, session) {
|
|
90668
90857
|
try {
|
|
90669
90858
|
value = MOccurrenceSubject(value);
|
|
@@ -91284,7 +91473,7 @@ import {
|
|
|
91284
91473
|
NotFoundError as NotFoundError78,
|
|
91285
91474
|
paginate as paginate56,
|
|
91286
91475
|
useAtlas as useAtlas126,
|
|
91287
|
-
useCache as
|
|
91476
|
+
useCache as useCache63
|
|
91288
91477
|
} from "@7365admin1/node-server-utils";
|
|
91289
91478
|
import { ObjectId as ObjectId163 } from "mongodb";
|
|
91290
91479
|
function useOnlineFormRepo() {
|
|
@@ -91294,7 +91483,7 @@ function useOnlineFormRepo() {
|
|
|
91294
91483
|
}
|
|
91295
91484
|
const namespace_collection3 = "online-forms";
|
|
91296
91485
|
const collection = db2.collection(namespace_collection3);
|
|
91297
|
-
const { delNamespace, getCache, setCache } =
|
|
91486
|
+
const { delNamespace, getCache, setCache } = useCache63(namespace_collection3);
|
|
91298
91487
|
async function createTextIndex() {
|
|
91299
91488
|
try {
|
|
91300
91489
|
await collection.createIndex({
|
|
@@ -92092,7 +92281,7 @@ import {
|
|
|
92092
92281
|
makeCacheKey as makeCacheKey58,
|
|
92093
92282
|
paginate as paginate57,
|
|
92094
92283
|
useAtlas as useAtlas128,
|
|
92095
|
-
useCache as
|
|
92284
|
+
useCache as useCache64
|
|
92096
92285
|
} from "@7365admin1/node-server-utils";
|
|
92097
92286
|
import { ObjectId as ObjectId165 } from "mongodb";
|
|
92098
92287
|
function useNfcPatrolLogRepo() {
|
|
@@ -92102,7 +92291,7 @@ function useNfcPatrolLogRepo() {
|
|
|
92102
92291
|
}
|
|
92103
92292
|
const namespace_collection3 = "nfc-patrol-logs";
|
|
92104
92293
|
const collection = db2.collection(namespace_collection3);
|
|
92105
|
-
const { delNamespace, getCache, setCache } =
|
|
92294
|
+
const { delNamespace, getCache, setCache } = useCache64(namespace_collection3);
|
|
92106
92295
|
async function createIndexes() {
|
|
92107
92296
|
try {
|
|
92108
92297
|
await collection.createIndexes([
|
|
@@ -95808,7 +95997,7 @@ import {
|
|
|
95808
95997
|
makeCacheKey as makeCacheKey62,
|
|
95809
95998
|
toObjectId as toObjectId20,
|
|
95810
95999
|
useAtlas as useAtlas135,
|
|
95811
|
-
useCache as
|
|
96000
|
+
useCache as useCache68
|
|
95812
96001
|
} from "@7365admin1/node-server-utils";
|
|
95813
96002
|
var overnight_parking_namespace_collection = "site.overnight-parking";
|
|
95814
96003
|
function useOvernightParkingRepo() {
|
|
@@ -95817,7 +96006,7 @@ function useOvernightParkingRepo() {
|
|
|
95817
96006
|
throw new InternalServerError80("Unable to connect to server.");
|
|
95818
96007
|
}
|
|
95819
96008
|
const collection = db2.collection(overnight_parking_namespace_collection);
|
|
95820
|
-
const { delNamespace, setCache, getCache } =
|
|
96009
|
+
const { delNamespace, setCache, getCache } = useCache68(
|
|
95821
96010
|
overnight_parking_namespace_collection
|
|
95822
96011
|
);
|
|
95823
96012
|
async function createIndexes() {
|
|
@@ -96037,7 +96226,7 @@ import {
|
|
|
96037
96226
|
paginate as paginate64,
|
|
96038
96227
|
toObjectId as toObjectId22,
|
|
96039
96228
|
useAtlas as useAtlas136,
|
|
96040
|
-
useCache as
|
|
96229
|
+
useCache as useCache69
|
|
96041
96230
|
} from "@7365admin1/node-server-utils";
|
|
96042
96231
|
var overnight_parking_requests_namespace_collection = "site.overnight-parking-requests";
|
|
96043
96232
|
function useOvernightParkingRequestRepo() {
|
|
@@ -96048,7 +96237,7 @@ function useOvernightParkingRequestRepo() {
|
|
|
96048
96237
|
const collection = db2.collection(
|
|
96049
96238
|
overnight_parking_requests_namespace_collection
|
|
96050
96239
|
);
|
|
96051
|
-
const { delNamespace, getCache, setCache } =
|
|
96240
|
+
const { delNamespace, getCache, setCache } = useCache69(
|
|
96052
96241
|
overnight_parking_requests_namespace_collection
|
|
96053
96242
|
);
|
|
96054
96243
|
async function createIndexes() {
|
|
@@ -97651,7 +97840,7 @@ function useManpowerSitesCtrl() {
|
|
|
97651
97840
|
import {
|
|
97652
97841
|
useAtlas as useAtlas140,
|
|
97653
97842
|
useMailer as useMailer7,
|
|
97654
|
-
useCache as
|
|
97843
|
+
useCache as useCache71,
|
|
97655
97844
|
compileHandlebar as compileHandlebar6,
|
|
97656
97845
|
getDirectory as getDirectory6,
|
|
97657
97846
|
logger as logger206
|
|
@@ -97822,7 +98011,7 @@ var updateRemarksisAcknowledged = async () => {
|
|
|
97822
98011
|
},
|
|
97823
98012
|
{ $set: { "remarks.2.remark.isAcknowledged": false } }
|
|
97824
98013
|
);
|
|
97825
|
-
const { getCache, setCache } =
|
|
98014
|
+
const { getCache, setCache } = useCache71("manpower-alerts");
|
|
97826
98015
|
const capKey = `manpower-alert-count:${nowSGT}`;
|
|
97827
98016
|
let sentToday = await getCache(capKey) ?? 0;
|
|
97828
98017
|
const emailedSites = /* @__PURE__ */ new Set();
|
|
@@ -98038,7 +98227,7 @@ var isWithinHour = (alertTime, timeNow) => {
|
|
|
98038
98227
|
};
|
|
98039
98228
|
|
|
98040
98229
|
// src/events/manpower.event.ts
|
|
98041
|
-
import { logger as logger207, useAtlas as useAtlas141, useCache as
|
|
98230
|
+
import { logger as logger207, useAtlas as useAtlas141, useCache as useCache72 } from "@7365admin1/node-server-utils";
|
|
98042
98231
|
import { ObjectId as ObjectId176 } from "mongodb";
|
|
98043
98232
|
import moment12 from "moment-timezone";
|
|
98044
98233
|
|
|
@@ -98197,7 +98386,7 @@ async function manpowerEvents(io) {
|
|
|
98197
98386
|
const live2 = io.of(MANPOWER_LIVE_NAMESPACE);
|
|
98198
98387
|
live2.use(async (socket, next) => {
|
|
98199
98388
|
try {
|
|
98200
|
-
const { getCache } =
|
|
98389
|
+
const { getCache } = useCache72("sessions");
|
|
98201
98390
|
socket.data.userId = await authoriseSocketSession(
|
|
98202
98391
|
socket.handshake,
|
|
98203
98392
|
(sid) => getCache(`sid:${sid}`)
|
|
@@ -99124,7 +99313,7 @@ import {
|
|
|
99124
99313
|
InternalServerError as InternalServerError86,
|
|
99125
99314
|
NotFoundError as NotFoundError87,
|
|
99126
99315
|
useAtlas as useAtlas145,
|
|
99127
|
-
useCache as
|
|
99316
|
+
useCache as useCache74
|
|
99128
99317
|
} from "@7365admin1/node-server-utils";
|
|
99129
99318
|
import { v4 as uuidv42 } from "uuid";
|
|
99130
99319
|
|
|
@@ -99138,7 +99327,7 @@ import {
|
|
|
99138
99327
|
paginate as paginate68,
|
|
99139
99328
|
NotFoundError as NotFoundError86,
|
|
99140
99329
|
AppError as AppError48,
|
|
99141
|
-
useCache as
|
|
99330
|
+
useCache as useCache73,
|
|
99142
99331
|
makeCacheKey as makeCacheKey65,
|
|
99143
99332
|
toObjectId as toObjectId23
|
|
99144
99333
|
} from "@7365admin1/node-server-utils";
|
|
@@ -99152,7 +99341,7 @@ function useUserRepoV2() {
|
|
|
99152
99341
|
}
|
|
99153
99342
|
const namespace_collection3 = "users";
|
|
99154
99343
|
const collection = db2.collection(namespace_collection3);
|
|
99155
|
-
const { delNamespace, setCache, getCache, delCache } =
|
|
99344
|
+
const { delNamespace, setCache, getCache, delCache } = useCache73(namespace_collection3);
|
|
99156
99345
|
async function createIndex() {
|
|
99157
99346
|
try {
|
|
99158
99347
|
await collection.createIndexes([{ key: { email: 1 } }]);
|
|
@@ -99611,7 +99800,7 @@ function useAuthServiceV2() {
|
|
|
99611
99800
|
insertRotated: _insertRotated,
|
|
99612
99801
|
revokeFamily: _revokeFamily
|
|
99613
99802
|
} = useSessionRepo();
|
|
99614
|
-
const { getCache, setCache, delCache } =
|
|
99803
|
+
const { getCache, setCache, delCache } = useCache74("sessions");
|
|
99615
99804
|
const { getByUserIdType } = useMemberRepo();
|
|
99616
99805
|
async function issueSession(user) {
|
|
99617
99806
|
await assertOrganizationNotSuspended(user?._id);
|
|
@@ -100991,6 +101180,9 @@ function useServiceProviderInviteController() {
|
|
|
100991
101180
|
wrongJoinPreview: _wrongJoinPreview,
|
|
100992
101181
|
repairWrongJoin: _repairWrongJoin,
|
|
100993
101182
|
undoWrongJoin: _undoWrongJoin,
|
|
101183
|
+
finishSetupPreview: _finishSetupPreview,
|
|
101184
|
+
finishSetupApply: _finishSetupApply,
|
|
101185
|
+
finishSetupUndo: _finishSetupUndo,
|
|
100994
101186
|
linkSite: _linkSite,
|
|
100995
101187
|
listReceived: _listReceived,
|
|
100996
101188
|
getForProvider: _getForProvider
|
|
@@ -101198,6 +101390,35 @@ function useServiceProviderInviteController() {
|
|
|
101198
101390
|
const wrongJoinPreview = wrongJoin("preview");
|
|
101199
101391
|
const wrongJoinRepair = wrongJoin("repair");
|
|
101200
101392
|
const wrongJoinUndo = wrongJoin("undo");
|
|
101393
|
+
function finishSetup(action) {
|
|
101394
|
+
return async (req, res, next) => {
|
|
101395
|
+
try {
|
|
101396
|
+
await requireConsolePermission(req, "sp-approvals", "approve-sp");
|
|
101397
|
+
const { error, value } = Joi149.object({
|
|
101398
|
+
companyName: Joi149.string().trim().max(200).optional().allow("", null),
|
|
101399
|
+
country: Joi149.string().trim().max(100).optional().allow("", null)
|
|
101400
|
+
}).validate(action === "preview" ? req.query ?? {} : req.body ?? {}, {
|
|
101401
|
+
stripUnknown: true
|
|
101402
|
+
});
|
|
101403
|
+
if (error)
|
|
101404
|
+
throw new BadRequestError247(`Invalid input: ${error.message}`);
|
|
101405
|
+
const args = {
|
|
101406
|
+
id: inviteId(req),
|
|
101407
|
+
userId: callerId5(req),
|
|
101408
|
+
companyName: value.companyName ?? "",
|
|
101409
|
+
country: value.country ?? ""
|
|
101410
|
+
};
|
|
101411
|
+
res.json(
|
|
101412
|
+
action === "preview" ? await _finishSetupPreview(args) : action === "apply" ? await _finishSetupApply(args) : await _finishSetupUndo(args)
|
|
101413
|
+
);
|
|
101414
|
+
} catch (error) {
|
|
101415
|
+
next(error);
|
|
101416
|
+
}
|
|
101417
|
+
};
|
|
101418
|
+
}
|
|
101419
|
+
const finishSetupPreview = finishSetup("preview");
|
|
101420
|
+
const finishSetupApply = finishSetup("apply");
|
|
101421
|
+
const finishSetupUndo = finishSetup("undo");
|
|
101201
101422
|
async function linkSite(req, res, next) {
|
|
101202
101423
|
try {
|
|
101203
101424
|
res.json(
|
|
@@ -101252,6 +101473,9 @@ function useServiceProviderInviteController() {
|
|
|
101252
101473
|
wrongJoinPreview,
|
|
101253
101474
|
wrongJoinRepair,
|
|
101254
101475
|
wrongJoinUndo,
|
|
101476
|
+
finishSetupPreview,
|
|
101477
|
+
finishSetupApply,
|
|
101478
|
+
finishSetupUndo,
|
|
101255
101479
|
linkSite,
|
|
101256
101480
|
received,
|
|
101257
101481
|
getOne
|
|
@@ -101986,7 +102210,7 @@ import {
|
|
|
101986
102210
|
InternalServerError as InternalServerError89,
|
|
101987
102211
|
useAtlas as useAtlas148,
|
|
101988
102212
|
logger as logger218,
|
|
101989
|
-
useCache as
|
|
102213
|
+
useCache as useCache75
|
|
101990
102214
|
} from "@7365admin1/node-server-utils";
|
|
101991
102215
|
function useRoleRepoV2() {
|
|
101992
102216
|
const db2 = useAtlas148.getDb();
|
|
@@ -102023,7 +102247,7 @@ function useRoleRepoV2() {
|
|
|
102023
102247
|
throw new InternalServerError89("Failed to create unique index on role.");
|
|
102024
102248
|
}
|
|
102025
102249
|
}
|
|
102026
|
-
const { delNamespace } =
|
|
102250
|
+
const { delNamespace } = useCache75(namespace_collection3);
|
|
102027
102251
|
async function addRole(value, session) {
|
|
102028
102252
|
value = new MRoleV2(value);
|
|
102029
102253
|
try {
|
|
@@ -104550,7 +104774,7 @@ function useChatPrelovedController() {
|
|
|
104550
104774
|
|
|
104551
104775
|
// src/events/chat-preloved.event.ts
|
|
104552
104776
|
import Joi165 from "joi";
|
|
104553
|
-
import { logger as logger225, useCache as
|
|
104777
|
+
import { logger as logger225, useCache as useCache76 } from "@7365admin1/node-server-utils";
|
|
104554
104778
|
function parseSid2(cookieHeader) {
|
|
104555
104779
|
const match = cookieHeader.match(/(?:^|;\s*)sid=([^;]*)/);
|
|
104556
104780
|
return match ? decodeURIComponent(match[1]) : null;
|
|
@@ -104594,7 +104818,7 @@ function chatPrelovedEvents(io) {
|
|
|
104594
104818
|
if (!sid) {
|
|
104595
104819
|
return next(new Error("Unauthorized"));
|
|
104596
104820
|
}
|
|
104597
|
-
const { getCache } =
|
|
104821
|
+
const { getCache } = useCache76("sessions");
|
|
104598
104822
|
const sessionData = await getCache(`sid:${sid}`);
|
|
104599
104823
|
if (!sessionData) {
|
|
104600
104824
|
return next(new Error("Session expired or invalid"));
|
|
@@ -105123,7 +105347,7 @@ import {
|
|
|
105123
105347
|
NotFoundError as NotFoundError96,
|
|
105124
105348
|
paginate as paginate72,
|
|
105125
105349
|
useAtlas as useAtlas161,
|
|
105126
|
-
useCache as
|
|
105350
|
+
useCache as useCache77
|
|
105127
105351
|
} from "@7365admin1/node-server-utils";
|
|
105128
105352
|
import { ObjectId as ObjectId199 } from "mongodb";
|
|
105129
105353
|
var online_forms_namespace_collection = "online-forms";
|
|
@@ -105133,7 +105357,7 @@ function useFormEntryRepo() {
|
|
|
105133
105357
|
throw new InternalServerError100("Unable to connect to server.");
|
|
105134
105358
|
}
|
|
105135
105359
|
const collection = db2.collection(online_forms_namespace_collection);
|
|
105136
|
-
const { delNamespace, getCache, setCache } =
|
|
105360
|
+
const { delNamespace, getCache, setCache } = useCache77(
|
|
105137
105361
|
online_forms_namespace_collection
|
|
105138
105362
|
);
|
|
105139
105363
|
const { getUserById } = useUserRepo();
|
|
@@ -108549,6 +108773,7 @@ export {
|
|
|
108549
108773
|
robotTypesVisibleTo,
|
|
108550
108774
|
rtspUrl,
|
|
108551
108775
|
safeTopic,
|
|
108776
|
+
sanitizeCompanyName,
|
|
108552
108777
|
scaleFromMeasurement,
|
|
108553
108778
|
schema,
|
|
108554
108779
|
schemaAppSlugNotification,
|