@@ -2,6 +2,7 @@ import { EncryptionService } from '@@core/@core-services/encryption/encryption.s
2
2
import { EnvironmentService } from '@@core/@core-services/environment/environment.service' ;
3
3
import { LoggerService } from '@@core/@core-services/logger/logger.service' ;
4
4
import { PrismaService } from '@@core/@core-services/prisma/prisma.service' ;
5
+ import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler' ;
5
6
import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service' ;
6
7
import { ConnectionUtils } from '@@core/connections/@utils' ;
7
8
import {
@@ -10,18 +11,16 @@ import {
10
11
PassthroughInput ,
11
12
RefreshParams ,
12
13
} from '@@core/connections/@utils/types' ;
14
+ import { PassthroughResponse } from '@@core/passthrough/types' ;
13
15
import { Injectable } from '@nestjs/common' ;
14
16
import {
15
17
AuthStrategy ,
16
18
CONNECTORS_METADATA ,
17
19
DynamicApiUrl ,
18
20
providerToType ,
19
21
} from '@panora/shared' ;
20
- import axios from 'axios' ;
21
22
import { v4 as uuidv4 } from 'uuid' ;
22
23
import { ServiceRegistry } from '../registry.service' ;
23
- import { RetryHandler } from '@@core/@core-services/request-retry/retry.handler' ;
24
- import { PassthroughResponse } from '@@core/passthrough/types' ;
25
24
26
25
export type BamboohrOAuthResponse = {
27
26
access_token : string ;
@@ -92,7 +91,7 @@ export class BamboohrConnectionService extends AbstractBaseConnectionService {
92
91
async handleCallback ( opts : OAuthCallbackParams ) {
93
92
try {
94
93
const { linkedUserId, projectId, body } = opts ;
95
- const { username , company_subdomain } = body ;
94
+ const { api_key , subdomain } = body ;
96
95
const isNotUnique = await this . prisma . connections . findFirst ( {
97
96
where : {
98
97
id_linked_user : linkedUserId ,
@@ -104,16 +103,15 @@ export class BamboohrConnectionService extends AbstractBaseConnectionService {
104
103
let db_res ;
105
104
const connection_token = uuidv4 ( ) ;
106
105
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 ) ;
110
108
if ( isNotUnique ) {
111
109
db_res = await this . prisma . connections . update ( {
112
110
where : {
113
111
id_connection : isNotUnique . id_connection ,
114
112
} ,
115
113
data : {
116
- access_token : this . cryptoService . encrypt ( username ) ,
114
+ access_token : this . cryptoService . encrypt ( api_key ) ,
117
115
account_url : BASE_API_URL ,
118
116
status : 'valid' ,
119
117
created_at : new Date ( ) ,
@@ -128,7 +126,7 @@ export class BamboohrConnectionService extends AbstractBaseConnectionService {
128
126
vertical : 'ats' ,
129
127
token_type : 'basic' ,
130
128
account_url : BASE_API_URL ,
131
- access_token : this . cryptoService . encrypt ( username ) ,
129
+ access_token : this . cryptoService . encrypt ( api_key ) ,
132
130
status : 'valid' ,
133
131
created_at : new Date ( ) ,
134
132
projects : {
0 commit comments