Add update endpoints for tags and categories

This commit is contained in:
Tim
2025-07-02 14:36:26 +08:00
parent a6fd1b52ed
commit 19fb175cce
6 changed files with 80 additions and 0 deletions

View File

@@ -21,6 +21,12 @@ public class CategoryController {
return toDto(c);
}
@PutMapping("/{id}")
public CategoryDto update(@PathVariable Long id, @RequestBody CategoryRequest req) {
Category c = categoryService.updateCategory(id, req.getName(), req.getDescribe(), req.getIcon());
return toDto(c);
}
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
categoryService.deleteCategory(id);

View File

@@ -21,6 +21,12 @@ public class TagController {
return toDto(tag);
}
@PutMapping("/{id}")
public TagDto update(@PathVariable Long id, @RequestBody TagRequest req) {
Tag tag = tagService.updateTag(id, req.getName(), req.getDescribe(), req.getIcon());
return toDto(tag);
}
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
tagService.deleteTag(id);