extract projection snapshot logic

implement GameStateRepositoryTest
add lambda to the GameEventHandler.handle{} to set the version

add VersionBuilder
add version to the events
add creation date to the events
rename gameId to aggregateId
add EventHandler interface
This commit is contained in:
2025-03-13 00:27:44 +01:00
parent d5b033e731
commit 286dedac76
36 changed files with 684 additions and 266 deletions

View File

@@ -34,11 +34,11 @@ class EventStreamInMemory<E : Event<ID>, ID : AggregateId> : EventStream<E, ID>
): R? =
events
.filterIsInstance(eventType.java)
.lastOrNull { it.gameId == aggregateId }
.lastOrNull { it.aggregateId == aggregateId }
override fun readAll(aggregateId: ID): Set<E> =
events
.filter { it.gameId == aggregateId }
.filter { it.aggregateId == aggregateId }
.toSet()
}