This commit is contained in:
xds
2025-10-31 15:31:55 +03:00
parent 040da34ff7
commit 7972ea0fdf
117 changed files with 3691 additions and 2013 deletions

View File

@@ -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)
}
}