add categories thought spaces

This commit is contained in:
xds
2025-02-17 18:31:46 +03:00
parent d680345a9f
commit 0c445a5141
8 changed files with 91 additions and 33 deletions

View File

@@ -25,6 +25,12 @@ class SpaceController(
) {
data class SpaceCreateDTO(
val name: String,
val description: String,
val createCategories: Boolean,
)
@GetMapping
fun getSpaces(): Mono<List<Space>> {
return spaceService.getSpaces()
@@ -32,8 +38,8 @@ class SpaceController(
@PostMapping
fun createSpace(@RequestBody space: Space): Mono<Space> {
return spaceService.createSpace(space)
fun createSpace(@RequestBody space: SpaceCreateDTO): Mono<Space> {
return spaceService.createSpace(Space(name=space.name, description = space.description), space.createCategories)
}
@@ -45,7 +51,10 @@ class SpaceController(
@DeleteMapping("/{spaceId}")
fun deleteSpace(@PathVariable spaceId: String): Mono<Void> {
return spaceService.deleteSpace(spaceId)
return spaceService.isValidRequest(spaceId).flatMap {
spaceService.deleteSpace(it)
}
}
@PostMapping("/{spaceId}/invite")