Merge branch '53-respond-with-the-new-category-json-when-creating-a-new-category' into '22-integrate-api-and-frontend'
Resolve "Respond with the new category JSON when creating a new category" See merge request padas/24ss-5430-web-and-data-eng/gruppe-3/datadash!53
This commit is contained in:
commit
69b6697f62
@ -37,8 +37,8 @@ public class CategoryController {
|
||||
}
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
@PostMapping
|
||||
public void createCategory(@RequestBody CategoryDto dto) {
|
||||
categoryService.addCategory(dto);
|
||||
public Category createCategory(@RequestBody CategoryDto dto) {
|
||||
return categoryService.addCategory(dto);
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,9 +12,9 @@ public class CategoryService {
|
||||
this.categoryRepository = categoryRepository;
|
||||
}
|
||||
|
||||
void addCategory(CategoryDto category) {
|
||||
Category addCategory(CategoryDto category) {
|
||||
Category cat = new Category(category.getName());
|
||||
categoryRepository.save(cat);
|
||||
return categoryRepository.save(cat);
|
||||
}
|
||||
|
||||
List<CategoryDto> getAllCategories() {
|
||||
|
Loading…
Reference in New Issue
Block a user