Closed TomKaltz closed 8 years ago
Ah. I did some experimentation and found that get
is not a function on the returned collection but is part of the repository
object of the collection. I've updated the example from #5 below...
module.exports = require('cqrs-eventdenormalizer').defineViewBuilder({
name: 'enteredNewPerson',
aggregate: 'person',
context: 'hr',
version: 2,
id: 'aggregate.id',
payload: 'payload'
}, function (data, vm, callback) {
vm.set('firstname', data.firstname);
vm.set('lastname', data.lastname);
var portfolioCol = require('../portfolio/collection');
portfolioCol.repository.get(evt.payload.portfolioId, function (err, portfolio) {
//error handling
//vm.set...
//vm.set...
callback(null);
});
});
@adrai can you please confirm I'm on the right track?
Try:
portfolioCol.loadViewModel(...
Il giorno 2-lug-2015, alle ore 23:27, Thomas Kaltz III notifications@github.com<mailto:notifications@github.com> ha scritto:
Ah. I did some experimentation and found that get is not a function on the returned collection but is part of the repository object of the collection. I've updated the example from #5https://github.com/adrai/node-cqrs-eventdenormalizer/issues/5 below...
module.exports = require('cqrs-eventdenormalizer').defineViewBuilder({ name: 'enteredNewPerson', aggregate: 'person', context: 'hr', version: 2, id: 'aggregate.id', payload: 'payload' }, function (data, vm, callback) { vm.set('firstname', data.firstname); vm.set('lastname', data.lastname);
var portfolioCol = require('../portfolio/collection'); portfolioCol.repository.get(evt.payload.portfolioId, function (err, portfolio) { //error handling //vm.set... //vm.set... callback(null); }); });
@adraihttps://github.com/adrai can you please confirm I'm on the right track?
Reply to this email directly or view it on GitHubhttps://github.com/adrai/node-cqrs-eventdenormalizer/issues/20#issuecomment-118176080.
Yes, see: https://github.com/adrai/node-cqrs-eventdenormalizer/issues/5