refactor: rename raise_event to apply_event and _events to _changes

This commit is contained in:
2026-07-29 10:40:04 -04:00
parent 5bb6cedd03
commit 7eace9212d
4 changed files with 24 additions and 24 deletions

View File

@@ -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=())