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
4 changes: 2 additions & 2 deletions src/common/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,8 +953,8 @@ async function postEvent (topic, payload, options = {}) {
payload
}
if (options.key) {
message.key = options.key
}
message.key = options.key
}
await client.postEvent(message)
await eventDispatcher.handleEvent(topic, { value: payload, options })
}
Expand Down
4 changes: 2 additions & 2 deletions src/services/WorkPeriodPaymentService.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async function _createSingleWorkPeriodPaymentWithWorkPeriodAndResourceBooking (w
}
}

await helper.postEvent(config.TAAS_WORK_PERIOD_PAYMENT_CREATE_TOPIC, created.toJSON())
await helper.postEvent(config.TAAS_WORK_PERIOD_PAYMENT_CREATE_TOPIC, created.toJSON(), { key: `workPeriodPayment.billingAccountId:${workPeriodPayment.billingAccountId}` })
return created.dataValues
}

Expand Down Expand Up @@ -234,7 +234,7 @@ async function updateWorkPeriodPayment (currentUser, id, data) {
}
}

await helper.postEvent(config.TAAS_WORK_PERIOD_PAYMENT_UPDATE_TOPIC, updated.toJSON(), { oldValue: oldValue })
await helper.postEvent(config.TAAS_WORK_PERIOD_PAYMENT_UPDATE_TOPIC, updated.toJSON(), { oldValue: oldValue, key: `workPeriodPayment.billingAccountId:${updated.billingAccountId}` })
return updated.dataValues
}

Expand Down
10 changes: 5 additions & 5 deletions src/services/WorkPeriodService.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ async function createWorkPeriod (currentUser, workPeriod) {
}
}

await helper.postEvent(config.TAAS_WORK_PERIOD_CREATE_TOPIC, created.toJSON(),{"key":workPeriod.resourceBookingId})
await helper.postEvent(config.TAAS_WORK_PERIOD_CREATE_TOPIC, created.toJSON(), { key: `resourceBooking.id:${workPeriod.resourceBookingId}` })
return created.dataValues
}

Expand Down Expand Up @@ -289,8 +289,8 @@ async function updateWorkPeriod (currentUser, id, data) {
}
}

//await helper.postEvent(config.TAAS_WORK_PERIOD_UPDATE_TOPIC, updated.toJSON(), { oldValue: oldValue })
await helper.postEvent(config.TAAS_WORK_PERIOD_UPDATE_TOPIC, updated.toJSON(), {oldValue: oldValue, "key":data.resourceBookingId})
// await helper.postEvent(config.TAAS_WORK_PERIOD_UPDATE_TOPIC, updated.toJSON(), { oldValue: oldValue })
await helper.postEvent(config.TAAS_WORK_PERIOD_UPDATE_TOPIC, updated.toJSON(), { oldValue: oldValue, key: `resourceBooking.id:${data.resourceBookingId}` })
return updated.dataValues
}

Expand Down Expand Up @@ -364,9 +364,9 @@ async function deleteWorkPeriod (currentUser, id) {
workPeriodId: id
}
})
await Promise.all(workPeriod.payments.map(({ id }) => helper.postEvent(config.TAAS_WORK_PERIOD_PAYMENT_DELETE_TOPIC, { id })))
await Promise.all(workPeriod.payments.map(({ id, billingAccountId }) => helper.postEvent(config.TAAS_WORK_PERIOD_PAYMENT_DELETE_TOPIC, { id }, { key: `workPeriodPayment.billingAccountId:${billingAccountId}` })))
await workPeriod.destroy()
await helper.postEvent(config.TAAS_WORK_PERIOD_DELETE_TOPIC, { id })
await helper.postEvent(config.TAAS_WORK_PERIOD_DELETE_TOPIC, { id }, { key: `resourceBooking.id:${workPeriod.resourceBookingId}` })
}

deleteWorkPeriod.schema = Joi.object().keys({
Expand Down