@7365admin1/core 3.32.2-staging.82 → 3.32.2-staging.83

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,17 @@
1
+ ---
2
+ "@7365admin1/core": patch
3
+ ---
4
+
5
+ Make the "an invitation is already waiting" check actually find the invitation
6
+
7
+ The duplicate-invitation guard added with the existing-provider invite fix never
8
+ fired. Invitations are written with `metadata.siteId` as an ObjectId, but the
9
+ lookup searched for the site id as the plain string it arrived as on the request,
10
+ and MongoDB does not treat the two as equal. The query therefore always came back
11
+ empty: a property manager could send the same service provider a second, third
12
+ and fourth invitation for the same site while the first was still valid, and each
13
+ one produced another email and another pending row for them to chase.
14
+
15
+ The lookup now matches either form, so older records that hold the string are
16
+ still found. Nothing else changes: the refusal message and the status code are
17
+ the ones already shipped.
package/dist/index.js CHANGED
@@ -12480,6 +12480,11 @@ function useVerificationRepoV2() {
12480
12480
  }
12481
12481
  }
12482
12482
  async function getPendingServiceProviderInvite(email, siteId) {
12483
+ const site = [siteId];
12484
+ try {
12485
+ site.push(new import_mongodb19.ObjectId(siteId));
12486
+ } catch {
12487
+ }
12483
12488
  try {
12484
12489
  return await collection.findOne(
12485
12490
  {
@@ -12491,7 +12496,7 @@ function useVerificationRepoV2() {
12491
12496
  "service-provider-create-org" /* SERVICE_PROVIDER_CREATE_ORG */
12492
12497
  ]
12493
12498
  },
12494
- "metadata.siteId": siteId,
12499
+ "metadata.siteId": { $in: site },
12495
12500
  expireAt: { $gt: (/* @__PURE__ */ new Date()).toISOString() }
12496
12501
  },
12497
12502
  { sort: { createdAt: -1 } }