refactor: rename apply_event to apply
This commit is contained in:
@@ -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)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user