Skip to content

Instantly share code, notes, and snippets.

@sorenmalling
Last active May 3, 2017 09:17
Show Gist options
  • Select an option

  • Save sorenmalling/aafedd17c519d7fe349cbb12c9d6a7ab to your computer and use it in GitHub Desktop.

Select an option

Save sorenmalling/aafedd17c519d7fe349cbb12c9d6a7ab to your computer and use it in GitHub Desktop.
First draft of rule configuration
{
"event": {
"type": "UserHasSignedUp"
},
"conditions": [{
"type": "DateRange",
"parameters": {
"startDateAndTime": "01/12/2017",
"endDateAndTime": "21/12/2017"
}
}],
"actions": [{
"type": "SendDiscoutCodeEmail",
"parameters": {
"email": "{event.parameters.email}"
}
}]
}
@sorenmalling

Copy link
Copy Markdown
Author
  • A event must implement a given interface
  • Each condition is a Validator that implements the ValidatorInterface
  • A action must implement a action (command?) interface

This is translatable into a Object structure based upon the ruler/ruler package and possible to be compiled into a user interface.

The format above is considered the persisted data

@bwaidelich

bwaidelich commented May 2, 2017

Copy link
Copy Markdown

@sorenmalling Nice one. Just two (more or less random comments):

  1. JSON is probably fine as serialization format, but it should be validated somehow (e.g. you have a typo above that would only be detected during runtime otherwise - if at all)
  2. Condition != Validation. I wouldn't mix up the two and introduce a new ConditionInterface instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment