@7365admin1/core 3.99.1-staging.373 → 3.99.1-staging.374

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.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@7365admin1/core": minor
3
+ ---
4
+
5
+ Service providers, inviter's view: `GET /service-providers?siteId=&include=engagements` also lists providers on the site through an accepted invitation (read from `customer.sites`, nothing written), and now requires the caller to reach the site. Staff counts are the provider's people assigned to that site. `GET /service-provider-invitations` takes `siteId` and returns each row with the accepting company, who invited and when, when it was answered, contact details once accepted, and whether the provider is still on the site.
package/dist/index.d.ts CHANGED
@@ -2821,6 +2821,11 @@ declare function useServiceProviderRepo(): {
2821
2821
  serviceProviderOrgId?: string | ObjectId | undefined;
2822
2822
  }) => Promise<{}>;
2823
2823
  updateStatusById: (_id: string | ObjectId, status: string) => Promise<mongodb.UpdateResult<bson.Document>>;
2824
+ getEngagedProvidersBySite: (site: string | ObjectId) => Promise<bson.Document[]>;
2825
+ getSiteProviderKeys: (site: string | ObjectId) => Promise<{
2826
+ orgIds: Set<any>;
2827
+ emails: Set<string>;
2828
+ }>;
2824
2829
  };
2825
2830
 
2826
2831
  declare function useServiceProviderController(): {
@@ -14988,10 +14993,12 @@ declare function useVerificationRepoV2(): {
14988
14993
  where?: Record<string, any> | undefined;
14989
14994
  session?: ClientSession | undefined;
14990
14995
  }) => Promise<any>;
14991
- getServiceProviderInvites: ({ statuses, orgIds, email, search, includeDeleted, page, limit, }: {
14996
+ getServiceProviderInvites: ({ statuses, orgIds, email, siteId, search, includeDeleted, page, limit, }: {
14992
14997
  statuses?: string[] | undefined;
14993
14998
  orgIds?: string[] | undefined;
14994
14999
  email?: string | undefined;
15000
+ /** One site's invitations; the id is matched in both stored forms. */
15001
+ siteId?: string | undefined;
14995
15002
  search?: string | undefined;
14996
15003
  includeDeleted?: boolean | undefined;
14997
15004
  page?: number | undefined;
@@ -15275,20 +15282,35 @@ declare function useServiceProviderInviteController(): {
15275
15282
  };
15276
15283
 
15277
15284
  declare function useServiceProviderInviteService(): {
15278
- listForCaller: ({ userId, orgId, statuses, search, page, limit, }: {
15285
+ listForCaller: ({ userId, orgId, siteId, statuses, search, page, limit, }: {
15279
15286
  userId?: string | undefined;
15280
15287
  orgId?: string | undefined;
15288
+ /** The site on screen: only its invitations. */
15289
+ siteId?: string | undefined;
15281
15290
  statuses?: string[] | undefined;
15282
15291
  search?: string | undefined;
15283
15292
  page?: number | undefined;
15284
15293
  limit?: number | undefined;
15285
15294
  }) => Promise<{
15286
15295
  items: {
15296
+ metadata: {
15297
+ name: string;
15298
+ };
15299
+ viewStatus: string;
15287
15300
  statusLabel: string;
15301
+ companyName: string;
15302
+ providerOrgId: any;
15303
+ service: string;
15304
+ siteName: string;
15305
+ invitedByName: string;
15306
+ invitedAt: string;
15307
+ answeredAt: any;
15308
+ contactEmail: string;
15309
+ contactPhone: string;
15310
+ onSite: boolean;
15288
15311
  _id?: ObjectId | undefined;
15289
15312
  type: string;
15290
15313
  email: string;
15291
- metadata?: TVerificationMetadataV2 | undefined;
15292
15314
  status?: string | undefined;
15293
15315
  createdAt: string;
15294
15316
  updatedAt?: string | null | undefined;
package/dist/index.js CHANGED
@@ -8397,6 +8397,7 @@ function useVerificationRepoV2() {
8397
8397
  statuses = [],
8398
8398
  orgIds,
8399
8399
  email = "",
8400
+ siteId = "",
8400
8401
  search = "",
8401
8402
  includeDeleted = false,
8402
8403
  page = 1,
@@ -8415,6 +8416,12 @@ function useVerificationRepoV2() {
8415
8416
  query2.status = { $in: statuses };
8416
8417
  if (email)
8417
8418
  query2.email = email.trim().toLowerCase();
8419
+ if (siteId) {
8420
+ const ids2 = [siteId];
8421
+ if (import_mongodb22.ObjectId.isValid(siteId))
8422
+ ids2.push(new import_mongodb22.ObjectId(siteId));
8423
+ query2["metadata.siteId"] = { $in: ids2 };
8424
+ }
8418
8425
  if (!includeDeleted)
8419
8426
  query2.deletedAt = null;
8420
8427
  if (search.trim()) {
@@ -13733,6 +13740,7 @@ function useServiceProviderInviteService() {
13733
13740
  async function listForCaller({
13734
13741
  userId,
13735
13742
  orgId,
13743
+ siteId,
13736
13744
  statuses,
13737
13745
  search = "",
13738
13746
  page = 1,
@@ -13753,16 +13761,85 @@ function useServiceProviderInviteService() {
13753
13761
  // A super admin asking for everything passes no scope; everyone else is
13754
13762
  // pinned to their own organisations even if they ask for more.
13755
13763
  orgIds: staffMayBypass(actor) && !orgId ? void 0 : scope,
13764
+ siteId: siteId || void 0,
13756
13765
  search,
13757
13766
  page,
13758
13767
  limit
13759
13768
  });
13769
+ const names = /* @__PURE__ */ new Map();
13770
+ const items = await Promise.all(
13771
+ (data.items ?? []).map(
13772
+ (invite) => sentRow(invite, names)
13773
+ )
13774
+ );
13775
+ return { ...data, items };
13776
+ }
13777
+ async function sentRow(invite, names) {
13778
+ const metadata = invite.metadata ?? {};
13779
+ const status = serviceProviderInviteViewStatus(invite);
13780
+ const accepted = status === "complete" /* COMPLETE */ && !invite.deletedAt;
13781
+ const siteId = metadata.siteId?.toString?.() ?? "";
13782
+ const history = invite.history ?? [];
13783
+ const answer = [...history].reverse().find(
13784
+ (h) => ["accepted", "site-linked", "declined", "cancelled", "rejected"].includes(h?.action)
13785
+ );
13786
+ let providerOrgId = metadata.providerOrg?.toString?.() ?? "";
13787
+ let providerOrgName = String(metadata.providerOrgName ?? "");
13788
+ if (accepted && !providerOrgId) {
13789
+ const byEmail = await getOrgByEmail(
13790
+ String(invite.email ?? "").trim().toLowerCase()
13791
+ ).catch(() => null);
13792
+ providerOrgId = byEmail?._id?.toString?.() ?? "";
13793
+ providerOrgName = byEmail?.name ?? "";
13794
+ }
13795
+ let contactEmail = "";
13796
+ let contactPhone = "";
13797
+ let onSite = false;
13798
+ if (accepted && providerOrgId) {
13799
+ const [org, links] = await Promise.all([
13800
+ getOrgById(providerOrgId).catch(() => null),
13801
+ siteId ? useCustomerSiteRepo().countActiveByOrgAndSite(providerOrgId, siteId).catch(() => 0) : Promise.resolve(0)
13802
+ ]);
13803
+ providerOrgName = providerOrgName || org?.name || "";
13804
+ contactEmail = String(org?.email ?? "");
13805
+ contactPhone = String(org?.contact ?? "");
13806
+ onSite = links > 0;
13807
+ }
13808
+ const invitedBy = metadata.invitedBy?.toString?.() ?? "";
13809
+ let invitedByName = String(metadata.invitedByName ?? "");
13810
+ if (!invitedByName && invitedBy) {
13811
+ if (!names.has(invitedBy)) {
13812
+ names.set(
13813
+ invitedBy,
13814
+ getUserById(invitedBy).then((u) => String(u?.name ?? "")).catch(() => "")
13815
+ );
13816
+ }
13817
+ invitedByName = await names.get(invitedBy);
13818
+ }
13819
+ const companyName = providerOrgName || String(metadata.name ?? "");
13760
13820
  return {
13761
- ...data,
13762
- items: (data.items ?? []).map((invite) => ({
13763
- ...invite,
13764
- statusLabel: serviceProviderInviteLabel(invite.status)
13765
- }))
13821
+ ...invite,
13822
+ // Apps still on an older layer-common read the company from
13823
+ // `metadata.name` (set only on sign-up invitations). Filled in the reply
13824
+ // only - nothing is written. ponytail: drop once every app's pin reads
13825
+ // `companyName`.
13826
+ metadata: { ...metadata, name: companyName },
13827
+ // `status` stays the stored value (it decides which actions a row
13828
+ // offers); `viewStatus` reads a lapsed "pending" as "expired".
13829
+ viewStatus: status,
13830
+ statusLabel: serviceProviderInviteLabel(status),
13831
+ // The company the invitation is for: the one that accepted it, else the
13832
+ // new company's name the sender typed (a sign-up invitation).
13833
+ companyName,
13834
+ providerOrgId,
13835
+ service: String(metadata.app ?? ""),
13836
+ siteName: String(metadata.siteName ?? ""),
13837
+ invitedByName,
13838
+ invitedAt: invite.createdAt ?? null,
13839
+ answeredAt: status === "expired" ? invite.expireAt ?? null : status === "pending" || status === "awaiting-approval" /* AWAITING_APPROVAL */ ? null : answer?.at ?? invite.updatedAt ?? null,
13840
+ contactEmail,
13841
+ contactPhone,
13842
+ onSite
13766
13843
  };
13767
13844
  }
13768
13845
  async function approvalCount({ userId }) {
@@ -33112,7 +33189,7 @@ function useServiceProviderRepo() {
33112
33189
  throw new import_node_server_utils97.BadRequestError("Invalid site ID format.");
33113
33190
  }
33114
33191
  }
33115
- cacheOptions.membersLookup = "1";
33192
+ cacheOptions.membersLookup = "2";
33116
33193
  const cacheKey = (0, import_node_server_utils97.makeCacheKey)(namespace_collection3, cacheOptions);
33117
33194
  const cachedData = await getCache(cacheKey);
33118
33195
  if (cachedData) {
@@ -33128,7 +33205,7 @@ function useServiceProviderRepo() {
33128
33205
  localField: "serviceProviderOrgId",
33129
33206
  foreignField: "_id",
33130
33207
  as: "organization",
33131
- pipeline: [{ $project: { nature: 1, email: 1 } }]
33208
+ pipeline: [{ $project: { nature: 1, email: 1, contact: 1 } }]
33132
33209
  }
33133
33210
  },
33134
33211
  {
@@ -33140,11 +33217,19 @@ function useServiceProviderRepo() {
33140
33217
  {
33141
33218
  $lookup: {
33142
33219
  from: "members",
33143
- let: { spOrgId: "$serviceProviderOrgId" },
33220
+ // The provider's staff assigned to THIS site, not the provider's
33221
+ // whole headcount - the client has no business knowing how big
33222
+ // its contractor is, only who works on its estate.
33223
+ let: { spOrgId: "$serviceProviderOrgId", spSiteId: "$siteId" },
33144
33224
  pipeline: [
33145
33225
  {
33146
33226
  $match: {
33147
- $expr: { $eq: ["$org", "$$spOrgId"] },
33227
+ $expr: {
33228
+ $and: [
33229
+ { $eq: ["$org", "$$spOrgId"] },
33230
+ { $eq: ["$siteId", "$$spSiteId"] }
33231
+ ]
33232
+ },
33148
33233
  status: "active"
33149
33234
  }
33150
33235
  },
@@ -33167,6 +33252,7 @@ function useServiceProviderRepo() {
33167
33252
  }
33168
33253
  },
33169
33254
  nature: "$organization.nature",
33255
+ contact: { $ifNull: ["$organization.contact", ""] },
33170
33256
  orgId: 1,
33171
33257
  siteId: 1,
33172
33258
  siteName: 1,
@@ -33416,6 +33502,104 @@ function useServiceProviderRepo() {
33416
33502
  throw error;
33417
33503
  }
33418
33504
  }
33505
+ async function getEngagedProvidersBySite(site) {
33506
+ try {
33507
+ site = new import_mongodb72.ObjectId(site);
33508
+ } catch {
33509
+ throw new import_node_server_utils97.BadRequestError("Invalid site ID format.");
33510
+ }
33511
+ return await db2.collection("customer.sites").aggregate([
33512
+ {
33513
+ $match: {
33514
+ site,
33515
+ status: "active",
33516
+ // The client's own row for its own site is not a provider, and a
33517
+ // row that does not say whose site it is proves nothing.
33518
+ siteOrg: { $nin: [null, ""] },
33519
+ $expr: { $ne: ["$org", "$siteOrg"] }
33520
+ }
33521
+ },
33522
+ { $sort: { _id: 1 } },
33523
+ {
33524
+ $group: {
33525
+ _id: "$org",
33526
+ engagementId: { $first: "$_id" },
33527
+ siteName: { $first: "$name" },
33528
+ since: { $first: "$createdAt" }
33529
+ }
33530
+ },
33531
+ {
33532
+ $lookup: {
33533
+ from: "organizations",
33534
+ localField: "_id",
33535
+ foreignField: "_id",
33536
+ as: "organization",
33537
+ pipeline: [
33538
+ { $project: { name: 1, nature: 1, email: 1, contact: 1 } }
33539
+ ]
33540
+ }
33541
+ },
33542
+ { $unwind: { path: "$organization", preserveNullAndEmptyArrays: true } },
33543
+ {
33544
+ $lookup: {
33545
+ from: "members",
33546
+ let: { spOrgId: "$_id" },
33547
+ pipeline: [
33548
+ {
33549
+ $match: {
33550
+ $expr: { $eq: ["$org", "$$spOrgId"] },
33551
+ siteId: site,
33552
+ status: "active"
33553
+ }
33554
+ },
33555
+ { $count: "c" }
33556
+ ],
33557
+ as: "_memberCount"
33558
+ }
33559
+ },
33560
+ {
33561
+ $project: {
33562
+ _id: "$engagementId",
33563
+ name: { $ifNull: ["$organization.name", ""] },
33564
+ type: { $ifNull: ["$organization.nature", ""] },
33565
+ nature: "$organization.nature",
33566
+ email: { $ifNull: ["$organization.email", ""] },
33567
+ contact: { $ifNull: ["$organization.contact", ""] },
33568
+ siteId: site,
33569
+ siteName: 1,
33570
+ serviceProviderOrgId: "$_id",
33571
+ status: "active",
33572
+ category: "external",
33573
+ since: 1,
33574
+ source: "engagement",
33575
+ members: {
33576
+ $ifNull: [{ $arrayElemAt: ["$_memberCount.c", 0] }, 0]
33577
+ }
33578
+ }
33579
+ },
33580
+ { $sort: { name: 1 } },
33581
+ { $limit: 200 }
33582
+ ]).toArray();
33583
+ }
33584
+ async function getSiteProviderKeys(site) {
33585
+ try {
33586
+ site = new import_mongodb72.ObjectId(site);
33587
+ } catch {
33588
+ throw new import_node_server_utils97.BadRequestError("Invalid site ID format.");
33589
+ }
33590
+ const rows = await collection.find(
33591
+ { siteId: site },
33592
+ { projection: { serviceProviderOrgId: 1, email: 1 } }
33593
+ ).toArray();
33594
+ return {
33595
+ orgIds: new Set(
33596
+ rows.map((r) => r.serviceProviderOrgId?.toString?.() ?? "").filter(Boolean)
33597
+ ),
33598
+ emails: new Set(
33599
+ rows.map((r) => String(r.email ?? "").trim().toLowerCase()).filter(Boolean)
33600
+ )
33601
+ };
33602
+ }
33419
33603
  return {
33420
33604
  createTextIndex,
33421
33605
  createUniqueIndex,
@@ -33426,7 +33610,9 @@ function useServiceProviderRepo() {
33426
33610
  getServiceProviderById,
33427
33611
  getByServiceProviderOrgIdType,
33428
33612
  getByEmail,
33429
- updateStatusById
33613
+ updateStatusById,
33614
+ getEngagedProvidersBySite,
33615
+ getSiteProviderKeys
33430
33616
  };
33431
33617
  }
33432
33618
 
@@ -34146,7 +34332,9 @@ var import_node_server_utils102 = require("@7365admin1/node-server-utils");
34146
34332
  function useServiceProviderService() {
34147
34333
  const {
34148
34334
  createServiceProvider: _createServiceProvider,
34149
- getServiceProviders: _getServiceProviders
34335
+ getServiceProviders: _getServiceProviders,
34336
+ getEngagedProvidersBySite: _getEngaged,
34337
+ getSiteProviderKeys: _getSiteProviderKeys
34150
34338
  } = useServiceProviderRepo();
34151
34339
  const { getById: getOrgById, getByEmail: getOrgByEmail } = useOrgRepo();
34152
34340
  const { getSiteById } = useSiteRepo();
@@ -34226,9 +34414,40 @@ function useServiceProviderService() {
34226
34414
  status
34227
34415
  });
34228
34416
  }
34417
+ async function getServiceProvidersForSite({
34418
+ search = "",
34419
+ page = 1,
34420
+ limit = 10,
34421
+ siteId
34422
+ }) {
34423
+ const [engaged, keys] = await Promise.all([
34424
+ _getEngaged(siteId),
34425
+ _getSiteProviderKeys(siteId)
34426
+ ]);
34427
+ const needle = search.trim().toLowerCase();
34428
+ const derived = engaged.filter(
34429
+ (row) => !keys.orgIds.has(row.serviceProviderOrgId?.toString?.() ?? "") && !(row.email && keys.emails.has(String(row.email).trim().toLowerCase())) && (!needle || String(row.name ?? "").toLowerCase().includes(needle))
34430
+ );
34431
+ const stored = (p, l) => _getServiceProviders({ search, page: p, limit: l, siteId, status: "active" });
34432
+ if (!derived.length)
34433
+ return await stored(page, limit);
34434
+ const start = (Math.max(page, 1) - 1) * limit;
34435
+ const fromDerived = derived.slice(start, start + limit);
34436
+ const need = limit - fromDerived.length;
34437
+ const storedStart = Math.max(0, start - derived.length);
34438
+ const first = await stored(1, Math.max(storedStart + need, 1));
34439
+ const total = derived.length + totalOf(first);
34440
+ const fromStored = need > 0 ? (first?.items ?? []).slice(storedStart, storedStart + need) : [];
34441
+ return (0, import_node_server_utils102.paginate)([...fromDerived, ...fromStored], Math.max(page, 1) - 1, limit, total);
34442
+ }
34443
+ function totalOf(data) {
34444
+ const match = /of\s+(\d+)/.exec(String(data?.pageRange ?? ""));
34445
+ return match ? Number(match[1]) : (data?.items ?? []).length;
34446
+ }
34229
34447
  return {
34230
34448
  createServiceProvider,
34231
- getServiceProviders
34449
+ getServiceProviders,
34450
+ getServiceProvidersForSite
34232
34451
  };
34233
34452
  }
34234
34453
 
@@ -34243,7 +34462,18 @@ function useServiceProviderController() {
34243
34462
  getByEmail: _getByEmail,
34244
34463
  updateStatusById: _updateStatusById
34245
34464
  } = useServiceProviderRepo();
34246
- const { createServiceProvider: _createServiceProvider } = useServiceProviderService();
34465
+ const {
34466
+ createServiceProvider: _createServiceProvider,
34467
+ getServiceProvidersForSite: _getServiceProvidersForSite
34468
+ } = useServiceProviderService();
34469
+ async function isSiteClient(req, siteId) {
34470
+ const actor = await resolveInviteActor(callerId(req));
34471
+ if (staffMayBypass(actor))
34472
+ return true;
34473
+ const site = await useSiteRepo().getSiteById(siteId).catch(() => null);
34474
+ const owner = (site?.orgId ?? site?.org)?.toString?.() ?? "";
34475
+ return Boolean(owner) && actor.orgIds.includes(owner);
34476
+ }
34247
34477
  const { createServiceProvider: _add } = useServiceProviderRepo();
34248
34478
  async function createServiceProvider(req, res, next) {
34249
34479
  const validation = import_joi46.default.string().hex().required();
@@ -34272,7 +34502,12 @@ function useServiceProviderController() {
34272
34502
  orgId: import_joi46.default.string().hex().optional().allow("", null),
34273
34503
  siteId: import_joi46.default.string().hex().optional().allow("", null),
34274
34504
  serviceProviderOrgId: import_joi46.default.string().hex().optional().allow("", null),
34275
- status: import_joi46.default.string().optional().allow("", null)
34505
+ status: import_joi46.default.string().optional().allow("", null),
34506
+ // "engagements": also list providers engaged through an accepted
34507
+ // invitation. Opt-in, because those rows carry the engagement's id, not
34508
+ // a service-providers id - a caller that stores the id (the MA app's
34509
+ // feedback provider picker) must keep getting stored rows only.
34510
+ include: import_joi46.default.string().valid("engagements").optional().allow("", null)
34276
34511
  });
34277
34512
  const query2 = { ...req.query };
34278
34513
  const { error } = validation.validate(query2);
@@ -34289,7 +34524,9 @@ function useServiceProviderController() {
34289
34524
  const serviceProviderOrgId = req.query.serviceProviderOrgId ?? "";
34290
34525
  const status = req.query.status ?? "active";
34291
34526
  try {
34292
- const data = await _getServiceProviders({
34527
+ if (siteId)
34528
+ await requireSiteReach(req, siteId);
34529
+ const data = req.query.include === "engagements" && siteId && status === "active" && !orgId && !serviceProviderOrgId && await isSiteClient(req, siteId) ? await _getServiceProvidersForSite({ search, page, limit, siteId }) : await _getServiceProviders({
34293
34530
  search,
34294
34531
  page,
34295
34532
  limit,
@@ -87830,7 +88067,7 @@ function filterByShiftTime(attendance, shiftData, timezone, format2) {
87830
88067
  return checkInLocal.isBetween(shiftStart, shiftEnd, null, "[]");
87831
88068
  });
87832
88069
  }
87833
- function paginate58(data, page, limit) {
88070
+ function paginate59(data, page, limit) {
87834
88071
  const length = data.length;
87835
88072
  const startIndex = (page - 1) * limit;
87836
88073
  const endIndex = startIndex + limit;
@@ -88178,7 +88415,7 @@ var hrmlabs_attendance_util_default = {
88178
88415
  hrmLabsAuthentication,
88179
88416
  fetchAttendanceData,
88180
88417
  filterByShiftTime,
88181
- paginate: paginate58,
88418
+ paginate: paginate59,
88182
88419
  designationCount,
88183
88420
  totalCountPerShift,
88184
88421
  filterByStatus,
@@ -89915,7 +90152,7 @@ var {
89915
90152
  hrmLabsAuthentication: hrmLabsAuthentication3,
89916
90153
  fetchAttendanceData: fetchAttendanceData2,
89917
90154
  filterByShiftTime: filterByShiftTime2,
89918
- paginate: paginate64,
90155
+ paginate: paginate65,
89919
90156
  designationCount: designationCount2,
89920
90157
  totalCountPerShift: totalCountPerShift2,
89921
90158
  filterByStatus: filterByStatus2,
@@ -90025,7 +90262,7 @@ function useHrmLabsAttendanceSrvc() {
90025
90262
  status
90026
90263
  );
90027
90264
  }
90028
- const paginatedItems = paginate64(filteredAttendance, page, limit);
90265
+ const paginatedItems = paginate65(filteredAttendance, page, limit);
90029
90266
  return {
90030
90267
  items: paginatedItems.items,
90031
90268
  pages: paginatedItems.pages,
@@ -94325,6 +94562,7 @@ function useServiceProviderInviteController() {
94325
94562
  try {
94326
94563
  const schema2 = import_joi149.default.object({
94327
94564
  org: import_joi149.default.string().hex().length(24).optional().allow("", null),
94565
+ siteId: import_joi149.default.string().hex().length(24).optional().allow("", null),
94328
94566
  status: import_joi149.default.string().optional().allow("", null),
94329
94567
  search: import_joi149.default.string().max(200).optional().allow("", null),
94330
94568
  page: import_joi149.default.number().min(1).default(1),
@@ -94334,10 +94572,13 @@ function useServiceProviderInviteController() {
94334
94572
  if (error)
94335
94573
  throw new import_node_server_utils282.BadRequestError(`Invalid input: ${error.message}`);
94336
94574
  const statuses = String(value.status ?? "").split(",").map((s) => s.trim()).filter(Boolean);
94575
+ if (value.siteId)
94576
+ await requireSiteReach(req, value.siteId);
94337
94577
  res.json(
94338
94578
  await listForCaller({
94339
94579
  userId: callerId5(req),
94340
94580
  orgId: value.org || void 0,
94581
+ siteId: value.siteId || void 0,
94341
94582
  statuses,
94342
94583
  search: value.search || "",
94343
94584
  page: value.page,