Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit cd1e58b

Browse files
Merge pull request #43 from topcoder-platform/develop
Sync master with develop
2 parents a1596b6 + fce1c63 commit cd1e58b

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Configuration for the application is at config/default.js and config/production.
3535
- UBAHN_CREATE_TOPIC: Kafka topic for create message
3636
- UBAHN_UPDATE_TOPIC: Kafka topic for update message
3737
- UBAHN_DELETE_TOPIC: Kafka topic for delete message
38+
- UBAHN_AGGREGATE_TOPIC: Kafka topic that is used to combine all create, update and delete message(s)
3839
- ES.HOST: Elasticsearch host
3940
- ES.API_VERSION: Elasticsearch API version
4041
- ES.DOCUMENTS: Elasticsearch index, type and id mapping for resources.

config/default.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module.exports = {
3636
UBAHN_CREATE_TOPIC: process.env.UBAHN_CREATE_TOPIC || 'u-bahn.action.create',
3737
UBAHN_UPDATE_TOPIC: process.env.UBAHN_UPDATE_TOPIC || 'u-bahn.action.update',
3838
UBAHN_DELETE_TOPIC: process.env.UBAHN_DELETE_TOPIC || 'u-bahn.action.delete',
39+
UBAHN_AGGREGATE_TOPIC: process.env.UBAHN_AGGREGATE_TOPIC || 'u-bahn.action.aggregate',
3940

4041
EMSI: {
4142
CLIENT_ID: process.env.EMSI_CLIENT_ID,

scripts/db/dumpDbToEs.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ const {
1111

1212
async function cleanupES () {
1313
const client = getESClient()
14-
client.indices.delete({
14+
15+
await client.indices.delete({
1516
index: '_all'
16-
}, function (err, res) {
17-
if (err) {
18-
console.error(err.message)
19-
} else {
20-
console.log('Existing indices have been deleted!')
21-
}
2217
})
18+
19+
console.log('Existing indices have been deleted!')
2320
}
2421

2522
async function insertIntoES (modelName, body) {

src/common/helper.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ async function postEvent (topic, payload) {
246246
payload
247247
}
248248
await busApiClient.postEvent(message)
249+
250+
// Post to the aggregate topic
251+
message.payload.originalTopic = topic
252+
message.topic = config.UBAHN_AGGREGATE_TOPIC
253+
logger.debug(`Posting event to aggregate topic ${message.topic}`)
254+
await busApiClient.postEvent(message)
249255
}
250256

251257
module.exports = {

src/modules/achievement/service.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ const methods = helper.getServiceMethods(
1212
achievementsProviderId: joi.string().required(),
1313
name: joi.string().required(),
1414
uri: joi.string(),
15-
certifierId: joi.string(),
15+
certifierId: joi.string().allow(''),
1616
certifiedDate: joi.date().format('iso')
1717
},
1818
{ // patch request body joi schema
1919
userId: joi.string().required(),
2020
achievementsProviderId: joi.string().required(),
2121
name: joi.string(),
2222
uri: joi.string(),
23-
certifierId: joi.string(),
23+
certifierId: joi.string().allow(''),
2424
certifiedDate: joi.date().format('iso')
2525
},
2626
{ // search request query joi schema

0 commit comments

Comments
 (0)