Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Proposed new features for the next version of EML (0.2-alpha) #8

Open
robertreppel opened this issue Apr 14, 2018 · 0 comments
Open

Comments

@robertreppel
Copy link
Contributor

robertreppel commented Apr 14, 2018

Proposed new features:

  • Preconditions for commands, e.g. TimesheetCreated MustHaveHappened or TimesheetDeleted MustNotHaveHappened DONE
  • Selecting individual event properties in Readmodel SubscribesTo
  • Spreadsheet-like functionality for Readmodels, e.g. @SUM(TimesheetHoursLogged.hours).totalHours

Example:

Solution: Timesheets & Billing
EmlVersion: 0.2-alpha
Contexts:
- Name: Timesheets & Billing
  Streams:
  - Stream: User
    Commands:
    - Command:
        ID: RegisterUser
        Name: Register User
        Parameters:
        - Name: email
          Type: string
          Rules: []
        - Name: password
          Type: string
          Rules: []
        - Name: userId
          Type: string
          Rules:
          - IsRequired
        Postconditions:
        - UserRegistered
    Events:
    - Event:
        ID: UserRegistered
        Name: User Registered
        Properties:
        - Name: email
          Type: string
          IsHashed: false
        - Name: password
          Type: string
          IsHashed: true
        - Name: userId
          Type: string
          IsHashed: false
        Type: ""
  - Stream: Timesheet
    Commands:
    - Command:
        ID: CreateTimesheet
        Name: Create Timesheet
        Parameters:
        - Name: userId
          Type: string
          Rules:
          - MustExistIn UserLookup
        - Name: description
          Type: string
          Rules: []
        - Name: timesheetId
          Type: string
          Rules:
          - IsRequired
        Preconditions:
        - Not TimesheetCreated
        - LastEventIs Not TimesheetSubmitted
        Postconditions:
        - TimesheetCreated
    - Command:
        ID: SubmitTimesheet
        Name: Submit Timesheet
        Parameters:
        - Name: submissionDate
          Type: string
          Rules: []
        - Name: userId
          Type: string
          Rules:
          - MustExistIn UserLookup
        - Name: timesheetId
          Type: string
          Rules:
          - IsRequired
        Preconditioins:
        - Has TimesheetCreated
        - Not Has TimesheetSubmitted
        Postconditions:
        - TimesheetSubmitted
    Events:
    - Event:
        ID: TimesheetCreated
        Name: Timesheet Created
        Properties:
        - Name: userId
          Type: string
          IsHashed: false
        - Name: description
          Type: string
          IsHashed: false
        - Name: timesheetId
          Type: string
          IsHashed: false
        Type: ""
    - Event:
        ID: TimesheetSubmitted
        Name: Timesheet Submitted
        Properties:
        - Name: timesheetId
          Type: string
          IsHashed: false
        - Name: submissionDate
          Type: string
          IsHashed: false
        - Name: userId
          Type: string
          IsHashed: false
        Type: ""
  - Stream: TimesheetHours
    Commands:
    - Command:
        ID: LogHours
        Name: Log Hours
        Parameters:
        - Name: timesheethoursId
          Type: string
          Rules:
          - IsRequired
        - Name: timesheetId
          Type: string
          Rules:
          - MustExistIn TimesheetLookup
        - Name: date
          Type: string
          Rules: []
        - Name: hours
          Type: string
          Rules: []
        Postconditions:
        - TimesheetHoursLogged
    Events:
    - Event:
        ID: TimesheetHoursLogged
        Name: TimesheetHours Logged
        Properties:
        - Name: timesheethoursId
          Type: string
          IsHashed: false
        - Name: timesheetId
          Type: string
          IsHashed: false
        - Name: date
          Type: string
          IsHashed: false
        - Name: hours
          Type: string
          IsHashed: false
        Type: ""
  Readmodels:
  - Readmodel:
      ID: UserLookup
      Name: UserLookup
      Key: userId
      Columns:
      - UserRegistered.*
  - Readmodel:
      ID: TimesheetLookup
      Name: TimesheetLookup
      Key: timesheetId
      SubscribesTo:
      - TimesheetCreated.*
      - TimesheetSubmitted.submissionDate
      - @SUM(TimesheetHoursLogged.hours).totalHours
      - @MIN(TimesheetHoursLogged.date).fromDate
      - @MAX(TimesheetHoursLogged.date).toDate
      - @IF(@ISBLANK(TimesheetSubmitted.submissionDate),"","submitted on {{TimesheetSubmitted.submissionDate}}")
  - Readmodel:
      ID: TimesheetHoursLookup
      Name: TimesheetHoursLookup
      Key: timesheethoursId
      Columns:
      - TimesheetHoursLogged.*
Errors: []
@robertreppel robertreppel changed the title Proposed new features for the next version of EML (0.2-alpha) - Request For Comment Proposed new features for the next version of EML (0.2-alpha) Apr 14, 2018
@robertreppel robertreppel changed the title Proposed new features for the next version of EML (0.2-alpha) RFC: Proposed new features for the next version of EML (0.2-alpha) Apr 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant