from eventsourcing.domain.model.aggregate import AggregateRoot
[docs]class Command(AggregateRoot):
[docs] def __init__(self, **kwargs):
super(Command, self).__init__(**kwargs)
self._is_done = False
[docs] class Event(AggregateRoot.Event):
pass
[docs] class Created(Event, AggregateRoot.Created):
pass
[docs] class AttributeChanged(Event, AggregateRoot.AttributeChanged):
pass
[docs] class Discarded(Event, AggregateRoot.Discarded):
pass
@property
def is_done(self):
return self._is_done
[docs] def done(self):
self.__trigger_event__(self.Done)
[docs] class Done(Event):
[docs] def mutate(self, obj):
obj._is_done = True