diff --git a/data/demo-data.json b/data/demo-data.json index 59b2ba50..aad3fbe7 100644 --- a/data/demo-data.json +++ b/data/demo-data.json @@ -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": [ { @@ -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": [ { @@ -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": [ { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 6ffdf86d..26b389f4 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -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 @@ -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: diff --git a/migrations/2021-06-22-role-search-request-add-job-title.js b/migrations/2021-06-22-role-search-request-add-job-title.js new file mode 100644 index 00000000..c1df8fba --- /dev/null +++ b/migrations/2021-06-22-role-search-request-add-job-title.js @@ -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') + } +} \ No newline at end of file diff --git a/src/models/RoleSearchRequest.js b/src/models/RoleSearchRequest.js index 384b74d0..c79ae84f 100644 --- a/src/models/RoleSearchRequest.js +++ b/src/models/RoleSearchRequest.js @@ -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, diff --git a/src/services/TeamService.js b/src/services/TeamService.js index 99a23888..717bf396 100644 --- a/src/services/TeamService.js +++ b/src/services/TeamService.js @@ -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') @@ -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() @@ -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() /**