This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ module.exports = {
35
35
KAFKA_MESSAGE_ORIGINATOR : process . env . KAFKA_MESSAGE_ORIGINATOR || 'u-bahn-api' ,
36
36
37
37
// topics
38
+ UBAHN_CREATE_USER_TOPIC : process . env . UBAHN_CREATE_TOPIC || 'user.action.topic.create' ,
38
39
UBAHN_CREATE_TOPIC : process . env . UBAHN_CREATE_TOPIC || 'u-bahn.action.create' ,
39
40
UBAHN_UPDATE_TOPIC : process . env . UBAHN_UPDATE_TOPIC || 'u-bahn.action.update' ,
40
41
UBAHN_DELETE_TOPIC : process . env . UBAHN_DELETE_TOPIC || 'u-bahn.action.delete' ,
Original file line number Diff line number Diff line change 4
4
5
5
const joi = require ( '@hapi/joi' )
6
6
const _ = require ( 'lodash' )
7
+ const config = require ( 'config' )
7
8
8
9
const errors = require ( '../../common/errors' )
10
+ const logger = require ( '../../common/logger' )
9
11
const helper = require ( '../../common/helper' )
10
12
const dbHelper = require ( '../../common/db-helper' )
11
13
const serviceHelper = require ( '../../common/service-helper' )
@@ -33,7 +35,11 @@ async function create (entity, auth) {
33
35
const result = await sequelize . transaction ( async ( t ) => {
34
36
const userEntity = await dbHelper . create ( User , entity , auth , t )
35
37
await serviceHelper . createRecordInEs ( resource , userEntity . dataValues , true )
36
- return userEntity
38
+ try {
39
+ await helper . postEvent ( config . UBAHN_CREATE_USER_TOPIC , userEntity . dataValues )
40
+ } catch ( err ) {
41
+ logger . logFullError ( err )
42
+ }
37
43
} )
38
44
39
45
return result
You can’t perform that action at this time.
0 commit comments