Skip to content

Instantly share code, notes, and snippets.

@stolarczykt
Created April 13, 2022 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stolarczykt/5b8f8c95cd4f31e9a1520df0ce205d01 to your computer and use it in GitHub Desktop.
Save stolarczykt/5b8f8c95cd4f31e9a1520df0ce205d01 to your computer and use it in GitHub Desktop.
module Advertisements
class OnPublishAdvertisement
def call(command)
repository = AdvertisementRepository::new
repository.with_advertisement(command.advertisement_id) do |advertisement|
advertisement.publish(command.author_id)
end
end
end
class OnChangeContent
def call(command)
repository = AdvertisementRepository::new
repository.with_advertisement(command.advertisement_id) do |advertisement|
advertisement.change_content(command.content, command.author_id)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment