Code Monkey home page Code Monkey logo

Comments (16)

adrai avatar adrai commented on May 26, 2024

The important part is to manipulate the aggregate only in the event handling part.
But it's ok to calculate it this way and write the result in the event... shouldn't be a problem.

from node-cqrs-domain.

sbiaudet avatar sbiaudet commented on May 26, 2024

Yes I'm agree with you it should work but it doesn't work.

In the invoiceLineAdded event I push my line into the array "lines" and I read it in the function updateTotal. But this code is not sync, I pass in updateTotal before invoiceLineAddedEvent. So I've always a wrong value in my total.

from node-cqrs-domain.

adrai avatar adrai commented on May 26, 2024

Can you make a gist or paste all relevant parts (cmdHandle, evtHandle, etc...)?

from node-cqrs-domain.

sbiaudet avatar sbiaudet commented on May 26, 2024

You've got it here https://gist.github.com/sbiaudet/253e9f53b3ac76235d35

from node-cqrs-domain.

adrai avatar adrai commented on May 26, 2024

Why has calculateTotal to be async?

from node-cqrs-domain.

sbiaudet avatar sbiaudet commented on May 26, 2024

You talk about async.parallel ? this code could be different and better, but it's not the problem here. I'v added some comments with number to explicit the exec order.

from node-cqrs-domain.

adrai avatar adrai commented on May 26, 2024

are the number the desired exec order? what is the current exec order?

from node-cqrs-domain.

sbiaudet avatar sbiaudet commented on May 26, 2024

It’s the current order.

from node-cqrs-domain.

adrai avatar adrai commented on May 26, 2024

and how it's the desired exec order?

from node-cqrs-domain.

sbiaudet avatar sbiaudet commented on May 26, 2024

I put it the desired order.

Le 27 oct. 2014 à 13:51, Adriano Raiano [email protected] a écrit :

and how it's the desired exec order?


Reply to this email directly or view it on GitHub #27 (comment).

from node-cqrs-domain.

adrai avatar adrai commented on May 26, 2024

ok, the problem is that the apply function in the command part will just define a new event but it will apply all events after the command handle part... https://github.com/adrai/node-cqrs-domain/blob/master/lib/definitions/aggregate.js#L498

from node-cqrs-domain.

sbiaudet avatar sbiaudet commented on May 26, 2024

Yes I see this code. I've make some test before wrote this post. Have you got an elegant solution ? How do you manage aggregate root in you project ? Is it better to send all children entities in one command (lineChanged for ex) or have one command per action ?
I'd like to have your expertise to have an elegant code .

from node-cqrs-domain.

adrai avatar adrai commented on May 26, 2024

I have an idea... wait a moment....

from node-cqrs-domain.

adrai avatar adrai commented on May 26, 2024

Can you try the master?

from node-cqrs-domain.

sbiaudet avatar sbiaudet commented on May 26, 2024

Yes !!! it's work fine. All unit tests passed.

thank's

from node-cqrs-domain.

adrai avatar adrai commented on May 26, 2024

ok... will release... in a sec

from node-cqrs-domain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.