@7365admin1/core 3.42.0 → 3.42.1

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @iservice365/core
2
2
 
3
+ ## 3.42.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 87c073f: Make the "an invitation is already waiting" check actually find the invitation
8
+
9
+ The duplicate-invitation guard added with the existing-provider invite fix never
10
+ fired. Invitations are written with `metadata.siteId` as an ObjectId, but the
11
+ lookup searched for the site id as the plain string it arrived as on the request,
12
+ and MongoDB does not treat the two as equal. The query therefore always came back
13
+ empty: a property manager could send the same service provider a second, third
14
+ and fourth invitation for the same site while the first was still valid, and each
15
+ one produced another email and another pending row for them to chase.
16
+
17
+ The lookup now matches either form, so older records that hold the string are
18
+ still found. Nothing else changes: the refusal message and the status code are
19
+ the ones already shipped.
20
+
3
21
  ## 3.42.0
4
22
 
5
23
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1613,7 +1613,7 @@ declare function useServiceProviderRepo(): {
1613
1613
  siteId?: string | ObjectId | undefined;
1614
1614
  orgId?: string | ObjectId | undefined;
1615
1615
  serviceProviderOrgId?: string | ObjectId | undefined;
1616
- }) => Promise<{} | null>;
1616
+ }) => Promise<{}>;
1617
1617
  updateStatusById: (_id: string | ObjectId, status: string) => Promise<mongodb.UpdateResult<bson.Document>>;
1618
1618
  };
1619
1619
 
@@ -1621,6 +1621,7 @@ declare function useServiceProviderController(): {
1621
1621
  createServiceProvider: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1622
1622
  getServiceProviders: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1623
1623
  getByProviderOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1624
+ getByEmail: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1624
1625
  getServiceProviderNames: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1625
1626
  getServiceProviderTypes: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1626
1627
  getServiceProviderById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
@@ -2605,6 +2606,7 @@ declare function useCustomerSiteRepo(): {
2605
2606
  name: string;
2606
2607
  org: string | ObjectId;
2607
2608
  }) => Promise<TCustomerSite[]>;
2609
+ countActiveByOrgAndSite: (org: string | ObjectId, site: string | ObjectId) => Promise<number>;
2608
2610
  getBySiteAsServiceProvider: (site: string | ObjectId) => Promise<{} | undefined>;
2609
2611
  getById: (id: string | ObjectId) => Promise<mongodb.WithId<bson.Document>>;
2610
2612
  updateCustomerSiteById: (id: string | ObjectId, payload: Partial<TCustomerSite>, session?: ClientSession) => Promise<mongodb.WithId<bson.Document>>;
@@ -2613,7 +2615,7 @@ declare function useCustomerSiteRepo(): {
2613
2615
 
2614
2616
  declare function useCustomerSiteService(): {
2615
2617
  add: (value: TCustomerSite) => Promise<string>;
2616
- addViaInvite: (invite: string) => Promise<string>;
2618
+ addViaInvite: (invite: string) => Promise<"This site is already on your list." | "Invite accepted, successfully added site.">;
2617
2619
  updateCusSiteById: (customerSiteId: string, payload: Partial<TCustomerSite>) => Promise<mongodb.WithId<bson.Document>>;
2618
2620
  };
2619
2621
 
@@ -7079,6 +7081,7 @@ declare function useVerificationRepoV2(): {
7079
7081
  updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
7080
7082
  countPendingOrgInvites: (orgId: string | ObjectId) => Promise<number>;
7081
7083
  getPendingVerificationByEmail: (email: string) => Promise<TVerificationV2 | null>;
7084
+ getPendingServiceProviderInvite: (email: string, siteId: string) => Promise<TVerificationV2 | null>;
7082
7085
  updateVerificationCodeById: (_id: string | ObjectId, verificationCode: string, expireAt: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
7083
7086
  completePendingInvites: ({ email, orgId, siteId, app, session, }: {
7084
7087
  email: string;