Implement the 004-edit-combatant feature that adds the possibility to change a combatants name

This commit is contained in:
Lukas
2026-03-04 10:05:13 +01:00
parent aed234de7b
commit a9df826fef
16 changed files with 854 additions and 5 deletions

View File

@@ -0,0 +1,37 @@
# Domain Contract: editCombatant
## Function Signature
```
editCombatant(encounter, id, newName) → EditCombatantSuccess | DomainError
```
### Inputs
| Parameter | Type | Description |
|-----------|------|-------------|
| encounter | Encounter | Current encounter state |
| id | CombatantId | Identity of combatant to rename |
| newName | string | New name to assign |
### Success Output
| Field | Type | Description |
|-------|------|-------------|
| encounter | Encounter | Updated encounter with renamed combatant |
| events | DomainEvent[] | Exactly one `CombatantUpdated` event |
### Error Output
| Code | Condition |
|------|-----------|
| `"combatant-not-found"` | No combatant with given id exists |
| `"invalid-name"` | newName is empty or whitespace-only |
## Hook Contract
`useEncounter()` returns an additional action:
| Method | Signature | Description |
|--------|-----------|-------------|
| editCombatant | `(id: CombatantId, newName: string) => void` | Rename combatant, append events on success |