Skip to content

Create a custom repository to store data into a relational database #57

@Heucles

Description

@Heucles

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)
  });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions