Skip to content

Commit 7dac65a

Browse files
committed
refactor: getSkills -> getTopcoderSkills
1 parent ba5b1dc commit 7dac65a

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

config/default.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121

2222
TC_API: process.env.TC_API || 'https://api.topcoder-dev.com/v5',
2323
ORG_ID: process.env.ORG_ID || '36ed815b-3da1-49f1-a043-aaed0a4e81ad',
24-
TOPCODER_SKILL_PROVIDER_ID: process.env.TOPCODER_SKILL_PROVIDER_ID,
24+
TOPCODER_SKILL_PROVIDER_ID: process.env.TOPCODER_SKILL_PROVIDER_ID || '9cc0795a-6e12-4c84-9744-15858dba1861',
2525

2626
TOPCODER_USERS_API: process.env.TOPCODER_USERS_API || 'https://api.topcoder-dev.com/v3/users',
2727

src/common/helper.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,12 @@ async function getProjectById (currentUser, id) {
475475

476476
/**
477477
* Function to search skills from v5/skills
478+
* - only returns skills from Topcoder Skills Provider defined by `TOPCODER_SKILL_PROVIDER_ID`
479+
*
478480
* @param {Object} criteria the search criteria
479481
* @returns the request result
480482
*/
481-
async function getSkills (criteria) {
483+
async function getTopcoderSkills (criteria) {
482484
const token = await getM2Mtoken()
483485
try {
484486
const res = await request
@@ -490,7 +492,7 @@ async function getSkills (criteria) {
490492
.set('Authorization', `Bearer ${token}`)
491493
.set('Content-Type', 'application/json')
492494
.set('Accept', 'application/json')
493-
localLogger.debug({ context: 'getSkills', message: `response body: ${JSON.stringify(res.body)}` })
495+
localLogger.debug({ context: 'getTopcoderSkills', message: `response body: ${JSON.stringify(res.body)}` })
494496
return {
495497
total: Number(_.get(res.headers, 'x-total')),
496498
page: Number(_.get(res.headers, 'x-page')),
@@ -623,7 +625,7 @@ module.exports = {
623625
getUserById,
624626
getMembers,
625627
getProjectById,
626-
getSkills,
628+
getTopcoderSkills,
627629
getSkillById,
628630
getUserSkill,
629631
ensureJobById,

src/services/SkillService.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const helper = require('../common/helper')
1010
* @returns {Object} the search result, contain total/page/perPage and result array
1111
*/
1212
async function searchSkills (criteria) {
13-
return helper.getSkills(criteria)
13+
return helper.getTopcoderSkills(criteria)
1414
}
1515

1616
searchSkills.schema = Joi.object().keys({

0 commit comments

Comments
 (0)