Add post and comment deletion

This commit is contained in:
Tim
2025-07-11 17:24:48 +08:00
parent 216faeb496
commit f4af7a48c7
7 changed files with 139 additions and 3 deletions

View File

@@ -48,6 +48,11 @@ public class PostController {
return ResponseEntity.ok(toDto(post));
}
@DeleteMapping("/{id}")
public void deletePost(@PathVariable Long id, Authentication auth) {
postService.deletePost(id, auth.getName());
}
@GetMapping("/{id}")
public ResponseEntity<PostDto> getPost(@PathVariable Long id, Authentication auth) {
String viewer = auth != null ? auth.getName() : null;