@@ -22,7 +22,10 @@ const eClient = util.getElasticSearchClient();
22
22
* @return {Object } the job created
23
23
*/
24
24
const createTaasJob = async ( data ) => {
25
- const token = await util . getM2MToken ( ) ;
25
+ // TODO uncomment when TaaS API supports M2M tokens
26
+ // see https://github.com/topcoder-platform/taas-apis/issues/40
27
+ // const token = await util.getM2MToken();
28
+ const token = process . env . TAAS_API_TOKEN ;
26
29
const headers = {
27
30
'Content-Type' : 'application/json' ,
28
31
Authorization : `Bearer ${ token } ` ,
@@ -200,18 +203,21 @@ async function projectCreatedKafkaHandler(app, topic, payload) {
200
203
( specialist ) => {
201
204
const startDate = new Date ( ) ;
202
205
const endDate = moment ( startDate ) . add ( Number ( specialist . duration ) , 'M' ) ; // the unit of duration is month
203
- const skills = specialist . skills . filter ( skill => skill . id ) . map ( skill => skill . id ) ;
206
+ // use both, required and additional skills for jobs
207
+ const skills = specialist . skills . concat ( specialist . additionalSkills )
208
+ // only include skills with `id` and ignore custom skills in jobs
209
+ . filter ( skill => skill . id ) . map ( skill => skill . id ) ;
204
210
return createTaasJob ( {
205
211
projectId : project . id ,
206
- externalId : _ . get ( project , 'external.id' ) || String ( project . id ) ,
212
+ externalId : '0' , // hardcode for now
207
213
description : specialist . roleTitle ,
208
214
startDate,
209
215
endDate,
210
216
skills,
211
217
numPositions : Number ( specialist . people ) ,
212
218
resourceType : specialist . role ,
213
- rateType : 'hourly' ,
214
- workload : specialist . workLoad . title . toLowerCase ( ) ,
219
+ rateType : 'hourly' , // hardcode for now
220
+ workload : _ . get ( specialist , ' workLoad.title' , '' ) . toLowerCase ( ) ,
215
221
} ) . then ( ( job ) => {
216
222
app . logger . debug ( `jobId: ${ job . id } job created for roleTitle ${ specialist . roleTitle } ` ) ;
217
223
} ) . catch ( ( err ) => {
0 commit comments