Island: Match type based on __name__

This commit is contained in:
Kekoa Kaaikala 2022-09-14 17:29:22 +00:00
parent ad5bba9e2f
commit 89954223e8
1 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,9 @@ class MongoEventRepository(IEventRepository):
self, event_type: Type[AbstractAgentEvent]
) -> Sequence[AbstractAgentEvent]:
try:
serialized_events = list(self._events_collection.find({EVENT_TYPE_FIELD: event_type}))
serialized_events = list(
self._events_collection.find({EVENT_TYPE_FIELD: event_type.__name__})
)
return list(map(self._deserialize, serialized_events))
except Exception as err:
raise RetrievalError(f"Error retrieving events for type {event_type}: {err}")