refactor: rename raise_event to apply_event and _events to _changes
This commit is contained in:
@@ -6,13 +6,13 @@ from domain.marketplace.domain_event import DomainEvent
|
||||
|
||||
|
||||
class Entity(ABC):
|
||||
_events: tuple[DomainEvent, ...] = ()
|
||||
_changes: tuple[DomainEvent, ...] = ()
|
||||
|
||||
def raise_event(self, event: DomainEvent) -> Self:
|
||||
return replace(self, _events=(*self._events, event))
|
||||
def apply_event(self, event: DomainEvent) -> Self:
|
||||
return replace(self, _changes=(*self._changes, event))
|
||||
|
||||
def get_changes(self) -> tuple[DomainEvent, ...]:
|
||||
return self._events
|
||||
return self._changes
|
||||
|
||||
def clear_changes(self) -> Self:
|
||||
return replace(self, _events=())
|
||||
return replace(self, _changes=())
|
||||
|
||||
Reference in New Issue
Block a user