cqrs icon indicating copy to clipboard operation
cqrs copied to clipboard

Better docs in code?

Open sarendipitee opened this issue 4 years ago • 3 comments


[ ] Regression 
[ ] Bug report
[x] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

This is a great library, but it is very sparse on inline comments in the code. The tutorial/docs page does a decent job introducing the library, but we're desperately missing some comments on particular methods. For example, literally the only bit on AggregrateRoot is

In order to dispatch events, models have to extend the AggregateRoot class.

Ok, but what do methods like commit(), uncommit(), loadFromHistory() do?

Adding a couple jsdoc style comments above comments and methods would be very nice (not to mention being able to reference the docs in editor's autocomplete!)

So just opening up this issue to see what other's thoughts are.

sarendipitee avatar Mar 13 '21 05:03 sarendipitee

The flow is very complex to follow, it took me days to understand CQRS and even more to understand how its implemented in nest and where the differences are

https://github.com/nestjs/cqrs/blob/master/src/aggregate-root.ts#L48

So only loadFromHistory or the Aggregate itself call apply to execute the handler

https://github.com/kamilmysliwiec/nest-cqrs-example/blob/ed3f3be9cb1dd00369abf5d1198061e00d9633dc/src/heroes/models/hero.model.ts#L10-L13

Apply is called, handler is invoked (command)

RobertLowe avatar Jan 03 '22 16:01 RobertLowe

so far i've been reading info on cqrs for more than a month and the nestJS implementation is ridiculously complex...

alilland avatar Mar 04 '22 04:03 alilland

@alilland yes it is it took me a couple of days to understand,, have a look at greg young's implementation: https://github.com/gregoryyoung/m-r/tree/master/SimpleCQRS

RobertLowe avatar Mar 04 '22 14:03 RobertLowe

simple to follow, but you only have a 1 sentence mention... I'd love docs on how to use, what it does, and perhaps whether there can be further integration with other frameworks...

xenoterracide avatar Oct 31 '22 15:10 xenoterracide