Hi there,
to evaluate,review and better understanding of the design of event streams, projections and state transitions in a web applications that uses EventStore, I want to try a more complex scenario.
Specs are
-
as a promoter, I want to create a limited ticket pool (e.g. for a live concert) by unique name, a number of available tickets and a price, for sale to customer
-
as a promoter, I want to ticket overbooking rate should tend to 0, to minimize support and user satisfaction
-
as a promoter, I want to cancel/stop all ticket sales during the sale, to react instantly on
-
as a customer, I want to buy one or more (max 4 pieces) available tickets, to attend the event
-
as a customer, I want to show the current number of sold and available tickets in the sale process like shopping cart, to show demand transparent with no customer disappointment
nice to have for sales and marketing
-
the price rises gradually by sold percentage
-
the price drops gradually by time span in relationship to event date/time
-
instantly changing the gradually during sales process by promoter
my first considerations
-
implement the specs (behavior and state) into an aggregate that manage business rules and their state consistency
-
dehydrate the current state of aggregate by calling his methods from event stream by using client side projection framework and eventType pattern matching
-
post a “claimed” event for each valid customer demand, one per ticket
-
post a “bought” event for each valid customer purchase, one per ticket
my second considerations
-
create an view model instance (that only hold state) per promoter ticket sale process and dehydrate the current state from event stream by using client side projection framework
-
increment and decrement the available ticket states in view model for current sales process by eventType pattern matching and easy peasy calculations
my lack of understanding
both, aggregate and view model, will update in period by the projection implementation by ajax polling requests?
how handle expected version conflicts? throw?
how handle business rule conflicts, e.g. no more tickets as X available, within commands / commandhandlers? throw?
how move javascript projections closer to eventstore and how “transfer” aggregated state by projections in this case?
how … did not think about anything to end - more questions can follow
Can I make it easier e.g. my view is my view model?
cheers, Mike