refactor: rename apply_event to apply

This commit is contained in:
2026-07-29 10:44:12 -04:00
parent 511a66ab66
commit fa65782059
5 changed files with 26 additions and 17 deletions

View File

@@ -57,27 +57,27 @@ class ClassifiedAd(Entity):
self._ensure_valid_state()
updated = replace(self, state=ClassifiedAdState.PendingReview)
return updated.apply_event(
return updated.apply(
ClassifiedAdSentForReview(id=self.id.value)
)
def set_title(self, title: ClassifiedAdTitle) -> ClassifiedAd:
updated = replace(self, title=title)
updated._ensure_valid_state()
return updated.apply_event(
return updated.apply(
ClassifiedAdTitleChanged(id=self.id.value, title=title.title)
)
def update_text(self, text: ClassifiedAdText) -> ClassifiedAd:
updated = replace(self, text=text)
updated._ensure_valid_state()
return updated.apply_event(
return updated.apply(
ClassifiedAdTextUpdated(id=self.id.value, ad_text=text.text)
)
def update_price(self, price: Price) -> ClassifiedAd:
updated = replace(self, price=price)
updated._ensure_valid_state()
return updated.apply_event(
return updated.apply(
ClassifiedAdPriceUpdated(id=self.id.value, price=price.amount)
)