Skip to content

Commit 2455835

Browse files
authored
Merge pull request #498 from topcoder-platform/revert-497-revert-496-revert-487-feature/enriching-skills-data-with-api
Revert "New "Handling missing skill data enrichment via API call""
2 parents 418f224 + 015a8a7 commit 2455835

File tree

3 files changed

+31
-38
lines changed

3 files changed

+31
-38
lines changed

config/default.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ module.exports = {
3333

3434
// the Topcoder v5 url
3535
TC_API: process.env.TC_API || 'https://api.topcoder-dev.com/v5',
36-
// the Topcoder Beta API url currently v5.1
37-
TC_BETA_API: process.env.TC_BETA_API || 'https://api.topcoder-dev.com/v5.1',
3836
// the organization id
3937
ORG_ID: process.env.ORG_ID || '36ed815b-3da1-49f1-a043-aaed0a4e81ad',
40-
// the referenced taxonomy id
41-
TOPCODER_TAXONOMY_ID: process.env.TOPCODER_TAXONOMY_ID || '7637ae1a-3b7c-44eb-a5ed-10ea02f1885d',
38+
// the referenced skill provider id
39+
TOPCODER_SKILL_PROVIDER_ID: process.env.TOPCODER_SKILL_PROVIDER_ID || '9cc0795a-6e12-4c84-9744-15858dba1861',
4240

4341
TOPCODER_USERS_API: process.env.TOPCODER_USERS_API || 'https://api.topcoder-dev.com/v3/users',
4442
// the api to find topcoder members

docs/swagger.yaml

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,7 +3212,7 @@ paths:
32123212
schema:
32133213
type: array
32143214
items:
3215-
$ref: "#/components/schemas/SkillInSkillsAPI"
3215+
$ref: "#/components/schemas/UbahnSkill"
32163216
headers:
32173217
X-Next-Page:
32183218
schema:
@@ -5574,25 +5574,17 @@ components:
55745574
type: string
55755575
example: "React"
55765576
description: The skill name.
5577-
SkillInSkillsAPI:
5578-
required:
5579-
- "id"
5580-
- "name"
5581-
- "taxonomyId"
5582-
- "taxonomyName"
5583-
- "metadata"
5577+
UbahnSkill:
5578+
type: object
55845579
properties:
55855580
id:
55865581
type: "string"
55875582
format: "UUID"
55885583
description: "The skill id"
5589-
taxonomyId:
5584+
skillProviderId:
55905585
type: "string"
55915586
format: "UUID"
5592-
description: "The referenced taxonomy id"
5593-
taxonomyName:
5594-
type: "string"
5595-
description: "The referenced taxonomy name"
5587+
description: "The referenced skill provider id"
55965588
name:
55975589
type: "string"
55985590
description: "The name of the skill"
@@ -5602,20 +5594,22 @@ components:
56025594
uri:
56035595
type: "string"
56045596
description: "The uri for the skill"
5605-
metadata:
5606-
type: "object"
5607-
description: "The metadata for the skill"
5608-
properties:
5609-
updated:
5610-
type: "string"
5611-
format: "date-time"
5612-
description: "The last updated timestamp of the skill"
5613-
challengeProminence:
5614-
type: "string"
5615-
description: "The challenge prominence ranging from [0, 1]"
5616-
memberProminence:
5617-
type: "string"
5618-
description: "The member prominence ranging from [0, 1]"
5597+
created:
5598+
type: "string"
5599+
format: "date-time"
5600+
description: "When the entity was created."
5601+
updated:
5602+
type: "string"
5603+
format: "date-time"
5604+
description: "When the entity was updated."
5605+
createdBy:
5606+
type: "string"
5607+
format: "UUID"
5608+
description: "Creator of the entity."
5609+
updatedBy:
5610+
type: "string"
5611+
format: "UUID"
5612+
description: "User that last updated the entity."
56195613
JobForTeam:
56205614
properties:
56215615
id:

src/common/helper.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,6 @@ async function listUsersByExternalId (externalId) {
951951
context: 'listUserByExternalId',
952952
message: `response body: ${JSON.stringify(res.body)}`
953953
})
954-
955954
return res.body
956955
}
957956

@@ -1094,7 +1093,9 @@ async function getUserById (userId, enrich) {
10941093
const user = _.pick(res.body, ['id', 'handle', 'firstName', 'lastName'])
10951094

10961095
if (enrich) {
1097-
user.skills = await Promise.all((res.body.skills || []).map(async (userSkill) => getSkillById(userSkill.skillId)))
1096+
user.skills = (res.body.skills || []).map((skillObj) =>
1097+
_.pick(skillObj.skill, ['id', 'name'])
1098+
)
10981099
const attributes = _.get(res, 'body.attributes', [])
10991100
user.attributes = _.map(attributes, (attr) =>
11001101
_.pick(attr, ['id', 'value', 'attribute.id', 'attribute.name'])
@@ -1211,7 +1212,7 @@ async function getProjectById (currentUser, id) {
12111212

12121213
/**
12131214
* Function to search skills from v5/skills
1214-
* - only returns skills from Topcoder Skills API defined by `TOPCODER_TAXONOMY_ID`
1215+
* - only returns skills from Topcoder Skills Provider defined by `TOPCODER_SKILL_PROVIDER_ID`
12151216
*
12161217
* @param {Object} criteria the search criteria
12171218
* @returns the request result
@@ -1220,9 +1221,9 @@ async function getTopcoderSkills (criteria) {
12201221
const token = await getM2MUbahnToken()
12211222
try {
12221223
const res = await request
1223-
.get(`${config.TC_BETA_API}/skills`)
1224+
.get(`${config.TC_API}/skills`)
12241225
.query({
1225-
taxonomyId: config.TOPCODER_TAXONOMY_ID,
1226+
skillProviderId: config.TOPCODER_SKILL_PROVIDER_ID,
12261227
...criteria
12271228
})
12281229
.set('Authorization', `Bearer ${token}`)
@@ -1248,7 +1249,7 @@ async function getTopcoderSkills (criteria) {
12481249

12491250
/**
12501251
* Function to search and retrive all skills from v5/skills
1251-
* - only returns skills from Topcoder Skills API defined by `TOPCODER_TAXONOMY_ID`
1252+
* - only returns skills from Topcoder Skills Provider defined by `TOPCODER_SKILL_PROVIDER_ID`
12521253
*
12531254
* @param {Object} criteria the search criteria
12541255
* @returns the request result
@@ -1272,7 +1273,7 @@ async function getAllTopcoderSkills (criteria) {
12721273
async function getSkillById (skillId) {
12731274
const token = await getM2MUbahnToken()
12741275
const res = await request
1275-
.get(`${config.TC_BETA_API}/skills/${skillId}`)
1276+
.get(`${config.TC_API}/skills/${skillId}`)
12761277
.set('Authorization', `Bearer ${token}`)
12771278
.set('Content-Type', 'application/json')
12781279
.set('Accept', 'application/json')

0 commit comments

Comments
 (0)