Implements getting items for a hunt
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user