Skip to content

Commit 8043bcd

Browse files
committed
Add job title to RoleSearchRequest service and model.
Update swagger and add migration. Add previousRoleSearchId to RoleSearchRequest service.
1 parent 0eef869 commit 8043bcd

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

docs/swagger.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5249,6 +5249,9 @@ components:
52495249
jobDescription:
52505250
type: string
52515251
description: "The description of the job."
5252+
jobTitle:
5253+
type: string
5254+
description: "An optional job title."
52525255
- type: object
52535256
required:
52545257
- skills
@@ -5281,6 +5284,10 @@ components:
52815284
format: float
52825285
description: "Rate at which searched skills match the given role"
52835286
example: 0.75
5287+
jobTitle:
5288+
type: string
5289+
description: "Optional job title."
5290+
example: "Lead Application Developer"
52845291
SubmitTeamRequestBody:
52855292
properties:
52865293
teamName:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const config = require('config')
2+
3+
/**
4+
* Add jobTitle field to the RoleSearchRequest model.
5+
*/
6+
7+
module.exports = {
8+
up: async (queryInterface, Sequelize) => {
9+
await queryInterface.addColumn({ tableName: 'role_search_requests', schema: config.DB_SCHEMA_NAME }, 'job_title',
10+
{
11+
type: Sequelize.STRING(100),
12+
allowNull: true
13+
})
14+
},
15+
down: async (queryInterface, Sequelize) => {
16+
await queryInterface.removeColumn({ tableName: 'role_search_requests', schema: config.DB_SCHEMA_NAME}, 'job_title')
17+
}
18+
}

src/models/RoleSearchRequest.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ module.exports = (sequelize) => {
6262
type: Sequelize.UUID
6363
})
6464
},
65+
jobTitle: {
66+
field: 'job_title',
67+
type: Sequelize.STRING(100),
68+
allowNull: true
69+
},
6570
createdBy: {
6671
field: 'created_by',
6772
type: Sequelize.UUID,

src/services/TeamService.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -776,11 +776,12 @@ async function roleSearchRequest (currentUser, data) {
776776
}
777777
data.roleId = role.id
778778
// create roleSearchRequest entity with found roleId
779-
const { id: roleSearchRequestId } = await createRoleSearchRequest(currentUser, data)
779+
const { id: roleSearchRequestId, jobTitle } = await createRoleSearchRequest(currentUser, data)
780+
const entity = jobTitle ? { jobTitle, roleSearchRequestId } : { roleSearchRequestId };
780781
// clean Role
781782
role = await _cleanRoleDTO(currentUser, role)
782783
// return Role
783-
return _.assign(role, { roleSearchRequestId })
784+
return _.assign(role, entity)
784785
}
785786

786787
roleSearchRequest.schema = Joi.object()
@@ -789,8 +790,10 @@ roleSearchRequest.schema = Joi.object()
789790
data: Joi.object().keys({
790791
roleId: Joi.string().uuid(),
791792
jobDescription: Joi.string().max(255),
792-
skills: Joi.array().items(Joi.string().uuid().required())
793-
}).required().min(1)
793+
skills: Joi.array().items(Joi.string().uuid().required()),
794+
jobTitle: Joi.string().max(100),
795+
previousRoleSearchRequestId: Joi.string().uuid()
796+
}).required().or('roleId', 'jobDescription', 'skills')
794797
}).required()
795798

796799
/**

0 commit comments

Comments
 (0)