@@ -22,7 +22,10 @@ const eClient = util.getElasticSearchClient();
2222 * @return {Object } the job created
2323 */
2424const 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 ;
2629 const headers = {
2730 'Content-Type' : 'application/json' ,
2831 Authorization : `Bearer ${ token } ` ,
@@ -200,18 +203,21 @@ async function projectCreatedKafkaHandler(app, topic, payload) {
200203 ( specialist ) => {
201204 const startDate = new Date ( ) ;
202205 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 ) ;
204210 return createTaasJob ( {
205211 projectId : project . id ,
206- externalId : _ . get ( project , 'external.id' ) || String ( project . id ) ,
212+ externalId : '0' , // hardcode for now
207213 description : specialist . roleTitle ,
208214 startDate,
209215 endDate,
210216 skills,
211217 numPositions : Number ( specialist . people ) ,
212218 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 ( ) ,
215221 } ) . then ( ( job ) => {
216222 app . logger . debug ( `jobId: ${ job . id } job created for roleTitle ${ specialist . roleTitle } ` ) ;
217223 } ) . catch ( ( err ) => {
0 commit comments