Skip to content

Commit

Permalink
🐛 Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Jun 22, 2024
1 parent 90a3906 commit bb98b0a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/api/src/@core/connections/connections.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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';
Expand Down Expand Up @@ -154,7 +154,7 @@ export class ConnectionsController {

res.redirect(returnUrl);

Check warning

Code scanning / CodeQL

Server-side URL redirect Medium

Untrusted URL redirection depends on a
user-provided value
.

/*if (
if (
CONNECTORS_METADATA[vertical.toLowerCase()][providerName.toLowerCase()]
.active !== false
) {
Expand All @@ -166,7 +166,7 @@ export class ConnectionsController {
linkedUserId,
projectId,
);
}*/
}
} catch (error) {
throw error;
}
Expand Down Expand Up @@ -305,7 +305,7 @@ export class ConnectionsController {

res.redirect(returnUrl);

Check warning

Code scanning / CodeQL

Server-side URL redirect Medium

Untrusted URL redirection depends on a
user-provided value
.

/*if (
if (
CONNECTORS_METADATA[vertical.toLowerCase()][providerName.toLowerCase()]
.active !== false
) {
Expand All @@ -317,7 +317,7 @@ export class ConnectionsController {
linkedUserId,
projectId,
);
}*/
}
} catch (error) {
throw error;
}
Expand Down
27 changes: 27 additions & 0 deletions packages/api/src/@core/tasks/tasks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
) {}

Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit bb98b0a

Please sign in to comment.