Skip to content

Commit ff1f0d5

Browse files
Allow registering products IN the stores.
1 parent c5176e9 commit ff1f0d5

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

ecommerce/stores/lib/stores.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
require_relative "stores/events"
55
require_relative "stores/registration"
66
require_relative "stores/naming"
7+
require_relative "stores/product_registration"
78

89
module Stores
910

1011
class Configuration
1112
def call(event_store, command_bus)
1213
command_bus.register(RegisterStore, Registration.new(event_store))
1314
command_bus.register(NameStore, Naming.new(event_store))
15+
command_bus.register(RegisterProduct, ProductRegistration.new(event_store))
1416
end
1517
end
1618
end

ecommerce/stores/lib/stores/commands.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@ class NameStore < Infra::Command
77
attribute :store_id, Infra::Types::UUID
88
attribute :name, Infra::Types.Instance(StoreName)
99
end
10+
11+
class RegisterProduct < Infra::Command
12+
attribute :store_id, Infra::Types::UUID
13+
attribute :product_id, Infra::Types::UUID
14+
end
1015
end

ecommerce/stores/lib/stores/events.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ class StoreNamed < Infra::Event
99
attribute :name, Infra::Types::String
1010
end
1111

12+
class ProductRegistered < Infra::Event
13+
attribute :store_id, Infra::Types::UUID
14+
attribute :product_id, Infra::Types::UUID
15+
end
16+
1217
end

0 commit comments

Comments
 (0)