This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree 5 files changed +14
-9
lines changed 5 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ Configuration for the application is at config/default.js and config/production.
35
35
- UBAHN_CREATE_TOPIC: Kafka topic for create message
36
36
- UBAHN_UPDATE_TOPIC: Kafka topic for update message
37
37
- 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)
38
39
- ES.HOST: Elasticsearch host
39
40
- ES.API_VERSION: Elasticsearch API version
40
41
- ES.DOCUMENTS: Elasticsearch index, type and id mapping for resources.
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ module.exports = {
36
36
UBAHN_CREATE_TOPIC : process . env . UBAHN_CREATE_TOPIC || 'u-bahn.action.create' ,
37
37
UBAHN_UPDATE_TOPIC : process . env . UBAHN_UPDATE_TOPIC || 'u-bahn.action.update' ,
38
38
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' ,
39
40
40
41
EMSI : {
41
42
CLIENT_ID : process . env . EMSI_CLIENT_ID ,
Original file line number Diff line number Diff line change @@ -11,15 +11,12 @@ const {
11
11
12
12
async function cleanupES ( ) {
13
13
const client = getESClient ( )
14
- client . indices . delete ( {
14
+
15
+ await client . indices . delete ( {
15
16
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
- }
22
17
} )
18
+
19
+ console . log ( 'Existing indices have been deleted!' )
23
20
}
24
21
25
22
async function insertIntoES ( modelName , body ) {
Original file line number Diff line number Diff line change @@ -246,6 +246,12 @@ async function postEvent (topic, payload) {
246
246
payload
247
247
}
248
248
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 )
249
255
}
250
256
251
257
module . exports = {
Original file line number Diff line number Diff line change @@ -12,15 +12,15 @@ const methods = helper.getServiceMethods(
12
12
achievementsProviderId : joi . string ( ) . required ( ) ,
13
13
name : joi . string ( ) . required ( ) ,
14
14
uri : joi . string ( ) ,
15
- certifierId : joi . string ( ) ,
15
+ certifierId : joi . string ( ) . allow ( '' ) ,
16
16
certifiedDate : joi . date ( ) . format ( 'iso' )
17
17
} ,
18
18
{ // patch request body joi schema
19
19
userId : joi . string ( ) . required ( ) ,
20
20
achievementsProviderId : joi . string ( ) . required ( ) ,
21
21
name : joi . string ( ) ,
22
22
uri : joi . string ( ) ,
23
- certifierId : joi . string ( ) ,
23
+ certifierId : joi . string ( ) . allow ( '' ) ,
24
24
certifiedDate : joi . date ( ) . format ( 'iso' )
25
25
} ,
26
26
{ // search request query joi schema
You can’t perform that action at this time.
0 commit comments