Implements getting items for a hunt

This commit is contained in:
2026-05-13 16:09:10 -05:00
parent 30c66527b9
commit 9324cf2eb0
3 changed files with 17 additions and 2 deletions

View File

@@ -64,6 +64,11 @@ class HuntService(
return huntRepository.save(hunt.toRecord()).toDomain()
}
fun getItemsForHunt(huntId: HuntId): List<Item> {
huntRepository.findByIdOrNull(huntId) ?: throw NotFoundException("No hunt with id $huntId found")
return itemRepository.findAllByHuntId(huntId).map { it.toDomain() }
}
fun addItemToHunt(huntId: HuntId, item: Item): Item {
huntRepository.findByIdOrNull(huntId) ?: throw NotFoundException("No hunt with id $huntId found")
val savedItem = itemRepository.save(item.toRecord()).toDomain()