@@ -5,7 +5,6 @@ import _ from 'lodash';
5
5
import Joi from 'joi' ;
6
6
import Promise from 'bluebird' ;
7
7
import config from 'config' ;
8
- import axios from 'axios' ;
9
8
import util from '../../util' ;
10
9
import models from '../../models' ;
11
10
import { createPhaseTopic } from '../projectPhases' ;
@@ -15,27 +14,6 @@ const ES_PROJECT_INDEX = config.get('elasticsearchConfig.indexName');
15
14
const ES_PROJECT_TYPE = config . get ( 'elasticsearchConfig.docType' ) ;
16
15
const eClient = util . getElasticSearchClient ( ) ;
17
16
18
- /**
19
- * creates taas job
20
- * @param {Object } data the job data
21
- * @return {Object } the job created
22
- */
23
- const createTaasJob = async ( data ) => {
24
- const token = await util . getM2MToken ( ) ;
25
- const headers = {
26
- 'Content-Type' : 'application/json' ,
27
- Authorization : `Bearer ${ token } ` ,
28
- } ;
29
- const res = await axios
30
- . post ( config . taasJobApiUrl , data , { headers } )
31
- . catch ( ( err ) => {
32
- const error = new Error ( ) ;
33
- error . message = _ . get ( err , 'response.data.message' , error . message ) ;
34
- throw error ;
35
- } ) ;
36
- return res . data ;
37
- } ;
38
-
39
17
/**
40
18
* Payload for deprecated BUS events like `connect.notification.project.updated`.
41
19
*/
@@ -186,42 +164,6 @@ async function projectCreatedKafkaHandler(app, topic, payload) {
186
164
await Promise . all ( topicPromises ) ;
187
165
app . logger . debug ( 'Topics for phases are successfully created.' ) ;
188
166
}
189
- try {
190
- if ( project . type === 'talent-as-a-service' ) {
191
- const jobs = _ . get ( project , 'details.taasDefinition.taasJobs' ) ;
192
- if ( ! jobs || ! jobs . length ) {
193
- app . logger . debug ( `no jobs found in the project id: ${ project . id } ` ) ;
194
- return ;
195
- }
196
- app . logger . debug ( `${ jobs . length } jobs found in the project id: ${ project . id } ` ) ;
197
- await Promise . all (
198
- _ . map (
199
- jobs ,
200
- ( job ) => {
201
- // make sure that skills would be unique in the list and only include ones with 'skillId' (actually they all suppose to be with skillId)
202
- const skills = _ . chain ( job . skills ) . map ( 'skillId' ) . uniq ( ) . compact ( )
203
- . value ( ) ;
204
- return createTaasJob ( {
205
- projectId : project . id ,
206
- title : job . title ,
207
- description : job . description ,
208
- skills,
209
- numPositions : Number ( job . people ) ,
210
- resourceType : _ . get ( job , 'role.value' , '' ) ,
211
- rateType : 'weekly' , // hardcode for now
212
- workload : _ . get ( job , 'workLoad.title' , '' ) . toLowerCase ( ) ,
213
- } ) . then ( ( createdJob ) => {
214
- app . logger . debug ( `jobId: ${ createdJob . id } job created with title "${ createdJob . title } "` ) ;
215
- } ) . catch ( ( err ) => {
216
- app . logger . error ( `Unable to create job with title "${ job . title } ": ${ err . message } ` ) ;
217
- } ) ;
218
- } ,
219
- ) ,
220
- ) ;
221
- }
222
- } catch ( error ) {
223
- app . logger . error ( `Error while creating TaaS jobs: ${ error } ` ) ;
224
- }
225
167
}
226
168
227
169
module . exports = {
0 commit comments