@7365admin1/core 3.32.2-staging.35 → 3.32.2-staging.37

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/dist/index.d.ts CHANGED
@@ -1590,7 +1590,7 @@ declare function useServiceProviderRepo(): {
1590
1590
  siteId?: string | ObjectId | undefined;
1591
1591
  orgId?: string | ObjectId | undefined;
1592
1592
  serviceProviderOrgId?: string | ObjectId | undefined;
1593
- }) => Promise<{} | null>;
1593
+ }) => Promise<{}>;
1594
1594
  updateStatusById: (_id: string | ObjectId, status: string) => Promise<mongodb.UpdateResult<bson.Document>>;
1595
1595
  };
1596
1596
 
@@ -1598,6 +1598,7 @@ declare function useServiceProviderController(): {
1598
1598
  createServiceProvider: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1599
1599
  getServiceProviders: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1600
1600
  getByProviderOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1601
+ getByEmail: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1601
1602
  getServiceProviderNames: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1602
1603
  getServiceProviderTypes: (req: Request, res: Response, next: NextFunction) => Promise<void>;
1603
1604
  getServiceProviderById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
package/dist/index.js CHANGED
@@ -19430,7 +19430,7 @@ function useServiceProviderRepo() {
19430
19430
  import_node_server_utils56.logger.info(`Cache hit for key: ${cacheKey}`);
19431
19431
  return cachedData;
19432
19432
  }
19433
- const data = await collection.findOne(query);
19433
+ const data = await collection.find(query).toArray();
19434
19434
  setCache(cacheKey, data, 15 * 60).then(() => {
19435
19435
  import_node_server_utils56.logger.info(`Cache set for key: ${cacheKey}`);
19436
19436
  }).catch((err) => {
@@ -20285,6 +20285,7 @@ function useServiceProviderController() {
20285
20285
  getServiceProviderById: _getServiceProviderById,
20286
20286
  getServiceProviders: _getServiceProviders,
20287
20287
  getByServiceProviderOrgIdType: _getByServiceProviderOrgIdType,
20288
+ getByEmail: _getByEmail,
20288
20289
  updateStatusById: _updateStatusById
20289
20290
  } = useServiceProviderRepo();
20290
20291
  const { createServiceProvider: _createServiceProvider } = useServiceProviderService();
@@ -20523,10 +20524,34 @@ function useServiceProviderController() {
20523
20524
  return;
20524
20525
  }
20525
20526
  }
20527
+ async function getByEmail(req, res, next) {
20528
+ const validation = import_joi31.default.object({
20529
+ email: import_joi31.default.string().email().required(),
20530
+ orgId: import_joi31.default.string().hex().optional().allow("", null),
20531
+ siteId: import_joi31.default.string().hex().optional().allow("", null),
20532
+ serviceProviderOrgId: import_joi31.default.string().hex().optional().allow("", null)
20533
+ });
20534
+ const { error, value } = validation.validate(req.query);
20535
+ if (error) {
20536
+ import_node_server_utils62.logger.log({ level: "error", message: error.message });
20537
+ next(new import_node_server_utils62.BadRequestError(error.message));
20538
+ return;
20539
+ }
20540
+ try {
20541
+ const data = await _getByEmail(value);
20542
+ res.json(data);
20543
+ return;
20544
+ } catch (error2) {
20545
+ import_node_server_utils62.logger.log({ level: "error", message: error2.message });
20546
+ next(error2);
20547
+ return;
20548
+ }
20549
+ }
20526
20550
  return {
20527
20551
  createServiceProvider,
20528
20552
  getServiceProviders,
20529
20553
  getByProviderOrg,
20554
+ getByEmail,
20530
20555
  getServiceProviderNames,
20531
20556
  getServiceProviderTypes,
20532
20557
  getServiceProviderById,