package space.luminic.finance.api import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController import space.luminic.finance.dtos.GoalDTO import space.luminic.finance.mappers.GoalMapper.toDto import space.luminic.finance.services.GoalService @RestController @RequestMapping("/spaces/{spaceId}/goals") class GoalController(private val goalService: GoalService) { @GetMapping fun findAll(@PathVariable spaceId: Int): List { return goalService.findAllBySpaceId(spaceId).map { it.toDto() } } }