add categories thought spaces
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user