From bb98b0a5c33ef5631313c221818c249da9b153f1 Mon Sep 17 00:00:00 2001 From: nael Date: Sat, 22 Jun 2024 15:49:13 +0200 Subject: [PATCH] :bug: Fix bug --- .../connections/connections.controller.ts | 12 ++++----- packages/api/src/@core/tasks/tasks.service.ts | 27 +++++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/packages/api/src/@core/connections/connections.controller.ts b/packages/api/src/@core/connections/connections.controller.ts index 009232cb8..9c0531784 100644 --- a/packages/api/src/@core/connections/connections.controller.ts +++ b/packages/api/src/@core/connections/connections.controller.ts @@ -11,7 +11,7 @@ import { import { Response } from 'express'; import { CrmConnectionsService } from './crm/services/crm.connection.service'; import { LoggerService } from '@@core/logger/logger.service'; -import { ConnectionsError, throwTypedError } from '@@core/utils/errors'; +import { ConnectionsError } from '@@core/utils/errors'; import { PrismaService } from '@@core/prisma/prisma.service'; import { ApiBody, @@ -21,7 +21,7 @@ import { ApiTags, } from '@nestjs/swagger'; import { TicketingConnectionsService } from './ticketing/services/ticketing.connection.service'; -import { ConnectorCategory } from '@panora/shared'; +import { ConnectorCategory, CONNECTORS_METADATA } from '@panora/shared'; import { AccountingConnectionsService } from './accounting/services/accounting.connection.service'; import { MarketingAutomationConnectionsService } from './marketingautomation/services/marketingautomation.connection.service'; import { JwtAuthGuard } from '@@core/auth/guards/jwt-auth.guard'; @@ -154,7 +154,7 @@ export class ConnectionsController { res.redirect(returnUrl); - /*if ( + if ( CONNECTORS_METADATA[vertical.toLowerCase()][providerName.toLowerCase()] .active !== false ) { @@ -166,7 +166,7 @@ export class ConnectionsController { linkedUserId, projectId, ); - }*/ + } } catch (error) { throw error; } @@ -305,7 +305,7 @@ export class ConnectionsController { res.redirect(returnUrl); - /*if ( + if ( CONNECTORS_METADATA[vertical.toLowerCase()][providerName.toLowerCase()] .active !== false ) { @@ -317,7 +317,7 @@ export class ConnectionsController { linkedUserId, projectId, ); - }*/ + } } catch (error) { throw error; } diff --git a/packages/api/src/@core/tasks/tasks.service.ts b/packages/api/src/@core/tasks/tasks.service.ts index 3ac041956..5bc3e13a6 100644 --- a/packages/api/src/@core/tasks/tasks.service.ts +++ b/packages/api/src/@core/tasks/tasks.service.ts @@ -8,6 +8,9 @@ import { ConnectorCategory } from '@panora/shared'; import { AccountingConnectionsService } from '@@core/connections/accounting/services/accounting.connection.service'; import { MarketingAutomationConnectionsService } from '@@core/connections/marketingautomation/services/marketingautomation.connection.service'; import { TicketingConnectionsService } from '@@core/connections/ticketing/services/ticketing.connection.service'; +import { AtsConnectionsService } from '@@core/connections/ats/services/ats.connection.service'; +import { HrisConnectionsService } from '@@core/connections/hris/services/hris.connection.service'; +import { FilestorageConnectionsService } from '@@core/connections/filestorage/services/filestorage.connection.service'; @Injectable() export class TasksService implements OnModuleInit { @@ -17,6 +20,9 @@ export class TasksService implements OnModuleInit { private readonly ticketingConnectionsService: TicketingConnectionsService, private readonly accountingConnectionsService: AccountingConnectionsService, private readonly marketingAutomationConnectionsService: MarketingAutomationConnectionsService, + private readonly atsConnectionsService: AtsConnectionsService, + private readonly hrisConnectionsService: HrisConnectionsService, + private readonly fileStorageConnectionsService: FilestorageConnectionsService, private logger: LoggerService, ) {} @@ -54,6 +60,13 @@ export class TasksService implements OnModuleInit { break; case ConnectorCategory.Ats: + this.atsConnectionsService.handleAtsTokensRefresh( + connection.id_connection, + connection.provider_slug, + connection.refresh_token, + connection.id_project, + account_url, + ); break; case ConnectorCategory.Accounting: @@ -67,9 +80,23 @@ export class TasksService implements OnModuleInit { break; case ConnectorCategory.FileStorage: + this.fileStorageConnectionsService.handleFilestorageTokensRefresh( + connection.id_connection, + connection.provider_slug, + connection.refresh_token, + connection.id_project, + account_url, + ); break; case ConnectorCategory.Hris: + this.hrisConnectionsService.handleHrisTokensRefresh( + connection.id_connection, + connection.provider_slug, + connection.refresh_token, + connection.id_project, + account_url, + ); break; case ConnectorCategory.MarketingAutomation: