refactor: rename apply_event to apply
This commit is contained in:
@@ -8,8 +8,10 @@ from domain.marketplace.domain_event import DomainEvent
|
||||
class Entity(ABC):
|
||||
_changes: tuple[DomainEvent, ...] = ()
|
||||
|
||||
def apply_event(self, event: DomainEvent) -> Self:
|
||||
return replace(self, _changes=(*self._changes, event))
|
||||
def apply(self, event: DomainEvent) -> Self:
|
||||
result = self.when(event)
|
||||
result._ensure_valid_state()
|
||||
return replace(result, _changes=(*result._changes, event))
|
||||
|
||||
def get_changes(self) -> tuple[DomainEvent, ...]:
|
||||
return self._changes
|
||||
|
||||
Reference in New Issue
Block a user