Skip to content

Instantly share code, notes, and snippets.

@MarcoNicolodi
Last active October 15, 2019 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcoNicolodi/03a166aa49e6999567bdeaa93c7370d6 to your computer and use it in GitHub Desktop.
Save MarcoNicolodi/03a166aa49e6999567bdeaa93c7370d6 to your computer and use it in GitHub Desktop.
Anemic domain model work better for functional style programming;
const acceptProposal => (id, db, bus, logger) => {
const proposal = db.get(id);
proposal.acceptedAt = moment.now();
proposal.status = ACCEPTED;
db.save(proposal);
bus.send({ type: ACCEPTED, payload: proposal.id});
logger.sucess("Proposal accepted");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment