init
This commit is contained in:
19
src/main/kotlin/space/luminic/finance/api/GoalController.kt
Normal file
19
src/main/kotlin/space/luminic/finance/api/GoalController.kt
Normal file
@@ -0,0 +1,19 @@
|
||||
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<GoalDTO> {
|
||||
return goalService.findAllBySpaceId(spaceId).map { it.toDto() }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user