I am having some trouble placing a custom repository wiich would store data in a relational database which for the purposes of my system I have to keep updated the same way that I want to maintain the "mongo" repository updated, the best place for it to be set should be at the viewBuilder, using the callback?
Something like that?
module.exports = require('cqrs-eventdenormalizer').defineViewBuilder({
name: 'itemCreated',
id: 'payload.id'
}, function (data, vm, callback) {
// assync logic to record data elsewhere
//updating mongo database
vm.set(data);
recordOnRelationalDatabase(data).then(function (recordedData) {
//...
return callback();
}),catch(function(err) {
callback(err)
});
});