init
This commit is contained in:
@@ -2,14 +2,7 @@ package space.luminic.finance.api
|
||||
|
||||
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType
|
||||
import io.swagger.v3.oas.annotations.security.SecurityScheme
|
||||
import org.springframework.web.bind.annotation.DeleteMapping
|
||||
import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.PathVariable
|
||||
import org.springframework.web.bind.annotation.PostMapping
|
||||
import org.springframework.web.bind.annotation.PutMapping
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import space.luminic.finance.dtos.CurrencyDTO
|
||||
import space.luminic.finance.mappers.CurrencyMapper.toDto
|
||||
import space.luminic.finance.services.CurrencyService
|
||||
@@ -27,27 +20,27 @@ class ReferenceController(
|
||||
) {
|
||||
|
||||
@GetMapping("/currencies")
|
||||
suspend fun getCurrencies(): List<CurrencyDTO> {
|
||||
fun getCurrencies(): List<CurrencyDTO> {
|
||||
return currencyService.getCurrencies().map { it.toDto() }
|
||||
}
|
||||
|
||||
@GetMapping("/currencies/{currencyCode}")
|
||||
suspend fun getCurrency(@PathVariable currencyCode: String): CurrencyDTO {
|
||||
fun getCurrency(@PathVariable currencyCode: String): CurrencyDTO {
|
||||
return currencyService.getCurrency(currencyCode).toDto()
|
||||
}
|
||||
|
||||
@PostMapping("/currencies")
|
||||
suspend fun createCurrency(@RequestBody currencyDTO: CurrencyDTO): CurrencyDTO {
|
||||
fun createCurrency(@RequestBody currencyDTO: CurrencyDTO): CurrencyDTO {
|
||||
return currencyService.createCurrency(currencyDTO).toDto()
|
||||
}
|
||||
|
||||
@PutMapping("/currencies/{currencyCode}")
|
||||
suspend fun updateCurrency(@PathVariable currencyCode: String, @RequestBody currencyDTO: CurrencyDTO): CurrencyDTO {
|
||||
fun updateCurrency(@PathVariable currencyCode: String, @RequestBody currencyDTO: CurrencyDTO): CurrencyDTO {
|
||||
return currencyService.updateCurrency(currencyDTO).toDto()
|
||||
}
|
||||
|
||||
@DeleteMapping("/currencies/{currencyCode}")
|
||||
suspend fun deleteCurrency(@PathVariable currencyCode: String) {
|
||||
fun deleteCurrency(@PathVariable currencyCode: String) {
|
||||
currencyService.deleteCurrency(currencyCode)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user