Created
April 13, 2022 20:00
-
-
Save stolarczykt/d9031b474b7f6a1a8bb317a9fa1877ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Advertisements | |
class AdvertisementRepository | |
def initialize(event_store = Rails.configuration.event_store) | |
@repository = AggregateRoot::Repository.new(event_store) | |
end | |
def with_advertisement(advertisement_id, &block) | |
stream_name = "Advertisement$#{advertisement_id}" | |
repository.with_aggregate(Advertisement.new(advertisement_id), stream_name, &block) | |
end | |
private | |
attr_reader :repository | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment