feat: allow closing posts

This commit is contained in:
Tim
2025-08-19 22:18:53 +08:00
parent 38a49f7414
commit 0fa08e2260
8 changed files with 111 additions and 2 deletions

View File

@@ -62,6 +62,16 @@ public class PostController {
postService.deletePost(id, auth.getName());
}
@PostMapping("/{id}/close")
public PostSummaryDto close(@PathVariable Long id, Authentication auth) {
return postMapper.toSummaryDto(postService.closePost(id, auth.getName()));
}
@PostMapping("/{id}/reopen")
public PostSummaryDto reopen(@PathVariable Long id, Authentication auth) {
return postMapper.toSummaryDto(postService.reopenPost(id, auth.getName()));
}
@GetMapping("/{id}")
public ResponseEntity<PostDetailDto> getPost(@PathVariable Long id, Authentication auth) {
String viewer = auth != null ? auth.getName() : null;