This commit is contained in:
xds
2025-02-24 00:06:21 +03:00
parent d31bd13839
commit b2fb6174c2
2 changed files with 50 additions and 28 deletions

View File

@@ -5,8 +5,10 @@ import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import org.springframework.web.client.HttpClientErrorException
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import space.luminic.budgerapp.controllers.BudgetController.LimitValue
import space.luminic.budgerapp.controllers.dtos.BudgetCreationDTO
import space.luminic.budgerapp.models.*
import space.luminic.budgerapp.services.CategoryService
import space.luminic.budgerapp.services.FinancialService
@@ -101,10 +103,10 @@ class SpaceController(
@PostMapping("/{spaceId}/budgets")
fun createBudget(
@PathVariable spaceId: String,
@RequestBody budget: Budget
@RequestBody budgetCreationDTO: BudgetCreationDTO,
): Mono<Budget> {
return spaceService.isValidRequest(spaceId).flatMap {
financialService.createBudget(it, budget)
financialService.createBudget(it, budgetCreationDTO.budget, budgetCreationDTO.createRecurrent)
}
}
@@ -302,7 +304,7 @@ class SpaceController(
}
}
@PostMapping("/{spaceId}/recurrents")
@PostMapping("/{spaceId}/recurrent")
fun createRecurrent(@PathVariable spaceId: String, @RequestBody recurrent: Recurrent): Mono<Recurrent> {
return spaceService.isValidRequest(spaceId).flatMap {
recurrentService.createRecurrent(it, recurrent)
@@ -310,7 +312,7 @@ class SpaceController(
}
@PutMapping("/{spaceId}/recurrents/{id}")
@PutMapping("/{spaceId}/recurrent/{id}")
fun editRecurrent(
@PathVariable spaceId: String,
@PathVariable id: String,
@@ -330,8 +332,8 @@ class SpaceController(
}
}
@GetMapping("/regen")
fun regenSpaces(): Mono<Category> {
return spaceService.regenSpaceCategory()
}
// @GetMapping("/regen")
// fun regenSpaces(): Mono<Category> {
// return spaceService.regenSpaceCategory()
// }
}