Skip to content

Commit 509adf8

Browse files
Merge pull request #322 from yoution/hotfix/job-status2
fix: issue #316
2 parents 425e62f + 0ec2d7f commit 509adf8

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

src/eventHandlers/JobCandidateEventHandler.js

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,25 @@ async function inReviewJob (payload) {
2323
})
2424
return
2525
}
26-
await JobService.partiallyUpdateJob(
27-
helper.getAuditM2Muser(),
28-
job.id,
29-
{ status: 'in-review' }
30-
).then(result => {
31-
logger.info({
26+
if (payload.value.status === 'open') {
27+
await JobService.partiallyUpdateJob(
28+
helper.getAuditM2Muser(),
29+
job.id,
30+
{ status: 'in-review' }
31+
).then(result => {
32+
logger.info({
33+
component: 'JobCandidateEventHandler',
34+
context: 'inReviewJob',
35+
message: `id: ${result.id} job got in-review status.`
36+
})
37+
})
38+
} else {
39+
logger.debug({
3240
component: 'JobCandidateEventHandler',
3341
context: 'inReviewJob',
34-
message: `id: ${result.id} job got in-review status.`
42+
message: `id: ${payload.value.id} candidate is not in open status`
3543
})
36-
})
44+
}
3745
}
3846

3947
/**
@@ -46,6 +54,17 @@ async function processCreate (payload) {
4654
await inReviewJob(payload)
4755
}
4856

57+
/**
58+
* Process job candidate update event.
59+
*
60+
* @param {Object} payload the event payload
61+
* @returns {undefined}
62+
*/
63+
async function processUpdate (payload) {
64+
await inReviewJob(payload)
65+
}
66+
4967
module.exports = {
50-
processCreate
68+
processCreate,
69+
processUpdate
5170
}

src/eventHandlers/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const logger = require('../common/logger')
1414
const TopicOperationMapping = {
1515
[config.TAAS_JOB_UPDATE_TOPIC]: JobEventHandler.processUpdate,
1616
[config.TAAS_JOB_CANDIDATE_CREATE_TOPIC]: JobCandidateEventHandler.processCreate,
17+
[config.TAAS_JOB_CANDIDATE_UPDATE_TOPIC]: JobCandidateEventHandler.processUpdate,
1718
[config.TAAS_RESOURCE_BOOKING_CREATE_TOPIC]: ResourceBookingEventHandler.processCreate,
1819
[config.TAAS_RESOURCE_BOOKING_UPDATE_TOPIC]: ResourceBookingEventHandler.processUpdate,
1920
[config.TAAS_RESOURCE_BOOKING_DELETE_TOPIC]: ResourceBookingEventHandler.processDelete,

0 commit comments

Comments
 (0)