Skip to content

Role & Skills Intake - Job Description Module #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions docs/Topcoder-bookings-api.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "58b277bb-0d1d-4bbf-919f-c5951ba0e1c0",
"_postman_id": "b25dc4fc-ac96-49a5-b8b0-7700c625d4d0",
"name": "Topcoder-bookings-api",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
Expand Down Expand Up @@ -17647,6 +17647,44 @@
},
"response": []
},
{
"name": "POST /taas-teams/getSkillsByJobDescription",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{token_member}}"
},
{
"key": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"description\": \"nodejs react c++ hello\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{URL}}/taas-teams/getSkillsByJobDescription",
"host": [
"{{URL}}"
],
"path": [
"taas-teams",
"getSkillsByJobDescription"
]
}
},
"response": []
},
{
"name": "POST /taas-teams/email - member-issue-report",
"request": {
Expand Down Expand Up @@ -27007,4 +27045,4 @@
]
}
]
}
}
65 changes: 65 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3170,6 +3170,54 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/Error"

/taas-teams/getSkillsByJobDescription:
post:
tags:
- Teams
description: |
Get skill list by Job Description
security:
- bearerAuth: []
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/TeamJobDescriptionRequestBody"
responses:
"200":
description: OK
content:
application/json:
schema:
type : array
items : {
$ref: "#/components/schemas/SkillItem"
}
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"401":
description: Not authenticated
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"403":
description: Forbidden
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"500":
description: Internal Server Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/taas-teams/email:
post:
tags:
Expand Down Expand Up @@ -3282,6 +3330,15 @@ components:
scheme: bearer
bearerFormat: JWT
schemas:
SkillItem:
properties:
tag:
type: string
type:
type: string
source:
type: string

Job:
required:
- id
Expand Down Expand Up @@ -4666,6 +4723,14 @@ components:
type: array
items:
$ref: "#/components/schemas/Skill"
TeamJobDescriptionRequestBody:
type: object
properties:
description:
type: string
description: "job description"
example: "nodejs and java"

TeamEmailRequestBody:
type: object
properties:
Expand Down
24 changes: 24 additions & 0 deletions src/common/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,29 @@ async function substituteStringByObject(string, object) {
return string;
}


/**
* Get tags from tagging service
* @param {String} description The challenge description
* @returns {Array} array of tags
*/
async function getTags (description) {
const data = { text: description, extract_confidence: false}
const type = "emsi/internal_no_refresh"
const url = `${config.TC_API}/contest-tagging/${type}`;
const res = await request
.post(url)
.set('Accept', 'application/json')
.send(querystring.stringify(data))

localLogger.debug({
context: 'getTags',
message: `response body: ${JSON.stringify(res.body)}`,
});
return _.get(res, 'body');
}


/**
* @param {Object} currentUser the user performing the action
* @param {Object} data title of project and any other info
Expand Down Expand Up @@ -1752,6 +1775,7 @@ module.exports = {
getMemberDetailsByHandles,
getMemberDetailsByHandle,
getMemberDetailsByEmails,
getTags,
createProjectMember,
listProjectMembers,
listProjectMemberInvites,
Expand Down
11 changes: 11 additions & 0 deletions src/controllers/TeamController.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ async function getMe(req, res) {
res.send(await service.getMe(req.authUser));
}


/**
* Return skills by job description.
* @param req the request
* @param res the response
*/
async function getSkillsByJobDescription(req, res) {
res.send(await service.getSkillsByJobDescription(req.authUser, req.body));
}

/**
*
* @param req the request
Expand All @@ -127,5 +137,6 @@ module.exports = {
searchInvites,
deleteMember,
getMe,
getSkillsByJobDescription,
createProj,
};
8 changes: 8 additions & 0 deletions src/routes/TeamRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ module.exports = {
scopes: [constants.Scopes.READ_TAAS_TEAM],
},
},
'/taas-teams/getSkillsByJobDescription': {
post: {
controller: 'TeamController',
method: 'getSkillsByJobDescription',
auth: 'jwt',
scopes: [constants.Scopes.READ_TAAS_TEAM],
},
},
'/taas-teams/:id': {
get: {
controller: 'TeamController',
Expand Down
24 changes: 24 additions & 0 deletions src/services/TeamService.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,29 @@ getMe.schema = Joi.object()
})
.required();

/**
* Return skills by job description.
*
* @param {Object} currentUser the user who perform this operation.
* @params {Object} criteria the search criteria
* @returns {Object} the user data for current user
*/
async function getSkillsByJobDescription(currentUser,data) {
return helper.getTags(data.description)
}

getSkillsByJobDescription.schema = Joi.object()
.keys({
currentUser: Joi.object().required(),
data: Joi.object()
.keys({
description: Joi.string().required(),
})
.required(),
})
.required();


/**
* @param {Object} currentUser the user performing the operation.
* @param {Object} data project data
Expand All @@ -695,5 +718,6 @@ module.exports = {
searchInvites,
deleteMember,
getMe,
getSkillsByJobDescription,
createProj,
};