I have been working on a cqrs + es project and I would like to discuss (get help designing) possible approaches to implementation of a specific area.
Some of the requirements are (and this seen by a user - and UI - point of view):
- Create a batch of tickets - a user provides a few details common to all tickets and then each ticket gets a unique identifier and those details common to all.
- A (non cancelled) ticket (created and belonging to a batch) can be cancelled
- A (non used ticket) can be used (marked as used and set to a buyer)
- All (non-cancelled) tickets belonging to a batch can be cancelled in one go
I am confused about the best way to go about this
So, user could send a GenerateTicketsCommand { qty: 300, issueDate: “10/05/2017”, expiryDate:“10/09/2017"}
Now, what I am struggling with is about Aggregate Roots.
Would I have a TicketsBatchAggregateRoot and TicketAggregateRoot? And some how (process manager), initial GenerateTicketsCommand (via a TicketsBatchGeneratedEvent) would end up triggering 300 GenerateTicketCommand {Id:“Guid”, ExpiryDate: “10/09/2017", issueDate:“10/05/2017”, BatchId: “BatchId”}?
Any pointers would be greatly appreciated - I understand there are a lot of it depends, and so I am happy to answer any questions, of course.
Thanks in advance.
G