From 457021aeec30fceea86da9f8e316b8ce0b7e34f2 Mon Sep 17 00:00:00 2001 From: aarbit Date: Mon, 22 Dec 2025 08:51:01 -0600 Subject: [PATCH] Adds get hunts by hunter endpoint --- .../scavengerhuntapi/controller/HuntController.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/kotlin/net/halfbinary/scavengerhuntapi/controller/HuntController.kt b/src/main/kotlin/net/halfbinary/scavengerhuntapi/controller/HuntController.kt index 4fc6ae7..7314ecd 100644 --- a/src/main/kotlin/net/halfbinary/scavengerhuntapi/controller/HuntController.kt +++ b/src/main/kotlin/net/halfbinary/scavengerhuntapi/controller/HuntController.kt @@ -2,6 +2,7 @@ package net.halfbinary.scavengerhuntapi.controller import jakarta.validation.Valid import net.halfbinary.scavengerhuntapi.model.HuntId +import net.halfbinary.scavengerhuntapi.model.HunterId import net.halfbinary.scavengerhuntapi.model.converter.toDomain import net.halfbinary.scavengerhuntapi.model.converter.toResponse import net.halfbinary.scavengerhuntapi.model.request.HuntCreateRequest @@ -30,4 +31,9 @@ class HuntController(private val huntService: HuntService) { return ResponseEntity.ok(huntService.createHunt(huntRequest.toDomain()).toResponse()) } + @GetMapping("/hunter/{hunterId}") + fun getHuntsByHunter(@PathVariable("hunterId") hunterId: HunterId): ResponseEntity> { + return ResponseEntity.ok(huntService.getHuntsByHunter(hunterId).map { it.toResponse() }) + } + } \ No newline at end of file