@7365admin1/core 3.101.0 → 3.102.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 +7 -0
- package/dist/index.d.ts +32 -4
- package/dist/index.js +469 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +577 -153
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/test/customer-site-list.test.mjs +106 -0
- package/test/customer-sites-one-row-per-site.test.mjs +7 -2
- package/test/e2e/customer-site-list.e2e.test.mjs +241 -0
- package/test/e2e/harness.mjs +2 -0
- package/test/e2e/service-provider-invite-approval.e2e.test.mjs +170 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@7365admin1/core",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.102.0",
|
|
5
5
|
"author": "7365admin1",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build": "tsup src/index.ts --format cjs,esm --dts && shx cp -r src/public dist && shx cp -r src/utils/handlebars dist",
|
|
14
14
|
"release": "yarn run build && changeset publish",
|
|
15
15
|
"lint": "tsc",
|
|
16
|
-
"test": "tsup src/config.ts src/utils/building-map.util.ts src/utils/robot-cloud.util.ts src/utils/robot-adapter.util.ts src/utils/png-encoder.util.ts src/services/demo.adapter.ts src/services/ounitech.adapter.ts src/services/open-rmf.adapter.ts src/utils/door-contract.util.ts src/utils/robot-fault.util.ts src/utils/robot-tracking.util.ts src/utils/robot-apps.util.ts src/utils/robot-permission.util.ts src/utils/robot-network.util.ts src/utils/lift-contract.util.ts src/models/robot-building-map.model.ts src/utils/anpr-revoke.util.ts src/utils/anpr-plate.util.ts src/utils/vehicle-request.util.ts src/utils/camera-view.util.ts src/utils/camera-bulk-import.util.ts src/utils/dashboard-metrics.util.ts src/utils/camera-capability.util.ts src/utils/camera-playback.util.ts src/services/camera-device-http.service.ts src/utils/camera-alert.util.ts src/utils/dahua-protocol.util.ts src/utils/site-name.util.ts src/utils/service-provider-invite.util.ts src/utils/notification-category.util.ts src/utils/notification-kind.util.ts src/models/notification.model.ts src/utils/hid-card.util.ts src/utils/hid-json.util.ts src/utils/hid-access.util.ts src/models/customer-site.model.ts src/models/site-camera.model.ts src/models/member.model.ts src/models/subscription.model.ts src/utils/session-id.util.ts src/utils/occurrence-query.util.ts src/utils/occurrence-book-create.util.ts src/utils/update-result.util.ts src/utils/hid-amico-authz.util.ts src/utils/promo-code-currency.util.ts src/utils/console-audit.util.ts src/utils/org-suspension.util.ts src/utils/session-revoke.util.ts src/models/hid-amico.model.ts src/models/patrol-email.model.ts src/utils/patrol-email-pdf.util.ts src/utils/visitor-status.util.ts src/utils/self-service-email.util.ts src/utils/hid-secret.util.ts src/models/visitor-invite.model.ts src/models/guard-invite.model.ts src/utils/site-timezone.util.ts src/utils/bulletin-service-apps.util.ts src/models/bulletin-board.model.ts src/utils/vehicle-import.util.ts src/utils/expired-vehicle-sweep.util.ts src/models/vehicle.model.ts src/controllers/chat.controller.ts src/utils/file-owner.util.ts src/utils/console-permission.util.ts src/utils/role-scope.util.ts src/utils/org-default-roles.util.ts src/utils/org-modules.util.ts src/utils/site-modules.util.ts src/utils/resident-app-modules.util.ts src/utils/resident-default-role.util.ts src/utils/invite-role-scope.util.ts src/models/personal-emergency-chain.model.ts src/utils/self-signup-files.util.ts src/models/person.model.ts src/utils/module-gate.util.ts src/utils/member-lookup.util.ts src/utils/notification-access.util.ts src/utils/module-access.util.ts src/services/module-gate.service.ts src/controllers/site.controller.ts src/controllers/organization.controller.ts src/controllers/member.controller.ts src/utils/org-owner-repair.util.ts src/utils/socket-session.util.ts src/utils/people-create-gate.util.ts src/utils/service-app-type.util.ts --format esm --out-dir test/.build --no-dts --silent && node --test test/*.test.mjs",
|
|
16
|
+
"test": "tsup src/config.ts src/utils/building-map.util.ts src/utils/robot-cloud.util.ts src/utils/robot-adapter.util.ts src/utils/png-encoder.util.ts src/services/demo.adapter.ts src/services/ounitech.adapter.ts src/services/open-rmf.adapter.ts src/utils/door-contract.util.ts src/utils/robot-fault.util.ts src/utils/robot-tracking.util.ts src/utils/robot-apps.util.ts src/utils/robot-permission.util.ts src/utils/robot-network.util.ts src/utils/lift-contract.util.ts src/models/robot-building-map.model.ts src/utils/anpr-revoke.util.ts src/utils/anpr-plate.util.ts src/utils/vehicle-request.util.ts src/utils/camera-view.util.ts src/utils/camera-bulk-import.util.ts src/utils/dashboard-metrics.util.ts src/utils/camera-capability.util.ts src/utils/camera-playback.util.ts src/services/camera-device-http.service.ts src/utils/camera-alert.util.ts src/utils/dahua-protocol.util.ts src/utils/site-name.util.ts src/utils/service-provider-invite.util.ts src/utils/notification-category.util.ts src/utils/notification-kind.util.ts src/models/notification.model.ts src/utils/hid-card.util.ts src/utils/hid-json.util.ts src/utils/hid-access.util.ts src/models/customer-site.model.ts src/models/site-camera.model.ts src/models/member.model.ts src/models/subscription.model.ts src/utils/session-id.util.ts src/utils/occurrence-query.util.ts src/utils/occurrence-book-create.util.ts src/utils/update-result.util.ts src/utils/hid-amico-authz.util.ts src/utils/promo-code-currency.util.ts src/utils/console-audit.util.ts src/utils/org-suspension.util.ts src/utils/session-revoke.util.ts src/models/hid-amico.model.ts src/models/patrol-email.model.ts src/utils/patrol-email-pdf.util.ts src/utils/visitor-status.util.ts src/utils/self-service-email.util.ts src/utils/hid-secret.util.ts src/models/visitor-invite.model.ts src/models/guard-invite.model.ts src/utils/site-timezone.util.ts src/utils/bulletin-service-apps.util.ts src/models/bulletin-board.model.ts src/utils/vehicle-import.util.ts src/utils/expired-vehicle-sweep.util.ts src/models/vehicle.model.ts src/controllers/chat.controller.ts src/utils/file-owner.util.ts src/utils/console-permission.util.ts src/utils/role-scope.util.ts src/utils/org-default-roles.util.ts src/utils/org-modules.util.ts src/utils/site-modules.util.ts src/utils/resident-app-modules.util.ts src/utils/resident-default-role.util.ts src/utils/invite-role-scope.util.ts src/models/personal-emergency-chain.model.ts src/utils/self-signup-files.util.ts src/models/person.model.ts src/utils/module-gate.util.ts src/utils/member-lookup.util.ts src/utils/notification-access.util.ts src/utils/module-access.util.ts src/services/module-gate.service.ts src/controllers/site.controller.ts src/controllers/organization.controller.ts src/controllers/member.controller.ts src/utils/org-owner-repair.util.ts src/utils/socket-session.util.ts src/utils/people-create-gate.util.ts src/utils/service-app-type.util.ts src/utils/customer-site-list.util.ts --format esm --out-dir test/.build --no-dts --silent && node --test test/*.test.mjs",
|
|
17
17
|
"test:camera": "yarn test",
|
|
18
18
|
"test:e2e": "yarn build && node --test --test-concurrency=1 --test-timeout=600000 \"test/e2e/*.test.mjs\""
|
|
19
19
|
},
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The Organization app's Sites list: whose site each row is, the search, and
|
|
3
|
+
* the invitation behind a served site. Pure helpers from
|
|
4
|
+
* `src/utils/customer-site-list.util.ts`, run for real (not source-sliced).
|
|
5
|
+
*/
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import assert from "node:assert/strict";
|
|
8
|
+
import {
|
|
9
|
+
escapeRegex,
|
|
10
|
+
relationshipMatch,
|
|
11
|
+
relationshipField,
|
|
12
|
+
searchMatch,
|
|
13
|
+
invitationFor,
|
|
14
|
+
} from "./.build/utils/customer-site-list.util.mjs";
|
|
15
|
+
|
|
16
|
+
const ORG = "69251ebf88a3a9a52eb53d2c";
|
|
17
|
+
const CLIENT = "6923d6664150ca6a69b9f2b2";
|
|
18
|
+
|
|
19
|
+
// A tiny evaluator for the only operators these filters use, so the tests
|
|
20
|
+
// check which ROWS match rather than the object's shape.
|
|
21
|
+
function matches(doc, filter) {
|
|
22
|
+
return Object.entries(filter).every(([key, cond]) => {
|
|
23
|
+
if (key === "$and") return cond.every((c) => matches(doc, c));
|
|
24
|
+
if (key === "$or") return cond.some((c) => matches(doc, c));
|
|
25
|
+
const v = key.split(".").reduce((o, k) => (o == null ? undefined : o[k]), doc);
|
|
26
|
+
if (cond && typeof cond === "object" && !Array.isArray(cond) && !(cond instanceof RegExp)) {
|
|
27
|
+
if ("$in" in cond) return cond.$in.some((x) => (x === null ? v == null : String(x) === String(v)));
|
|
28
|
+
if ("$nin" in cond) return !cond.$nin.some((x) => (x === null ? v == null : String(x) === String(v)));
|
|
29
|
+
if ("$regex" in cond) return new RegExp(cond.$regex, cond.$options).test(v ?? "");
|
|
30
|
+
}
|
|
31
|
+
return String(v) === String(cond);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const rows = [
|
|
36
|
+
{ name: "Own A", siteOrg: ORG },
|
|
37
|
+
{ name: "Legacy own (no siteOrg)" },
|
|
38
|
+
{ name: "Own, null siteOrg", siteOrg: null },
|
|
39
|
+
{ name: "Served by client", siteOrg: CLIENT },
|
|
40
|
+
{ name: "Served by other", siteOrg: "6a0000000000000000000001" },
|
|
41
|
+
];
|
|
42
|
+
const names = (f) => rows.filter((r) => matches(r, f)).map((r) => r.name);
|
|
43
|
+
|
|
44
|
+
test("all: no relationship filter adds nothing", () => {
|
|
45
|
+
assert.deepEqual(relationshipMatch(ORG, ""), {});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("own = siteOrg is this organisation, or absent", () => {
|
|
49
|
+
assert.deepEqual(names(relationshipMatch(ORG, "own")), [
|
|
50
|
+
"Own A",
|
|
51
|
+
"Legacy own (no siteOrg)",
|
|
52
|
+
"Own, null siteOrg",
|
|
53
|
+
]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("served (invited by another organisation) = siteOrg is someone else", () => {
|
|
57
|
+
assert.deepEqual(names(relationshipMatch(ORG, "served")), [
|
|
58
|
+
"Served by client",
|
|
59
|
+
"Served by other",
|
|
60
|
+
]);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test("client filter narrows to that owner and never matches the org itself", () => {
|
|
64
|
+
assert.deepEqual(names(relationshipMatch(ORG, "", CLIENT)), ["Served by client"]);
|
|
65
|
+
assert.deepEqual(names(relationshipMatch(ORG, "", ORG)), []);
|
|
66
|
+
// combined with "own" nothing can match - a client's site is not your own
|
|
67
|
+
assert.deepEqual(names(relationshipMatch(ORG, "own", CLIENT)), []);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("relationship field uses the same rule as the filter", () => {
|
|
71
|
+
const f = relationshipField(ORG).relationship.$cond;
|
|
72
|
+
assert.equal(f[1], "own");
|
|
73
|
+
assert.equal(f[2], "served");
|
|
74
|
+
assert.match(JSON.stringify(f[0]), new RegExp(ORG));
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test("search is literal (no regex injection) and covers name, client, address", () => {
|
|
78
|
+
assert.equal(escapeRegex("a.b*(c)"), String.raw`a\.b\*\(c\)`);
|
|
79
|
+
assert.equal(searchMatch(" "), null);
|
|
80
|
+
const f = searchMatch("(Wing");
|
|
81
|
+
const doc = (o) => ({ name: "x", siteOrgName: "", siteAddress: {}, ...o });
|
|
82
|
+
assert.ok(matches(doc({ siteOrgName: "(Wing Tai Holdings" }), f));
|
|
83
|
+
assert.ok(!matches(doc({ siteOrgName: "Wing Tai" }), f), "( is literal");
|
|
84
|
+
const g = searchMatch("orchard");
|
|
85
|
+
assert.ok(matches(doc({ siteAddress: { line1: "1 Orchard Rd" } }), g));
|
|
86
|
+
assert.ok(matches(doc({ siteAddress: { postalCode: "x", city: "ORCHARD" } }), g));
|
|
87
|
+
assert.ok(matches(doc({ name: "The Orchard Residences" }), g));
|
|
88
|
+
assert.ok(!matches(doc({ name: "Grange" }), g));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("invitationFor: newest accepted invitation for the site, with accept date", () => {
|
|
92
|
+
const invites = [
|
|
93
|
+
{ _id: "a", createdAt: "2026-01-01T00:00:00Z", metadata: { siteId: CLIENT, invitedByName: "Old" }, history: [{ action: "accepted", at: "2026-01-02T00:00:00Z" }] },
|
|
94
|
+
{ _id: "b", createdAt: "2026-09-24T06:53:25Z", metadata: { siteId: CLIENT, invitedByName: "Tommy" }, history: [{ action: "created" }, { action: "site-linked", at: "2026-09-24T12:29:16Z" }] },
|
|
95
|
+
{ _id: "c", createdAt: "2026-09-25T00:00:00Z", metadata: { siteId: "other", invitedByName: "X" } },
|
|
96
|
+
];
|
|
97
|
+
assert.deepEqual(invitationFor(CLIENT, invites), {
|
|
98
|
+
id: "b",
|
|
99
|
+
invitedByName: "Tommy",
|
|
100
|
+
invitedAt: "2026-09-24T06:53:25.000Z",
|
|
101
|
+
acceptedAt: "2026-09-24T12:29:16.000Z",
|
|
102
|
+
});
|
|
103
|
+
assert.equal(invitationFor("nothing", invites), null);
|
|
104
|
+
// no accepted line (legacy completion) -> acceptedAt null, nothing invented
|
|
105
|
+
assert.equal(invitationFor("other", invites).acceptedAt, null);
|
|
106
|
+
});
|
|
@@ -71,7 +71,9 @@ test("the search runs AFTER the rename, so a site is found by its real name", ()
|
|
|
71
71
|
*/
|
|
72
72
|
const body = getAllBody();
|
|
73
73
|
const rename = body.indexOf("$ifNull");
|
|
74
|
-
|
|
74
|
+
// The search (name, client, address) is built by `searchMatch` in
|
|
75
|
+
// customer-site-list.util and applied as a stage after the lookup.
|
|
76
|
+
const searchMatch = body.indexOf("$match: search_");
|
|
75
77
|
assert.notEqual(searchMatch, -1, "the search stage is gone");
|
|
76
78
|
assert.ok(rename < searchMatch, "the search still runs before the rename");
|
|
77
79
|
|
|
@@ -108,7 +110,10 @@ test("CONTROL: the org, status and site-scope match still runs FIRST", () => {
|
|
|
108
110
|
* the whole estate. It has to stay ahead of everything else in the pipeline.
|
|
109
111
|
*/
|
|
110
112
|
const body = getAllBody();
|
|
111
|
-
|
|
113
|
+
// `listMatch` is `query` plus the dropdown filters, spread in, so the
|
|
114
|
+
// caller scope in `query` can only be narrowed by them, never widened.
|
|
115
|
+
const firstMatch = body.indexOf("{ $match: listMatch }");
|
|
116
|
+
assert.match(body, /const listMatch = \{\s*\.\.\.query,/);
|
|
112
117
|
const group = body.indexOf('$group: { _id: "$site"');
|
|
113
118
|
assert.notEqual(firstMatch, -1, "the scoping match is gone");
|
|
114
119
|
assert.ok(firstMatch < group, "scoping no longer runs before grouping");
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// End-to-end: the Organization app's Sites list (`GET /api/customer-sites`)
|
|
2
|
+
// — search, the relationship / client / category filters, sorting by client,
|
|
3
|
+
// and the "invited by another organisation" information on served sites.
|
|
4
|
+
//
|
|
5
|
+
// A security agency has one site of its own and serves two sites owned by
|
|
6
|
+
// clients: one it joined through an invitation that recorded it as the
|
|
7
|
+
// accepting company, and one from before that was recorded (no inviter may be
|
|
8
|
+
// shown for it). A sibling company's invitation to the same legacy site must
|
|
9
|
+
// NOT be attached. The existing caller scope must still apply with filters.
|
|
10
|
+
//
|
|
11
|
+
// Everything runs against the throwaway in-process harness (MongoDB replica
|
|
12
|
+
// set, loopback Redis, mail sink). Nothing outside this process is touched.
|
|
13
|
+
//
|
|
14
|
+
// Run with: yarn test:e2e
|
|
15
|
+
|
|
16
|
+
import { after, before, describe, it } from "node:test";
|
|
17
|
+
import assert from "node:assert/strict";
|
|
18
|
+
import { ObjectId } from "mongodb";
|
|
19
|
+
|
|
20
|
+
import { startHarness } from "./harness.mjs";
|
|
21
|
+
|
|
22
|
+
const PASSWORD = "SiteList-Passw0rd!";
|
|
23
|
+
const ADMIN = "sl-admin@e2e.example.com"; // agency admin, org-wide
|
|
24
|
+
const GUARD = "sl-guard@e2e.example.com"; // agency guard pinned to the own site
|
|
25
|
+
const OUTSIDER = "sl-outsider@e2e.example.com"; // another org
|
|
26
|
+
|
|
27
|
+
describe("Sites list: search, filters, invited-by info", { concurrency: 1 }, () => {
|
|
28
|
+
let h;
|
|
29
|
+
const id = {};
|
|
30
|
+
const result = [];
|
|
31
|
+
let adminSid;
|
|
32
|
+
let guardSid;
|
|
33
|
+
let outsiderSid;
|
|
34
|
+
|
|
35
|
+
const record = (name, fn) =>
|
|
36
|
+
it(name, async () => {
|
|
37
|
+
try {
|
|
38
|
+
await fn();
|
|
39
|
+
result.push(["PASS", name]);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
result.push(["FAIL", name]);
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const list = (qs, sid = adminSid) =>
|
|
47
|
+
h.api(`/customer-sites?page=1&limit=10&status=active&org=${id.agency}${qs}`, { sid });
|
|
48
|
+
const names = (res) => res.body.items.map((i) => i.name);
|
|
49
|
+
|
|
50
|
+
before(async () => {
|
|
51
|
+
h = await startHarness();
|
|
52
|
+
Object.assign(id, await seed(h));
|
|
53
|
+
adminSid = await h.login(ADMIN, PASSWORD);
|
|
54
|
+
guardSid = await h.login(GUARD, PASSWORD);
|
|
55
|
+
outsiderSid = await h.login(OUTSIDER, PASSWORD);
|
|
56
|
+
}, { timeout: 300000 });
|
|
57
|
+
|
|
58
|
+
after(async () => {
|
|
59
|
+
if (h) await h.stop();
|
|
60
|
+
console.log("\n--- sites list: per-case result ---");
|
|
61
|
+
for (const [verdict, name] of result) console.log(`${verdict} ${name}`);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
record("1. no filters: every site once, each with its relationship", async () => {
|
|
65
|
+
const res = await list("&sort=name&order=asc");
|
|
66
|
+
assert.equal(res.status, 200, JSON.stringify(res.body));
|
|
67
|
+
assert.deepEqual(names(res), ["Harbour Tower", "LakeGarden", "Old Mill"]);
|
|
68
|
+
const by = Object.fromEntries(res.body.items.map((i) => [i.name, i]));
|
|
69
|
+
assert.equal(by["Harbour Tower"].relationship, "own");
|
|
70
|
+
assert.equal(by["LakeGarden"].relationship, "served");
|
|
71
|
+
assert.equal(by["Old Mill"].relationship, "served");
|
|
72
|
+
assert.equal(res.body.pageRange, "1-3 of 3");
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
record("2. address and category come from the SITE (the row has none)", async () => {
|
|
76
|
+
const res = await list("&sort=name&order=asc");
|
|
77
|
+
const lake = res.body.items.find((i) => i.name === "LakeGarden");
|
|
78
|
+
assert.equal(lake.siteAddress.line1, "8 Lake Road");
|
|
79
|
+
assert.equal(lake.siteCategory, "residential");
|
|
80
|
+
assert.equal(lake.address, undefined, "the row's own address is untouched");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
record("3. invited site carries WHO invited and WHEN; legacy one carries none", async () => {
|
|
84
|
+
const res = await list("&sort=name&order=asc");
|
|
85
|
+
const by = Object.fromEntries(res.body.items.map((i) => [i.name, i]));
|
|
86
|
+
assert.equal(by["LakeGarden"].invitation.invitedByName, "Tina Tan");
|
|
87
|
+
assert.equal(by["LakeGarden"].invitation.acceptedAt, "2026-09-20T02:00:00.000Z");
|
|
88
|
+
assert.equal(by["LakeGarden"].invitation.id, id.invite.toString());
|
|
89
|
+
// the sibling company's invitation to Old Mill must not be attached
|
|
90
|
+
assert.equal(by["Old Mill"].invitation, null);
|
|
91
|
+
assert.equal(by["Harbour Tower"].invitation, undefined);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
record("4. relationship=own / served", async () => {
|
|
95
|
+
assert.deepEqual(names(await list("&relationship=own")), ["Harbour Tower"]);
|
|
96
|
+
assert.deepEqual(
|
|
97
|
+
names(await list("&relationship=served&sort=name&order=asc")),
|
|
98
|
+
["LakeGarden", "Old Mill"],
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
record("5. client filter, and the client facet lists every client", async () => {
|
|
103
|
+
const res = await list(`&client=${id.wingTai}`);
|
|
104
|
+
assert.deepEqual(names(res), ["LakeGarden"]);
|
|
105
|
+
assert.deepEqual(
|
|
106
|
+
res.body.clients.map((c) => c.name),
|
|
107
|
+
["Old Mill Estates", "Wing Tai Test"],
|
|
108
|
+
"facet ignores the picked client",
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
record("6. category filter", async () => {
|
|
113
|
+
assert.deepEqual(names(await list("&category=commercial")), ["Harbour Tower"]);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
record("7. search by site name, client name and address; literal only", async () => {
|
|
117
|
+
assert.deepEqual(names(await list("&search=lakegar")), ["LakeGarden"]);
|
|
118
|
+
assert.deepEqual(names(await list("&search=wing%20tai")), ["LakeGarden"]);
|
|
119
|
+
assert.deepEqual(names(await list("&search=harbour%20rd")), ["Harbour Tower"]);
|
|
120
|
+
assert.deepEqual(names(await list("&search=.*")), [], "regex is literal");
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
record("8. sort by client", async () => {
|
|
124
|
+
const res = await list("&relationship=served&sort=siteOrgName&order=desc");
|
|
125
|
+
assert.deepEqual(names(res), ["LakeGarden", "Old Mill"]);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
record("9. status=deleted shows removed rows only", async () => {
|
|
129
|
+
const res = await h.api(
|
|
130
|
+
`/customer-sites?page=1&limit=10&status=deleted&org=${id.agency}`,
|
|
131
|
+
{ sid: adminSid },
|
|
132
|
+
);
|
|
133
|
+
assert.deepEqual(names(res), ["Gone Site"]);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
record("10. bad filter values are refused", async () => {
|
|
137
|
+
assert.equal((await list("&relationship=mine")).status, 400);
|
|
138
|
+
assert.equal((await list("&client=nothex")).status, 400);
|
|
139
|
+
assert.equal((await list("&category=spaceport")).status, 400);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
record("11. caller scope still applies: pinned guard sees only his site", async () => {
|
|
143
|
+
const res = await list("&relationship=served", guardSid);
|
|
144
|
+
assert.equal(res.status, 200);
|
|
145
|
+
assert.deepEqual(names(res), []);
|
|
146
|
+
assert.deepEqual(names(await list("", guardSid)), ["Harbour Tower"]);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
record("12. an outsider cannot list the agency's sites", async () => {
|
|
150
|
+
assert.equal((await list("&relationship=served", outsiderSid)).status, 401);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
record("13. CONTROL: a plain switcher call (no new params) is unchanged", async () => {
|
|
154
|
+
const res = await h.api(
|
|
155
|
+
`/customer-sites?page=1&search=&limit=10&sort=&order=asc&status=active&org=${id.agency}`,
|
|
156
|
+
{ sid: adminSid },
|
|
157
|
+
);
|
|
158
|
+
assert.equal(res.status, 200);
|
|
159
|
+
assert.equal(res.body.items.length, 3);
|
|
160
|
+
for (const item of res.body.items) assert.ok(item.site && item.name);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
async function seed(h) {
|
|
165
|
+
const now = new Date().toISOString();
|
|
166
|
+
const agency = new ObjectId();
|
|
167
|
+
const sibling = new ObjectId();
|
|
168
|
+
const wingTai = new ObjectId();
|
|
169
|
+
const oldMill = new ObjectId();
|
|
170
|
+
const outsiderOrg = new ObjectId();
|
|
171
|
+
const siteOwn = new ObjectId();
|
|
172
|
+
const siteLake = new ObjectId();
|
|
173
|
+
const siteMill = new ObjectId();
|
|
174
|
+
const siteGone = new ObjectId();
|
|
175
|
+
const role = new ObjectId();
|
|
176
|
+
const outsiderRole = new ObjectId();
|
|
177
|
+
const guardRole = new ObjectId();
|
|
178
|
+
const invite = new ObjectId();
|
|
179
|
+
|
|
180
|
+
await h.db.collection("organizations").insertMany([
|
|
181
|
+
{ _id: agency, name: "SL Agency", email: "sl-agency@e2e.example.com", type: "org", nature: "security_agency", status: "active", createdAt: now },
|
|
182
|
+
{ _id: sibling, name: "SL Sibling", email: "sl-agency@e2e.example.com", type: "org", nature: "security_agency", status: "active", createdAt: now },
|
|
183
|
+
{ _id: wingTai, name: "Wing Tai Test", email: "sl-wt@e2e.example.com", type: "org", nature: "property_management_agency", status: "active", createdAt: now },
|
|
184
|
+
{ _id: oldMill, name: "Old Mill Estates", email: "sl-om@e2e.example.com", type: "org", nature: "property_management_agency", status: "active", createdAt: now },
|
|
185
|
+
{ _id: outsiderOrg, name: "SL Outsider", email: "sl-out@e2e.example.com", type: "org", nature: "security_agency", status: "active", createdAt: now },
|
|
186
|
+
]);
|
|
187
|
+
|
|
188
|
+
await h.db.collection("sites").insertMany([
|
|
189
|
+
{ _id: siteOwn, name: "Harbour Tower", orgId: agency, status: "active", category: "commercial", address: { line1: "1 Harbour Rd", city: "Singapore" } },
|
|
190
|
+
{ _id: siteLake, name: "LakeGarden", orgId: wingTai, status: "active", category: "residential", address: { line1: "8 Lake Road", postalCode: "648000" } },
|
|
191
|
+
{ _id: siteMill, name: "Old Mill", orgId: oldMill, status: "active" },
|
|
192
|
+
{ _id: siteGone, name: "Gone Site", orgId: agency, status: "active" },
|
|
193
|
+
]);
|
|
194
|
+
|
|
195
|
+
await h.db.collection("customer.sites").insertMany([
|
|
196
|
+
{ name: "Harbour Tower", org: agency, siteOrg: agency, siteOrgName: "SL Agency", site: siteOwn, status: "active", createdAt: new Date("2026-01-01") },
|
|
197
|
+
// written by accepting the invitation: no address / category on the row
|
|
198
|
+
{ name: "LakeGarden", org: agency, siteOrg: wingTai, siteOrgName: "Wing Tai Test", site: siteLake, status: "active", createdAt: new Date("2026-09-20") },
|
|
199
|
+
// legacy: joined before the accepting company was recorded
|
|
200
|
+
{ name: "Old Mill", org: agency, siteOrg: oldMill, siteOrgName: "Old Mill Estates", site: siteMill, status: "active", createdAt: new Date("2025-11-25") },
|
|
201
|
+
{ name: "Gone Site", org: agency, siteOrg: agency, siteOrgName: "SL Agency", site: siteGone, status: "deleted", createdAt: new Date("2025-01-01") },
|
|
202
|
+
]);
|
|
203
|
+
|
|
204
|
+
await h.db.collection("verifications").insertMany([
|
|
205
|
+
{
|
|
206
|
+
_id: invite, type: "service-provider-invite", email: "sl-agency@e2e.example.com", status: "complete",
|
|
207
|
+
createdAt: new Date("2026-09-19T01:00:00Z"),
|
|
208
|
+
metadata: { siteId: siteLake, org: wingTai, invitedByName: "Tina Tan", providerOrg: agency.toString() },
|
|
209
|
+
history: [{ action: "created" }, { action: "accepted", at: "2026-09-20T02:00:00.000Z" }],
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
// the SIBLING company accepted an invitation to Old Mill: not ours
|
|
213
|
+
type: "service-provider-invite", email: "sl-agency@e2e.example.com", status: "complete",
|
|
214
|
+
createdAt: new Date("2025-11-24T01:00:00Z"),
|
|
215
|
+
metadata: { siteId: siteMill, org: oldMill, invitedByName: "Someone", providerOrg: sibling.toString() },
|
|
216
|
+
history: [{ action: "accepted", at: "2025-11-25T00:00:00.000Z" }],
|
|
217
|
+
},
|
|
218
|
+
]);
|
|
219
|
+
|
|
220
|
+
await h.db.collection("roles").insertMany([
|
|
221
|
+
{ _id: role, name: "Agency Admin", org: agency, type: "organization", permissions: ["*"], status: "active" },
|
|
222
|
+
{ _id: guardRole, name: "Guard", org: agency, type: "security_agency", permissions: ["*"], status: "active" },
|
|
223
|
+
{ _id: outsiderRole, name: "Outsider Admin", org: outsiderOrg, type: "organization", permissions: ["*"], status: "active" },
|
|
224
|
+
]);
|
|
225
|
+
|
|
226
|
+
const emails = [ADMIN, GUARD, OUTSIDER];
|
|
227
|
+
const users = await h.db.collection("users").insertMany(
|
|
228
|
+
emails.map((email) => ({ email, name: email.split("@")[0], status: "active", createdAt: now })),
|
|
229
|
+
);
|
|
230
|
+
const hashed = await h.hashPassword(PASSWORD);
|
|
231
|
+
await h.db.collection("users").updateMany({ email: { $in: emails } }, { $set: { password: hashed } });
|
|
232
|
+
const [admin, guard, outsider] = [0, 1, 2].map((i) => users.insertedIds[i]);
|
|
233
|
+
|
|
234
|
+
await h.db.collection("members").insertMany([
|
|
235
|
+
{ user: admin, org: agency, type: "organization", role, status: "active" },
|
|
236
|
+
{ user: guard, org: agency, siteId: siteOwn, type: "security_agency", role: guardRole, status: "active" },
|
|
237
|
+
{ user: outsider, org: outsiderOrg, type: "organization", role: outsiderRole, status: "active" },
|
|
238
|
+
]);
|
|
239
|
+
|
|
240
|
+
return { agency, wingTai, oldMill, invite };
|
|
241
|
+
}
|
package/test/e2e/harness.mjs
CHANGED
|
@@ -522,10 +522,12 @@ function buildApp(nsu, core) {
|
|
|
522
522
|
getServiceProviderById,
|
|
523
523
|
updateStatusById,
|
|
524
524
|
createServiceProvider,
|
|
525
|
+
getServiceProviders,
|
|
525
526
|
} = core.useServiceProviderController();
|
|
526
527
|
|
|
527
528
|
serviceProviders.post("/id/:id", requireAuth, createServiceProvider);
|
|
528
529
|
|
|
530
|
+
serviceProviders.get("/", requireAuth, getServiceProviders);
|
|
529
531
|
serviceProviders.get("/:id", requireAuth, getServiceProviderById);
|
|
530
532
|
serviceProviders.patch("/:id/status", requireAuth, updateStatusById);
|
|
531
533
|
serviceProviders.post("/invite", requireAuth, createServiceProviderInvite);
|
|
@@ -1210,6 +1210,175 @@ describe("service-provider invitation approval, end to end", { concurrency: 1 },
|
|
|
1210
1210
|
assert.equal(await h.db.collection("customer.sites").countDocuments({ site: id.siteR }), 0);
|
|
1211
1211
|
});
|
|
1212
1212
|
|
|
1213
|
+
// --- The inviter's view (owner report 2026-09-24: "Company name -") -------
|
|
1214
|
+
|
|
1215
|
+
const ALL = "awaiting-approval,pending,complete,rejected,declined,cancelled,expired";
|
|
1216
|
+
const sent = (sid, site) =>
|
|
1217
|
+
h.api(
|
|
1218
|
+
`/service-provider-invitations?org=${id.pmOrg.toString()}&siteId=${site.toString()}&status=${ALL}&page=1&limit=20`,
|
|
1219
|
+
{ sid },
|
|
1220
|
+
);
|
|
1221
|
+
const siteProviders = (sid, site, extra = "") =>
|
|
1222
|
+
h.api(`/service-providers?siteId=${site.toString()}&status=active&include=engagements&page=1${extra || "&limit=20"}`, { sid });
|
|
1223
|
+
|
|
1224
|
+
it("35. Invitations tab: an accepted invitation names the company, who sent it, when, and how to reach them", async () => {
|
|
1225
|
+
// Accepted through PUT /:id/accept (test 24).
|
|
1226
|
+
const h1 = await sent(pmSid, id.siteH);
|
|
1227
|
+
assert.equal(h1.status, 200, JSON.stringify(h1.body));
|
|
1228
|
+
assert.ok(h1.body.items.length >= 1);
|
|
1229
|
+
assert.ok(
|
|
1230
|
+
h1.body.items.every((i) => String(i.metadata?.siteId) === id.siteH.toString()),
|
|
1231
|
+
"only the site on screen",
|
|
1232
|
+
);
|
|
1233
|
+
const accepted = h1.body.items.find((i) => i._id === invitations.h);
|
|
1234
|
+
assert.equal(accepted.companyName, "Sentry Security Services");
|
|
1235
|
+
assert.equal(accepted.metadata.name, "Sentry Security Services", "older apps read metadata.name");
|
|
1236
|
+
assert.equal(accepted.providerOrgId, id.providerOrg.toString());
|
|
1237
|
+
assert.equal(accepted.viewStatus, "complete");
|
|
1238
|
+
assert.equal(accepted.statusLabel, "Accepted");
|
|
1239
|
+
assert.equal(accepted.invitedByName, "Pat Manager");
|
|
1240
|
+
assert.ok(accepted.invitedAt, "invited on");
|
|
1241
|
+
assert.ok(accepted.answeredAt, "accepted on");
|
|
1242
|
+
assert.equal(accepted.contactEmail, PROVIDER_EMAIL);
|
|
1243
|
+
assert.equal(accepted.onSite, true);
|
|
1244
|
+
assert.equal(accepted.service, "security");
|
|
1245
|
+
|
|
1246
|
+
// Accepted FOR the provider's second company (test 28): that company.
|
|
1247
|
+
const l = (await sent(pmSid, id.siteL)).body.items[0];
|
|
1248
|
+
assert.equal(l.companyName, "Sentry Patrol Pte Ltd");
|
|
1249
|
+
assert.equal(l.onSite, true);
|
|
1250
|
+
|
|
1251
|
+
// Repaired through link-site, then removed by the client (test 32).
|
|
1252
|
+
const o = (await sent(pmSid, id.siteO)).body.items.find((i) => i._id === stuck.o);
|
|
1253
|
+
assert.equal(o.companyName, "Sentry Security Services");
|
|
1254
|
+
assert.equal(o.onSite, false, "no longer on the site once the client removed it");
|
|
1255
|
+
assert.ok(o.answeredAt, "the repair counts as the answer");
|
|
1256
|
+
});
|
|
1257
|
+
|
|
1258
|
+
it("36. Invitations tab: open, lapsed and declined invitations read in plain words and guess no company", async () => {
|
|
1259
|
+
const lapsed = (await sent(pmSid, id.siteI)).body.items[0];
|
|
1260
|
+
assert.equal(lapsed.status, "pending", "the stored status is kept for the row's actions");
|
|
1261
|
+
assert.equal(lapsed.viewStatus, "expired");
|
|
1262
|
+
assert.equal(lapsed.statusLabel, "Expired");
|
|
1263
|
+
assert.equal(lapsed.answeredAt, lapsed.expireAt, "expired on");
|
|
1264
|
+
assert.equal(lapsed.companyName, "", "never guessed from a shared email while unanswered");
|
|
1265
|
+
assert.equal(lapsed.contactEmail, "", "no contact details before it is accepted");
|
|
1266
|
+
|
|
1267
|
+
const declined = (await sent(pmSid, id.siteJ)).body.items[0];
|
|
1268
|
+
assert.equal(declined.viewStatus, "declined");
|
|
1269
|
+
assert.ok(declined.answeredAt, "declined on");
|
|
1270
|
+
assert.equal(declined.contactEmail, "");
|
|
1271
|
+
assert.equal(declined.onSite, false);
|
|
1272
|
+
|
|
1273
|
+
// Waiting for the provider: not answered, no company, no contact.
|
|
1274
|
+
const siteS = new ObjectId();
|
|
1275
|
+
await h.db.collection("sites").insertOne({ _id: siteS, name: "Sorrel Walk", org: id.pmOrg.toString(), orgId: id.pmOrg, status: "active" });
|
|
1276
|
+
const waiting = await sendAndApprove(siteS, "Sorrel Walk");
|
|
1277
|
+
const sorrel = (await sent(pmSid, siteS)).body.items.find((i) => i._id === waiting);
|
|
1278
|
+
assert.equal(sorrel.viewStatus, "pending");
|
|
1279
|
+
assert.equal(sorrel.statusLabel, "Waiting for the provider");
|
|
1280
|
+
assert.equal(sorrel.answeredAt, null);
|
|
1281
|
+
assert.equal(sorrel.companyName, "");
|
|
1282
|
+
assert.equal(sorrel.contactEmail, "");
|
|
1283
|
+
assert.equal(sorrel.invitedByName, "Pat Manager");
|
|
1284
|
+
});
|
|
1285
|
+
|
|
1286
|
+
it("37. Service Providers tab: an accepted provider is listed with its company, contact and staff on this site", async () => {
|
|
1287
|
+
// Two of the provider's people pinned to Harbour View, one elsewhere.
|
|
1288
|
+
await h.db.collection("members").insertMany([
|
|
1289
|
+
{ user: new ObjectId(), name: "G1", role: new ObjectId(), type: "security_agency", org: id.providerOrg, siteId: id.siteH, status: "active" },
|
|
1290
|
+
{ user: new ObjectId(), name: "G2", role: new ObjectId(), type: "security_agency", org: id.providerOrg, siteId: id.siteH, status: "active" },
|
|
1291
|
+
{ user: new ObjectId(), name: "G3", role: new ObjectId(), type: "security_agency", org: id.providerOrg, siteId: id.siteL, status: "active" },
|
|
1292
|
+
]);
|
|
1293
|
+
|
|
1294
|
+
const res = await siteProviders(pmSid, id.siteH);
|
|
1295
|
+
assert.equal(res.status, 200, JSON.stringify(res.body));
|
|
1296
|
+
const sentry = res.body.items.find((i) => String(i.serviceProviderOrgId) === id.providerOrg.toString());
|
|
1297
|
+
assert.ok(sentry, "accepted via PUT /:id/accept, listed with no service-providers row");
|
|
1298
|
+
assert.equal(sentry.name, "Sentry Security Services");
|
|
1299
|
+
assert.equal(sentry.email, PROVIDER_EMAIL);
|
|
1300
|
+
assert.equal(sentry.source, "engagement");
|
|
1301
|
+
assert.equal(sentry.members, 2, "staff assigned to THIS site, not the whole company");
|
|
1302
|
+
assert.match(res.body.pageRange, /of 1$/);
|
|
1303
|
+
|
|
1304
|
+
// Without the opt-in the stored rows only (the MA app's picker stores ids).
|
|
1305
|
+
const plain = await h.api(`/service-providers?siteId=${id.siteH.toString()}&status=active&page=1&limit=20`, { sid: pmSid });
|
|
1306
|
+
assert.equal(plain.status, 200, JSON.stringify(plain.body));
|
|
1307
|
+
assert.equal(plain.body.items.length, 0);
|
|
1308
|
+
|
|
1309
|
+
// Accepted FOR the second company: that company.
|
|
1310
|
+
const l = await siteProviders(pmSid, id.siteL);
|
|
1311
|
+
assert.deepEqual(l.body.items.map((i) => i.name), ["Sentry Patrol Pte Ltd"]);
|
|
1312
|
+
|
|
1313
|
+
// Removed by the client (test 32): gone.
|
|
1314
|
+
const o = await siteProviders(pmSid, id.siteO);
|
|
1315
|
+
assert.equal(o.body.items.length, 0);
|
|
1316
|
+
|
|
1317
|
+
// Listing wrote nothing.
|
|
1318
|
+
assert.equal(await h.db.collection("site.service-providers").countDocuments({ siteId: id.siteH }), 0);
|
|
1319
|
+
});
|
|
1320
|
+
|
|
1321
|
+
it("38. Service Providers tab: a stored row is not listed twice, and paging spans both kinds", async () => {
|
|
1322
|
+
// A row the old path wrote for the same provider on Lakeside Gardens.
|
|
1323
|
+
await h.db.collection("site.service-providers").insertOne({
|
|
1324
|
+
name: "Sentry Patrol (old row)",
|
|
1325
|
+
orgId: id.pmOrg,
|
|
1326
|
+
siteId: id.siteL,
|
|
1327
|
+
serviceProviderOrgId: id.twinOrg,
|
|
1328
|
+
email: PROVIDER_EMAIL,
|
|
1329
|
+
type: "security_agency",
|
|
1330
|
+
category: "external",
|
|
1331
|
+
status: "active",
|
|
1332
|
+
createdAt: new Date().toISOString(),
|
|
1333
|
+
});
|
|
1334
|
+
const l = await siteProviders(pmSid, id.siteL);
|
|
1335
|
+
assert.equal(l.body.items.length, 1, "one row per provider");
|
|
1336
|
+
assert.equal(l.body.items[0].name, "Sentry Patrol (old row)");
|
|
1337
|
+
|
|
1338
|
+
// A different stored provider on Harbour View: one engaged + one stored.
|
|
1339
|
+
await h.db.collection("site.service-providers").insertOne({
|
|
1340
|
+
name: "Sparkle Cleaning",
|
|
1341
|
+
orgId: id.pmOrg,
|
|
1342
|
+
siteId: id.siteH,
|
|
1343
|
+
serviceProviderOrgId: new ObjectId(),
|
|
1344
|
+
email: "sparkle@e2e.example.com",
|
|
1345
|
+
type: "cleaning_services",
|
|
1346
|
+
category: "external",
|
|
1347
|
+
status: "active",
|
|
1348
|
+
createdAt: new Date().toISOString(),
|
|
1349
|
+
});
|
|
1350
|
+
const p1 = await siteProviders(pmSid, id.siteH, "&limit=1");
|
|
1351
|
+
const p2 = await h.api(`/service-providers?siteId=${id.siteH.toString()}&status=active&include=engagements&page=2&limit=1`, { sid: pmSid });
|
|
1352
|
+
assert.equal(p1.body.pages, 2, JSON.stringify(p1.body));
|
|
1353
|
+
assert.equal(p1.body.items[0].name, "Sentry Security Services");
|
|
1354
|
+
assert.equal(p2.body.items[0].name, "Sparkle Cleaning");
|
|
1355
|
+
assert.match(p2.body.pageRange, /2-2 of 2/);
|
|
1356
|
+
const searched = await siteProviders(pmSid, id.siteH, "&limit=20&search=Sentry");
|
|
1357
|
+
assert.deepEqual(searched.body.items.map((i) => i.name), ["Sentry Security Services"]);
|
|
1358
|
+
});
|
|
1359
|
+
|
|
1360
|
+
it("39. authorisation: only the inviting organisation reads these lists", async () => {
|
|
1361
|
+
assert.equal((await sent(undefined, id.siteH)).status, 401, "no session");
|
|
1362
|
+
assert.equal((await siteProviders(undefined, id.siteH)).status, 401, "no session");
|
|
1363
|
+
const theirs = await sent(outsiderSid, id.siteH);
|
|
1364
|
+
assert.ok([401, 404].includes(theirs.status), `another organisation's invitations: ${theirs.status}`);
|
|
1365
|
+
assert.ok(!JSON.stringify(theirs.body).includes("Sentry"));
|
|
1366
|
+
// A site the caller cannot reach answers like one that does not exist.
|
|
1367
|
+
const foreign = await siteProviders(outsiderSid, id.siteH);
|
|
1368
|
+
assert.ok([401, 404].includes(foreign.status), `another client's site: ${foreign.status}`);
|
|
1369
|
+
assert.ok(!JSON.stringify(foreign.body).includes("Sentry"));
|
|
1370
|
+
|
|
1371
|
+
// The engaged provider reaches the site, but is not shown the client's
|
|
1372
|
+
// other contractors.
|
|
1373
|
+
const asProvider = await siteProviders(providerSid, id.siteH);
|
|
1374
|
+
assert.equal(asProvider.status, 200, JSON.stringify(asProvider.body));
|
|
1375
|
+
assert.ok(asProvider.body.items.every((i) => i.source !== "engagement"));
|
|
1376
|
+
assert.equal(
|
|
1377
|
+
(await h.api(`/service-provider-invitations?org=${id.pmOrg.toString()}&siteId=bad`, { sid: pmSid })).status,
|
|
1378
|
+
400,
|
|
1379
|
+
);
|
|
1380
|
+
});
|
|
1381
|
+
|
|
1213
1382
|
it("reports the exact wording the API returned", () => {
|
|
1214
1383
|
console.log("\n--- verbatim API messages ---");
|
|
1215
1384
|
for (const [k, v] of Object.entries(said)) console.log(`${k}: ${v}`);
|
|
@@ -1321,6 +1490,7 @@ async function seed(h) {
|
|
|
1321
1490
|
_id,
|
|
1322
1491
|
name,
|
|
1323
1492
|
org: pmOrg.toString(),
|
|
1493
|
+
orgId: pmOrg,
|
|
1324
1494
|
status: "active",
|
|
1325
1495
|
createdAt: now,
|
|
1326
1496
|
})),
|