Set up parent category mechanism.

This commit is contained in:
Florian THIERRY
2024-03-12 18:20:04 +01:00
parent a3295636b4
commit ed766d4c8c
8 changed files with 64 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
package org.codiki.exposition.category;
import java.util.List;
import java.util.UUID;
import static org.springframework.http.HttpStatus.CREATED;
@@ -9,6 +10,7 @@ import org.codiki.domain.category.model.Category;
import org.codiki.exposition.category.model.CategoryDto;
import org.codiki.exposition.category.model.CategoryEditionRequest;
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;
@@ -51,4 +53,12 @@ public class CategoryController {
public void deleteCategory(@PathVariable("categoryId") UUID categoryId) {
categoryUseCases.deleteCategory(categoryId);
}
@GetMapping
public List<CategoryDto> getAllCategories() {
return categoryUseCases.getAll()
.stream()
.map(CategoryDto::new)
.toList();
}
}

View File

@@ -43,6 +43,7 @@ public class SecurityConfiguration {
.requestMatchers(
GET,
"/api/health/check",
"/api/categories",
"/error"
).permitAll()
.requestMatchers(