meteor-space / messaging

Messaging infrastructure for Space applications.
12 stars 2 forks source link

Let messaging define helper return object with defined serializables #41

Closed darko-mijic closed 8 years ago

darko-mijic commented 8 years ago

This makes helper more usable for ES6 module exports:

import Contact from '../value-objects/contact';

const events = Space.messaging.define(Space.domain.Event,  {

  BankAccountOpened: {
    owner: Contact,
    balance: Money
  },

  BankAccountCredited: {
    balance: Money
  }
});

export default BankAccountOpened = events.BankAccountOpened;
export default BankAccountCredited = events.BankAccountCredited;
rhyslbw commented 8 years ago

Also, I'd be suggesting the following implementation:

import Contact from '../value-objects/contact';

export const events = Space.messaging.define(Space.domain.Event,  {

  BankAccountOpened: {
    owner: Contact,
    balance: Money
  },

  BankAccountCredited: {
    balance: Money
  }
});
import { BankAccountOpened, BankAccountCredited } from '../events';

I would only push the export to the bottom if the module was more than a single function call.

rhyslbw commented 8 years ago

The next release of the package will be a feature release, so would be good to include this. Any chance we can wrap this up over the next day or two @darko-mijic ?

darko-mijic commented 8 years ago

@meteor-space/core: Can someone else take this over? I am currently swamped and this should be released as soon as possible. @DominikGuzei?

DominikGuzei commented 8 years ago

@darko-mijic what is missing here? it looks good to merge from my POV?

darko-mijic commented 8 years ago

CS code could be better. Please fix it if there is room for improvement, even though we are moving away from CS we should make it the best we can.

DominikGuzei commented 8 years ago

@darko-mijic and @rhyslbw this is ready for review, i rewrote the helper to ES6 😉

rhyslbw commented 8 years ago

Nice work @DominikGuzei