Updated bot, integration, and integrationAuth middlewares to support multiple clients

This commit is contained in:
Tuan Dang
2023-04-12 22:36:36 +03:00
parent e2139882da
commit ed7dbb655c
9 changed files with 257 additions and 69 deletions
+3 -2
View File
@@ -1,3 +1,4 @@
import { Types } from 'mongoose';
import {
handleOAuthExchangeHelper,
syncIntegrationsHelper,
@@ -67,7 +68,7 @@ class IntegrationService {
* @param {String} obj.integrationAuthId - id of integration auth
* @param {String} refreshToken - decrypted refresh token
*/
static async getIntegrationAuthRefresh({ integrationAuthId }: { integrationAuthId: string}) {
static async getIntegrationAuthRefresh({ integrationAuthId }: { integrationAuthId: Types.ObjectId}) {
return await getIntegrationAuthRefreshHelper({
integrationAuthId
});
@@ -80,7 +81,7 @@ class IntegrationService {
* @param {String} obj.integrationAuthId - id of integration auth
* @param {String} accessToken - decrypted access token
*/
static async getIntegrationAuthAccess({ integrationAuthId }: { integrationAuthId: string}) {
static async getIntegrationAuthAccess({ integrationAuthId }: { integrationAuthId: Types.ObjectId }) {
return await getIntegrationAuthAccessHelper({
integrationAuthId
});