thenativeweb / node-cqrs-domain

Node-cqrs-domain is a node.js module based on nodeEventStore that. It can be very useful as domain component if you work with (d)ddd, cqrs, eventdenormalizer, host, etc.
http://cqrs.js.org/pages/domain.html
MIT License
269 stars 57 forks source link

Correctly resolve revision number for some commands #92

Closed gabriella-bankova closed 7 years ago

gabriella-bankova commented 7 years ago

Set aggregate and context names correctly in var streamInfo when they are not defined in command. Otherwise may not resolve revision number correctly.

adrai commented 7 years ago

Is this change really solving your issue? Can you provide a test?

gabriella-bankova commented 7 years ago

Yes, it does solve an issue for commands that have no aggregate or context specified. After applying this, it correctly finds the aggregate revision number from the store:

screen shot 2017-06-08 at 2 49 27 pm

Before it would always set it to '1':

screen shot 2017-06-08 at 2 53 17 pm

I saw that you had considered adding this before directly in the var streamInfo and it seems to be the only was to resolve my problem.

nanov commented 7 years ago

Well, otherwise you have to explicitly specify aggregate name in each command you dispatch. In a scenario in which you want the revision number from the stream info and not from the command it is extremely helpful.