Add command handlers and aggregate methods for inventory/equipment commands #38

Open
opened 2026-03-14 23:54:57 +00:00 by freemo · 0 comments
Owner

Metadata

  • Commit Message: feat(event-sourcing): add inventory and equipment command handlers and aggregate methods
  • Branch: feature/m1-v12-inventory-es-handlers

Background

4 commands (AddItemToInventory, RemoveItemFromInventory, EquipItem, UnequipItem) and events are defined but have no command handlers or aggregate methods. They would crash at runtime.

Expected Behavior

GameObjectCommandHandler handles all 4 inventory/equipment commands. Domain::GameObject has corresponding aggregate methods that apply the events.

Acceptance Criteria

  • command_handlers.rb registers handlers for all 4 commands
  • domain.rb GameObject aggregate has add_to_inventory, remove_from_inventory, equip_item, unequip_item methods
  • Each method validates preconditions and applies the corresponding event
  • Event application updates aggregate state (@inventory, @equipment)

Subtasks

  • Add 4 handler registrations in command_handlers.rb
  • Add 4 aggregate methods in domain.rb GameObject
  • Add 4 on event handlers in domain.rb for state application
  • Tests: Unit tests for each handler and aggregate method
  • Run bundle exec rake unit, fix any errors

Definition of Done

This issue is complete when all subtasks are done, commit created on the specified branch, PR submitted and merged.

## Metadata - **Commit Message**: `feat(event-sourcing): add inventory and equipment command handlers and aggregate methods` - **Branch**: `feature/m1-v12-inventory-es-handlers` ## Background 4 commands (`AddItemToInventory`, `RemoveItemFromInventory`, `EquipItem`, `UnequipItem`) and events are defined but have no command handlers or aggregate methods. They would crash at runtime. ## Expected Behavior `GameObjectCommandHandler` handles all 4 inventory/equipment commands. `Domain::GameObject` has corresponding aggregate methods that apply the events. ## Acceptance Criteria - [ ] `command_handlers.rb` registers handlers for all 4 commands - [ ] `domain.rb` `GameObject` aggregate has `add_to_inventory`, `remove_from_inventory`, `equip_item`, `unequip_item` methods - [ ] Each method validates preconditions and applies the corresponding event - [ ] Event application updates aggregate state (`@inventory`, `@equipment`) ## Subtasks - [ ] Add 4 handler registrations in `command_handlers.rb` - [ ] Add 4 aggregate methods in `domain.rb` `GameObject` - [ ] Add 4 `on` event handlers in `domain.rb` for state application - [ ] Tests: Unit tests for each handler and aggregate method - [ ] Run `bundle exec rake unit`, fix any errors ## Definition of Done This issue is complete when all subtasks are done, commit created on the specified branch, PR submitted and merged.
freemo added this to the v1.2.0 milestone 2026-03-14 23:54:57 +00:00
freemo self-assigned this 2026-03-15 04:25:22 +00:00
freemo modified the milestone from v1.2.0 to v1.0.0 2026-03-15 23:19:34 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference: aethyr/Aethyr#38
No description provided.