Skip to content

Commit 66be9ac

Browse files
committed
🐛 Fix bamboihr connection
1 parent c1b8156 commit 66be9ac

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

packages/api/src/@core/auth/auth.controller.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ export class AuthController {
3838
this.logger.setContext(AuthController.name);
3939
}
4040

41-
@ApiOperation({ operationId: 'generateCodes', summary: 'generateCodes' })
41+
@ApiOperation({
42+
operationId: 'generateCodes',
43+
summary: 'generate codes for s256 challenge',
44+
})
4245
@ApiResponse({ status: 200 })
4346
@Get('s256Codes')
4447
@ApiExcludeEndpoint()

packages/api/src/@core/connections/ats/services/bamboohr/bamboohr.service.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { EncryptionService } from '@@core/@core-services/encryption/encryption.s
22
import { EnvironmentService } from '@@core/@core-services/environment/environment.service';
33
import { LoggerService } from '@@core/@core-services/logger/logger.service';
44
import { PrismaService } from '@@core/@core-services/prisma/prisma.service';
5+
import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler';
56
import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service';
67
import { ConnectionUtils } from '@@core/connections/@utils';
78
import {
@@ -10,18 +11,16 @@ import {
1011
PassthroughInput,
1112
RefreshParams,
1213
} from '@@core/connections/@utils/types';
14+
import { PassthroughResponse } from '@@core/passthrough/types';
1315
import { Injectable } from '@nestjs/common';
1416
import {
1517
AuthStrategy,
1618
CONNECTORS_METADATA,
1719
DynamicApiUrl,
1820
providerToType,
1921
} from '@panora/shared';
20-
import axios from 'axios';
2122
import { v4 as uuidv4 } from 'uuid';
2223
import { ServiceRegistry } from '../registry.service';
23-
import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler';
24-
import { PassthroughResponse } from '@@core/passthrough/types';
2524

2625
export type BamboohrOAuthResponse = {
2726
access_token: string;
@@ -92,7 +91,7 @@ export class BamboohrConnectionService extends AbstractBaseConnectionService {
9291
async handleCallback(opts: OAuthCallbackParams) {
9392
try {
9493
const { linkedUserId, projectId, body } = opts;
95-
const { username, company_subdomain } = body;
94+
const { api_key, subdomain } = body;
9695
const isNotUnique = await this.prisma.connections.findFirst({
9796
where: {
9897
id_linked_user: linkedUserId,
@@ -104,16 +103,15 @@ export class BamboohrConnectionService extends AbstractBaseConnectionService {
104103
let db_res;
105104
const connection_token = uuidv4();
106105
const BASE_API_URL = (
107-
CONNECTORS_METADATA['ats']['bamboohr'].urls
108-
.apiUrl as DynamicApiUrl
109-
)(company_subdomain);
106+
CONNECTORS_METADATA['ats']['bamboohr'].urls.apiUrl as DynamicApiUrl
107+
)(subdomain);
110108
if (isNotUnique) {
111109
db_res = await this.prisma.connections.update({
112110
where: {
113111
id_connection: isNotUnique.id_connection,
114112
},
115113
data: {
116-
access_token: this.cryptoService.encrypt(username),
114+
access_token: this.cryptoService.encrypt(api_key),
117115
account_url: BASE_API_URL,
118116
status: 'valid',
119117
created_at: new Date(),
@@ -128,7 +126,7 @@ export class BamboohrConnectionService extends AbstractBaseConnectionService {
128126
vertical: 'ats',
129127
token_type: 'basic',
130128
account_url: BASE_API_URL,
131-
access_token: this.cryptoService.encrypt(username),
129+
access_token: this.cryptoService.encrypt(api_key),
132130
status: 'valid',
133131
created_at: new Date(),
134132
projects: {

packages/api/src/filestorage/file/services/box/index.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import { Injectable } from '@nestjs/common';
2-
import { IFileService } from '@filestorage/file/types';
3-
import { FileStorageObject } from '@filestorage/@lib/@types';
4-
import axios from 'axios';
5-
import { PrismaService } from '@@core/@core-services/prisma/prisma.service';
6-
import { LoggerService } from '@@core/@core-services/logger/logger.service';
7-
import { ActionType, handle3rdPartyServiceError } from '@@core/utils/errors';
81
import { EncryptionService } from '@@core/@core-services/encryption/encryption.service';
2+
import { LoggerService } from '@@core/@core-services/logger/logger.service';
3+
import { PrismaService } from '@@core/@core-services/prisma/prisma.service';
94
import { ApiResponse } from '@@core/utils/types';
10-
import { ServiceRegistry } from '../registry.service';
11-
import { BoxFileInput, BoxFileOutput } from './types';
125
import { SyncParam } from '@@core/utils/types/interface';
6+
import { FileStorageObject } from '@filestorage/@lib/@types';
7+
import { IFileService } from '@filestorage/file/types';
8+
import { Injectable } from '@nestjs/common';
9+
import axios from 'axios';
10+
import { ServiceRegistry } from '../registry.service';
11+
import { BoxFileOutput } from './types';
1312

1413
@Injectable()
1514
export class BoxService implements IFileService {

packages/shared/src/connectors/metadata.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ export const CONNECTORS_METADATA: ProvidersConfig = {
905905
},
906906
logoPath: 'https://play-lh.googleusercontent.com/EMobDJKabP1eY_63QHgPS_-TK3eRfxXaeOnERbcRaWAw573iaV74pXS9xOv997dRZtM',
907907
description: 'Sync & Create contacts, deals, companies, notes, engagements, stages, tasks and users',
908-
active: true,
908+
active: false,
909909
authStrategy: {
910910
strategy: AuthStrategy.oauth2
911911
},
@@ -1274,7 +1274,7 @@ export const CONNECTORS_METADATA: ProvidersConfig = {
12741274
primaryColor: '#599D16',
12751275
authStrategy: {
12761276
strategy: AuthStrategy.basic,
1277-
properties: ['username', 'subdomain']
1277+
properties: ['subdomain', 'api_key']
12781278
},
12791279
},
12801280
'breezy': {
@@ -1838,8 +1838,10 @@ export const CONNECTORS_METADATA: ProvidersConfig = {
18381838
logoPath: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSZTX2h9yFQ0u4ziDqvfQ224wW4N1s5JvJ5nA&s',
18391839
description: 'Sync & Create contacts, deals, companies, notes, engagements, stages, tasks and users',
18401840
active: false,
1841+
primaryColor: '#0167AB',
18411842
authStrategy: {
1842-
strategy: AuthStrategy.api_key
1843+
strategy: AuthStrategy.api_key,
1844+
properties: ['api_key']
18431845
}
18441846
},
18451847
'zoho_recruit': {

0 commit comments

Comments
 (0)