Skip to content
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
37 changes: 28 additions & 9 deletions src/eventHandlers/JobCandidateEventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,25 @@ async function inReviewJob (payload) {
})
return
}
await JobService.partiallyUpdateJob(
helper.getAuditM2Muser(),
job.id,
{ status: 'in-review' }
).then(result => {
logger.info({
if (payload.value.status === 'open') {
await JobService.partiallyUpdateJob(
helper.getAuditM2Muser(),
job.id,
{ status: 'in-review' }
).then(result => {
logger.info({
component: 'JobCandidateEventHandler',
context: 'inReviewJob',
message: `id: ${result.id} job got in-review status.`
})
})
} else {
logger.debug({
component: 'JobCandidateEventHandler',
context: 'inReviewJob',
message: `id: ${result.id} job got in-review status.`
message: `id: ${payload.value.id} candidate is not in open status`
})
})
}
}

/**
Expand All @@ -46,6 +54,17 @@ async function processCreate (payload) {
await inReviewJob(payload)
}

/**
* Process job candidate update event.
*
* @param {Object} payload the event payload
* @returns {undefined}
*/
async function processUpdate (payload) {
await inReviewJob(payload)
}

module.exports = {
processCreate
processCreate,
processUpdate
}
1 change: 1 addition & 0 deletions src/eventHandlers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const logger = require('../common/logger')
const TopicOperationMapping = {
[config.TAAS_JOB_UPDATE_TOPIC]: JobEventHandler.processUpdate,
[config.TAAS_JOB_CANDIDATE_CREATE_TOPIC]: JobCandidateEventHandler.processCreate,
[config.TAAS_JOB_CANDIDATE_UPDATE_TOPIC]: JobCandidateEventHandler.processUpdate,
[config.TAAS_RESOURCE_BOOKING_CREATE_TOPIC]: ResourceBookingEventHandler.processCreate,
[config.TAAS_RESOURCE_BOOKING_UPDATE_TOPIC]: ResourceBookingEventHandler.processUpdate,
[config.TAAS_RESOURCE_BOOKING_DELETE_TOPIC]: ResourceBookingEventHandler.processDelete,
Expand Down