Skip to content

Roles finalfix #377

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 5 commits into from
Jun 23, 2021
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
22 changes: 11 additions & 11 deletions data/demo-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7646,10 +7646,10 @@
"name": "Angular Developer",
"description": "* Writes tested and documented JavaScript, HTML and CSS\n* Makes design and technical decisions for AngularJS projects\n* Develops application code and unit test in the AngularJS, Rest Web Services and Java technologies",
"listOfSkills": [
"database",
"winforms",
"user interface (ui)",
"photoshop"
"Database",
"Winforms",
"User Interface (Ui)",
"Photoshop"
],
"rates": [
{
Expand Down Expand Up @@ -7678,10 +7678,10 @@
"name": "Dev Ops Engineer",
"description": "* Introduces processes, tools, and methodologies\n* Balances needs throughout the software development life cycle\n* Configures server images, optimizes task performance in correspondence with engineers",
"listOfSkills": [
"dropwizard",
"nginx",
"machine learning",
"force.com"
"Dropwizard",
"NGINX",
"Machine Learning",
"Force.com"
],
"rates": [
{
Expand Down Expand Up @@ -7722,10 +7722,10 @@
"name": "Salesforce Developer",
"description": "* Meets with project managers to determine CRM needs\n* Develops customized solutions within the Salesforce platform\n* Designs, codes, and implements Salesforce applications\n* Creates timelines and development goals\n* Tests the stability and functionality of the application\n* Troubleshoots and fixes bugs\n* Writes documents and provides technical training for Salesforce Staff\n* Maintains the security and integrity of the application software",
"listOfSkills": [
"docker",
".net",
"Docker",
".NET",
"appcelerator",
"flux"
"Flux"
],
"rates": [
{
Expand Down
7 changes: 7 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5249,6 +5249,9 @@ components:
jobDescription:
type: string
description: "The description of the job."
jobTitle:
type: string
description: "An optional job title."
- type: object
required:
- skills
Expand Down Expand Up @@ -5281,6 +5284,10 @@ components:
format: float
description: "Rate at which searched skills match the given role"
example: 0.75
jobTitle:
type: string
description: "Optional job title."
example: "Lead Application Developer"
SubmitTeamRequestBody:
properties:
teamName:
Expand Down
18 changes: 18 additions & 0 deletions migrations/2021-06-22-role-search-request-add-job-title.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const config = require('config')

/**
* Add jobTitle field to the RoleSearchRequest model.
*/

module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.addColumn({ tableName: 'role_search_requests', schema: config.DB_SCHEMA_NAME }, 'job_title',
{
type: Sequelize.STRING(100),
allowNull: true
})
},
down: async (queryInterface, Sequelize) => {
await queryInterface.removeColumn({ tableName: 'role_search_requests', schema: config.DB_SCHEMA_NAME}, 'job_title')
}
}
5 changes: 5 additions & 0 deletions src/models/RoleSearchRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ module.exports = (sequelize) => {
type: Sequelize.UUID
})
},
jobTitle: {
field: 'job_title',
type: Sequelize.STRING(100),
allowNull: true
},
createdBy: {
field: 'created_by',
type: Sequelize.UUID,
Expand Down
13 changes: 8 additions & 5 deletions src/services/TeamService.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const errors = require('../common/errors')
const JobService = require('./JobService')
const ResourceBookingService = require('./ResourceBookingService')
const HttpStatus = require('http-status-codes')
const { Op } = require('sequelize')
const { Op, where, fn, col } = require('sequelize')
const models = require('../models')
const stopWords = require('../../data/stopWords.json')
const { getAuditM2Muser } = require('../common/helper')
Expand Down Expand Up @@ -776,11 +776,12 @@ async function roleSearchRequest (currentUser, data) {
}
data.roleId = role.id
// create roleSearchRequest entity with found roleId
const { id: roleSearchRequestId } = await createRoleSearchRequest(currentUser, data)
const { id: roleSearchRequestId, jobTitle } = await createRoleSearchRequest(currentUser, data)
const entity = jobTitle ? { jobTitle, roleSearchRequestId } : { roleSearchRequestId };
// clean Role
role = await _cleanRoleDTO(currentUser, role)
// return Role
return _.assign(role, { roleSearchRequestId })
return _.assign(role, entity)
}

roleSearchRequest.schema = Joi.object()
Expand All @@ -789,8 +790,10 @@ roleSearchRequest.schema = Joi.object()
data: Joi.object().keys({
roleId: Joi.string().uuid(),
jobDescription: Joi.string().max(255),
skills: Joi.array().items(Joi.string().uuid().required())
}).required().min(1)
skills: Joi.array().items(Joi.string().uuid().required()),
jobTitle: Joi.string().max(100),
previousRoleSearchRequestId: Joi.string().uuid()
}).required().or('roleId', 'jobDescription', 'skills')
}).required()

/**
Expand Down