9. copyright Fringe81 Co.,Ltd.
It is not possible to create an optimal solution
for searching,reporting,and processing transactions
utilizing a single model.
-CQRS documents by Greg Young-
96. copyright Fringe81 Co.,Ltd.
sealed trait LotteryCommand
case object CreateLottery extends LotteryCommand
case class AddParticipant(name:String) extends LotteryCommand
case class RemoveParticipant(name:String) extends LotteryCommand
case object Run extends LotteryCommand
sealed trait LotteryEvent {
def lotteryId: LotteryId
}
case class LotteryCreated(lotteryId: LotteryId) extends LotteryEvent
sealed trait LotteryUpdateEvent extends LotteryEvent
case class ParticipantAdded(name: String, raffleId: LotteryId) extends LotteryUpdateEvent
case class ParticipantRemoved(name: String, raffleId: LotteryId) extends LotteryUpdateEvent
case class WinnerSelected(winner:String,date:OffsetDateTime,lotteryId:LotteryId) extends LotteryUpdateEvent
<CommandとEvent>