게시글 내용을 불러오는 중입니다... 잠시만 기다려 주세요! 🐕🦺
@@ -837,7 +833,7 @@diff --git a/src/main/java/io/github/petty/community/controller/PostController.java b/src/main/java/io/github/petty/community/controller/PostController.java index 281ea02..61083e5 100644 --- a/src/main/java/io/github/petty/community/controller/PostController.java +++ b/src/main/java/io/github/petty/community/controller/PostController.java @@ -97,17 +97,4 @@ public ResponseEntity> likePost(@PathVariable Long id, return ResponseEntity.status(500).body("좋아요 처리에 실패했습니다."); } } - - // 🔥 기존 데이터 업데이트를 위한 임시 엔드포인트 (관리자용) - @PostMapping("/update-counts") - @PreAuthorize("hasRole('ADMIN')") - public ResponseEntity> updateAllPostCounts(@AuthenticationPrincipal CustomUserDetails userDetails) { - // 관리자 권한 확인 - if (!userDetails.getAuthorities().stream() - .anyMatch(a -> a.getAuthority().equals("ROLE_ADMIN"))) { - return ResponseEntity.status(403).body("관리자 권한이 필요합니다."); - } - postService.updateAllPostCounts(); - return ResponseEntity.ok(Map.of("message", "모든 게시글의 댓글 수와 좋아요 수가 업데이트되었습니다.")); - } } diff --git a/src/main/resources/static/js/common/edit-qna.js b/src/main/resources/static/js/common/edit-qna.js index fe0f2fc..b632d60 100644 --- a/src/main/resources/static/js/common/edit-qna.js +++ b/src/main/resources/static/js/common/edit-qna.js @@ -188,7 +188,7 @@ async function checkPostOwnership() { } // 🔐 작성자 본인이 아니면 접근 차단 - const isOwner = currentUser.username === post.userName; + const isOwner = currentUser.username === post.writer; if (!isOwner) { alert("본인이 작성한 게시글만 수정할 수 있습니다."); window.location.replace(`/posts/detail?id=${postId}`); diff --git a/src/main/resources/static/js/common/edit-review.js b/src/main/resources/static/js/common/edit-review.js index 5a87482..595e328 100644 --- a/src/main/resources/static/js/common/edit-review.js +++ b/src/main/resources/static/js/common/edit-review.js @@ -190,7 +190,7 @@ async function checkPostOwnership() { } // 🔐 작성자 본인이 아니면 접근 차단 - const isOwner = currentUser.username === post.userName; + const isOwner = currentUser.username === post.writer; if (!isOwner) { alert("본인이 작성한 게시글만 수정할 수 있습니다."); window.location.replace(`/posts/detail?id=${postId}`); diff --git a/src/main/resources/static/js/common/edit-showoff.js b/src/main/resources/static/js/common/edit-showoff.js index 8640f81..b888031 100644 --- a/src/main/resources/static/js/common/edit-showoff.js +++ b/src/main/resources/static/js/common/edit-showoff.js @@ -176,7 +176,7 @@ async function checkPostOwnership() { } // 🔐 작성자 본인이 아니면 접근 차단 - const isOwner = currentUser.username === post.userName; + const isOwner = currentUser.username === post.writer; if (!isOwner) { alert("본인이 작성한 게시글만 수정할 수 있습니다."); window.location.replace(`/posts/detail?id=${postId}`); diff --git a/src/main/resources/templates/post-detail.html b/src/main/resources/templates/post-detail.html index ee6e1b6..0d77f42 100644 --- a/src/main/resources/templates/post-detail.html +++ b/src/main/resources/templates/post-detail.html @@ -728,10 +728,6 @@
게시글 내용을 불러오는 중입니다... 잠시만 기다려 주세요! 🐕🦺
@@ -837,7 +833,7 @@