Skip to content

20260309 #230 게시판 익명 기능 추가#297

Merged
discipline24 merged 6 commits intomainfrom
20260309-#230-게시판-익명-기능-추가
Mar 11, 2026

Hidden character warning

The head ref may contain hidden characters: "20260309-#230-\uac8c\uc2dc\ud310-\uc775\uba85-\uae30\ub2a5-\ucd94\uac00"
Merged

20260309 #230 게시판 익명 기능 추가#297
discipline24 merged 6 commits intomainfrom
20260309-#230-게시판-익명-기능-추가

Conversation

@nayoung04
Copy link
Contributor

@nayoung04 nayoung04 commented Mar 10, 2026

#230

Summary by CodeRabbit

  • 새로운 기능

    • 게시물과 댓글을 익명으로 작성하는 옵션 추가 — 익명 작성 시 작성자명이 "익명"으로 표시됩니다.
  • 개선 사항

    • 익명 처리 관련 API 설명 및 문서화 강화
    • 댓글 페이징 및 게시물 검색/페이지네이션 동작 개선
    • 좋아요·북마크 동작 설명을 토글 방식으로 명확화

@nayoung04 nayoung04 requested a review from discipline24 as a code owner March 10, 2026 16:22
@nayoung04 nayoung04 closed this Mar 10, 2026
@nayoung04 nayoung04 reopened this Mar 10, 2026
@nayoung04
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

Walkthrough

게시물(Post)과 댓글(Comment)에 익명(anonymous) 플래그를 추가하고, 엔티티·DTO·서비스·컨트롤러 전반에서 익명일 경우 사용자 정보를 "익명"으로 마스킹하도록 매핑·퍼시스턴스 처리를 추가했습니다.

Changes

Cohort / File(s) Summary
엔티티
backend/src/main/java/org/sejongisc/backend/board/entity/Post.java, backend/src/main/java/org/sejongisc/backend/board/entity/Comment.java
anonymous boolean 필드 추가, DB 컬럼 정의(nullable false, default false) 및 빌더 기본값 설정.
요청 DTO
backend/src/main/java/org/sejongisc/backend/board/dto/PostRequest.java, backend/src/main/java/org/sejongisc/backend/board/dto/CommentRequest.java
anonymous boolean 필드(@Builder.Default = false) 추가로 클라이언트가 익명 여부 전달 가능.
응답 DTO
backend/src/main/java/org/sejongisc/backend/board/dto/PostResponse.java, backend/src/main/java/org/sejongisc/backend/board/dto/CommentResponse.java
응답에 anonymous 필드 추가. CommentResponse에 익명일 때 사용자 정보를 마스킹하는 getCommentUser() 헬퍼 사용.
서비스 로직
backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java, backend/src/main/java/org/sejongisc/backend/board/service/PostInteractionService.java
게시물·댓글 생성·수정 시 anonymous 적용, 익명일 경우 이벤트/응답에 사용자명을 "익명"으로 설정하는 조건부 매핑 및 헬퍼 메서드 추가.
컨트롤러
backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java
클래스 레벨 @RequestMapping("/api/board"), Swagger 태그 추가 및 일부 엔드포인트 파라미터 바인딩(예: PostRequest @ModelAttribute) 조정, 설명(문구) 업데이트.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Controller as BoardController
    participant Service as PostService
    participant Repo as PostRepository/CommentRepository
    participant DB as Database

    Client->>Controller: POST /api/board/posts\nbody: {content, anonymous:true,...}
    Controller->>Service: savePost(PostRequest with anonymous, userId)
    Service->>Repo: save(Post entity with anonymous flag)
    Repo->>DB: INSERT post (anonymous = true)
    DB-->>Repo: insert result (id)
    Repo-->>Service: saved Post
    Service-->>Controller: PostResponse (user masked as "익명", anonymous=true)
    Controller-->>Client: 201 Created + PostResponse
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

BE

Suggested reviewers

  • discipline24

Poem

🐰 조용히 깡총, 익명 깃발 꽂았네,
글과 댓글 속 이름은 잠시 숨고,
"익명"으로 불리며 소곤대는 밤,
토끼가 웃으며 바구니에 축하 달아둘게. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 78.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 게시판의 익명 기능 추가라는 주요 변경 사항을 명확하고 간결하게 요약하고 있으며, 실제 변경 내용(Post/Comment 엔티티에 anonymous 필드 추가, 익명 처리 로직 구현)과 일치합니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 20260309-#230-게시판-익명-기능-추가

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java (1)

70-77: ⚠️ Potential issue | 🟠 Major

익명 게시물의 활동 이벤트에서 실제 사용자 이름이 노출됩니다.

savePost()에서 익명 게시물을 작성할 때 ActivityEventuser.getName()이 전송됩니다. 반면 PostInteractionService.createComment()에서는 익명일 경우 "익명"을 사용합니다.

이 불일치로 인해 익명 게시물 작성자의 실명이 활동 로그에 기록됩니다.

🐛 수정 제안
     post = postRepository.save(post);
     User user = post.getUser();
+    String username = request.isAnonymous() ? "익명" : user.getName();
     eventPublisher.publishEvent(new ActivityEvent(
             userId,
-            user.getName(),
+            username,
             ActivityType.BOARD_POST,
             "[" + post.getTitle() + "]글을 게시했습니다.",
             post.getPostId(),
             board.getBoardName()
     ));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java`
around lines 70 - 77, The ActivityEvent for new posts currently uses the real
name (user.getName()) causing anonymous posts to leak the author; in savePost()
change the name passed to new ActivityEvent to use a conditional (e.g.,
post.isAnonymous() ? "익명" : user.getName()) so that when creating the
ActivityEvent via eventPublisher.publishEvent(...) you pass "익명" for anonymous
posts (matching PostInteractionService.createComment() behavior) and the real
name only for non-anonymous posts.
backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java (2)

208-209: ⚠️ Potential issue | 🟡 Minor

updateComment에도 @Valid 어노테이션 추가 필요

createComment와 동일하게 @Valid 어노테이션을 추가하여 입력 검증을 수행해야 합니다.

🛡️ 제안 수정
  `@PutMapping`("/comment/{commentId}")
  public void updateComment(
      `@PathVariable` UUID commentId,
-      `@RequestBody` CommentRequest request,
+      `@Valid` `@RequestBody` CommentRequest request,
      `@AuthenticationPrincipal` CustomUserDetails customUserDetails) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java`
around lines 208 - 209, updateComment 메서드의 RequestBody 파라미터에 입력 검증이 빠져 있으니
createComment와 동일하게 updateComment의 `@RequestBody` CommentRequest request 파라미터에
`@Valid` 어노테이션을 추가하고(예: public ResponseEntity<?> updateComment(`@PathVariable` UUID
commentId, `@Valid` `@RequestBody` CommentRequest request, ...)) 필요한 Valid
어노테이션(import javax.validation.Valid 또는 jakarta.validation.Valid)을 추가하여 요청 DTO
검증이 동작하도록 변경하세요.

192-193: ⚠️ Potential issue | 🟡 Minor

@Valid 어노테이션 누락으로 입력 검증 미수행

CommentRequest@Valid 어노테이션이 없어 DTO의 유효성 검증(예: @NotNull, @Size 등)이 수행되지 않습니다. PostRequest에는 @Valid가 적용되어 있으므로 일관성 있게 추가해야 합니다.

🛡️ 제안 수정
  `@PostMapping`("/comment")
  public ResponseEntity<Void> createComment(
-      `@RequestBody` CommentRequest request,
+      `@Valid` `@RequestBody` CommentRequest request,
      `@AuthenticationPrincipal` CustomUserDetails customUserDetails) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java`
around lines 192 - 193, The createComment endpoint in BoardController is missing
the `@Valid` annotation so CommentRequest DTO constraints are not being enforced;
update the BoardController.createComment method signature to annotate the
CommentRequest parameter with `@Valid` (matching how PostRequest is handled) and
add the appropriate import for javax.validation.Valid or
jakarta.validation.Valid if missing, ensuring CommentRequest's field-level
annotations (e.g., `@NotNull`, `@Size`) are applied during request binding.
🧹 Nitpick comments (7)
backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java (2)

318-324: getAnonymousUserInfo() 헬퍼가 CommentResponse.getCommentUser()와 중복됩니다.

CommentResponse.java의 Line 34와 동일한 익명 사용자 정보 생성 로직입니다. CommentResponse.java 리뷰에서 제안한 대로 UserInfoResponse.anonymous() 정적 팩토리 메서드로 통합하면 중복을 제거할 수 있습니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java`
around lines 318 - 324, Replace the duplicate anonymous-user construction in
getAnonymousUserInfo() with the centralized factory: remove or refactor
getAnonymousUserInfo() to call UserInfoResponse.anonymous(), and update any
callers (e.g., usages inside PostServiceImpl) to use
UserInfoResponse.anonymous() instead; this consolidates the logic already
duplicated in CommentResponse.getCommentUser() and eliminates the redundant
construction.

7-7: 와일드카드 import 사용은 명시적 import로 변경하는 것을 권장합니다.

org.sejongisc.backend.board.dto.*org.sejongisc.backend.board.repository.* 와일드카드 import는 가독성과 명확성을 위해 명시적 import로 변경하는 것이 좋습니다. IDE에서 자동으로 정리할 수 있습니다.

Also applies to: 12-12

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java`
at line 7, Replace the wildcard imports org.sejongisc.backend.board.dto.* and
org.sejongisc.backend.board.repository.* in PostServiceImpl with explicit
imports for the DTO and repository classes actually used in this file (e.g.,
import each specific DTO and repository type referenced by methods in
PostServiceImpl such as PostDto, CreatePostRequest, PostRepository, etc.); you
can run your IDE's "Optimize/Organize Imports" on PostServiceImpl.java to
automatically expand and remove unused imports and ensure only the precise
classes referenced by methods like the PostServiceImpl constructor and its
service methods remain imported.
backend/src/main/java/org/sejongisc/backend/board/dto/CommentResponse.java (1)

32-37: 코드 중복: PostServiceImpl.getAnonymousUserInfo()와 동일한 로직이 존재합니다.

getCommentUser()의 익명 사용자 생성 로직이 PostServiceImpl.getAnonymousUserInfo() (Line 322-324)와 중복됩니다. 유지보수성을 위해 공통 유틸리티로 추출하는 것을 권장합니다.

♻️ 공통 유틸리티 추출 제안

UserInfoResponse에 정적 팩토리 메서드를 추가:

// UserInfoResponse.java에 추가
public static UserInfoResponse anonymous() {
    return new UserInfoResponse(null, "익명", null, null, null, null, List.of());
}

그 후 CommentResponsePostServiceImpl에서 사용:

 private static UserInfoResponse getCommentUser(Comment comment) {
   if (comment.isAnonymous()) {
-    return new UserInfoResponse(null, "익명", null, null, null, null, List.of());
+    return UserInfoResponse.anonymous();
   }
   return UserInfoResponse.from(comment.getUser());
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/src/main/java/org/sejongisc/backend/board/dto/CommentResponse.java`
around lines 32 - 37, Extract the anonymous user creation into a shared factory
on UserInfoResponse: add a public static UserInfoResponse anonymous() that
returns new UserInfoResponse(null, "익명", null, null, null, null, List.of());
then replace the duplicate constructions in CommentResponse.getCommentUser() and
PostServiceImpl.getAnonymousUserInfo() to call UserInfoResponse.anonymous() so
both use the single shared utility.
backend/src/main/java/org/sejongisc/backend/board/dto/PostRequest.java (1)

32-33: API 문서화를 위한 @Schema 어노테이션 추가를 권장합니다.

다른 필드들과의 일관성을 위해 @Schema 어노테이션을 추가하면 Swagger 문서가 더 명확해집니다.

📝 제안
+ `@Schema`(description = "익명 게시 여부 (기본값: false)")
  `@Builder.Default`
  private boolean anonymous = false;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/src/main/java/org/sejongisc/backend/board/dto/PostRequest.java`
around lines 32 - 33, Add an `@Schema` annotation to the PostRequest.anonymous
field to match other fields' API docs; update the field declaration for
anonymous (the boolean with `@Builder.Default`) to include `@Schema`(description =
"익명 여부", defaultValue = "false") or the project's standard description/example
attributes so Swagger shows a clear description and default value for this
field.
backend/src/main/java/org/sejongisc/backend/board/dto/CommentRequest.java (1)

28-29: API 문서화를 위한 @Schema 어노테이션 추가를 권장합니다.

parentCommentId 필드처럼 anonymous 필드에도 @Schema 어노테이션을 추가하면 Swagger 문서의 일관성이 향상됩니다.

📝 제안
+ `@Schema`(description = "익명 여부 (기본값: false)")
  `@Builder.Default`
  private boolean anonymous = false;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/src/main/java/org/sejongisc/backend/board/dto/CommentRequest.java`
around lines 28 - 29, Add a Swagger `@Schema` annotation to the CommentRequest
anonymous field to match the parentCommentId documentation style: annotate the
field (private boolean anonymous) with `@Schema` including a short description
(e.g., "익명 여부"), an example (e.g., "false"), and defaultValue ("false") so API
docs are consistent; keep the existing `@Builder.Default` and boolean anonymous =
false intact in the CommentRequest class.
backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java (2)

74-79: 반환 타입 일관성 검토

deletePost, updateComment, deleteComment 메서드는 void를 반환하지만, 다른 유사한 메서드들(createPost, updatePost, createComment)은 ResponseEntity<Void>를 반환합니다. 일관성을 위해 통일하는 것이 좋습니다.

♻️ 제안 수정
  `@DeleteMapping`("/post/{postId}")
-  public void deletePost(
+  public ResponseEntity<Void> deletePost(
      `@PathVariable` UUID postId,
      `@AuthenticationPrincipal` CustomUserDetails customUserDetails) {
    UUID userId = customUserDetails.getUserId();
    postService.deletePost(postId, userId);
+    return ResponseEntity.ok().build();
  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java`
around lines 74 - 79, Change the void-returning endpoints (deletePost,
updateComment, deleteComment) to return ResponseEntity<Void> like the other
handlers (createPost, updatePost, createComment); update their signatures to
ResponseEntity<Void> and have them return ResponseEntity.noContent().build() (or
an appropriate ResponseEntity) after calling the service methods so response
types are consistent across the controller.

37-39: Swagger description 문자열 가독성 개선 필요

문자열 연결 시 문장 사이에 마침표(.)와 공백 또는 줄바꿈(\n)이 누락되어 Swagger UI에서 "게시물 생성anonymous 값을 true로..."와 같이 붙어서 표시됩니다.

📝 제안 수정
  `@Operation`(
      summary = "게시물 작성",
-      description = "게시판 ID, 제목, 내용, 첨부파일을 포함한 게시물 생성"
-                    + "anonymous 값을 true로 보내면 익명 게시물 작성됨"
-                    + "기본값은 false, 값을 보내지 않으면 기본값으로 설정됨"
+      description = "게시판 ID, 제목, 내용, 첨부파일을 포함한 게시물 생성. "
+                    + "anonymous 값을 true로 보내면 익명 게시물 작성됨. "
+                    + "기본값은 false, 값을 보내지 않으면 기본값으로 설정됨."
  )

참고: Lines 53-55, 70-71, 84-85, 100-101, 117-119, 157-158, 172-173, 187-189, 203-204, 218-219에도 동일한 패턴이 반복됩니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java`
around lines 37 - 39, BoardController.java의 Swagger description 문자열들이 문자열 결합 시
문장 구분 마침표와 공백/줄바꿈이 빠져 Swagger UI에서 문장이 붙어 보입니다; 각 description 문자열(예: description
= "게시판 ID, 제목, 내용, 첨부파일을 포함한 게시물 생성" + "anonymous 값을 true로 보내면...")에 문장 끝에 마침표와
공백 또는 "\n"을 추가해 문장 경계를 명확히 하거나 Java 텍스트 블록(또는 String.join)으로 교체해 문단을 분리하고 동일한
패턴이 반복되는 다른 description 문자열들(파일 내 유사한 description 할당들)도 동일하게 수정하세요.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@backend/src/main/java/org/sejongisc/backend/board/entity/Comment.java`:
- Around line 45-47: Add schema management for the Comment and Post entities:
update schema.sql to include CREATE TABLE statements for the comment and post
tables including the anonymous boolean column (matching Comment.anonymous) or
integrate a migration tool (Flyway or Liquibase) and add versioned migrations
that create these tables; ensure application.yml switches production
hibernate.ddl-auto to "validate" (and keep generate-ddl off for prod) so runtime
DDL generation is disabled, and include the new migration configuration so
schemas are applied at deploy time.

---

Outside diff comments:
In
`@backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java`:
- Around line 208-209: updateComment 메서드의 RequestBody 파라미터에 입력 검증이 빠져 있으니
createComment와 동일하게 updateComment의 `@RequestBody` CommentRequest request 파라미터에
`@Valid` 어노테이션을 추가하고(예: public ResponseEntity<?> updateComment(`@PathVariable` UUID
commentId, `@Valid` `@RequestBody` CommentRequest request, ...)) 필요한 Valid
어노테이션(import javax.validation.Valid 또는 jakarta.validation.Valid)을 추가하여 요청 DTO
검증이 동작하도록 변경하세요.
- Around line 192-193: The createComment endpoint in BoardController is missing
the `@Valid` annotation so CommentRequest DTO constraints are not being enforced;
update the BoardController.createComment method signature to annotate the
CommentRequest parameter with `@Valid` (matching how PostRequest is handled) and
add the appropriate import for javax.validation.Valid or
jakarta.validation.Valid if missing, ensuring CommentRequest's field-level
annotations (e.g., `@NotNull`, `@Size`) are applied during request binding.

In
`@backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java`:
- Around line 70-77: The ActivityEvent for new posts currently uses the real
name (user.getName()) causing anonymous posts to leak the author; in savePost()
change the name passed to new ActivityEvent to use a conditional (e.g.,
post.isAnonymous() ? "익명" : user.getName()) so that when creating the
ActivityEvent via eventPublisher.publishEvent(...) you pass "익명" for anonymous
posts (matching PostInteractionService.createComment() behavior) and the real
name only for non-anonymous posts.

---

Nitpick comments:
In
`@backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java`:
- Around line 74-79: Change the void-returning endpoints (deletePost,
updateComment, deleteComment) to return ResponseEntity<Void> like the other
handlers (createPost, updatePost, createComment); update their signatures to
ResponseEntity<Void> and have them return ResponseEntity.noContent().build() (or
an appropriate ResponseEntity) after calling the service methods so response
types are consistent across the controller.
- Around line 37-39: BoardController.java의 Swagger description 문자열들이 문자열 결합 시 문장
구분 마침표와 공백/줄바꿈이 빠져 Swagger UI에서 문장이 붙어 보입니다; 각 description 문자열(예: description =
"게시판 ID, 제목, 내용, 첨부파일을 포함한 게시물 생성" + "anonymous 값을 true로 보내면...")에 문장 끝에 마침표와 공백
또는 "\n"을 추가해 문장 경계를 명확히 하거나 Java 텍스트 블록(또는 String.join)으로 교체해 문단을 분리하고 동일한 패턴이
반복되는 다른 description 문자열들(파일 내 유사한 description 할당들)도 동일하게 수정하세요.

In `@backend/src/main/java/org/sejongisc/backend/board/dto/CommentRequest.java`:
- Around line 28-29: Add a Swagger `@Schema` annotation to the CommentRequest
anonymous field to match the parentCommentId documentation style: annotate the
field (private boolean anonymous) with `@Schema` including a short description
(e.g., "익명 여부"), an example (e.g., "false"), and defaultValue ("false") so API
docs are consistent; keep the existing `@Builder.Default` and boolean anonymous =
false intact in the CommentRequest class.

In `@backend/src/main/java/org/sejongisc/backend/board/dto/CommentResponse.java`:
- Around line 32-37: Extract the anonymous user creation into a shared factory
on UserInfoResponse: add a public static UserInfoResponse anonymous() that
returns new UserInfoResponse(null, "익명", null, null, null, null, List.of());
then replace the duplicate constructions in CommentResponse.getCommentUser() and
PostServiceImpl.getAnonymousUserInfo() to call UserInfoResponse.anonymous() so
both use the single shared utility.

In `@backend/src/main/java/org/sejongisc/backend/board/dto/PostRequest.java`:
- Around line 32-33: Add an `@Schema` annotation to the PostRequest.anonymous
field to match other fields' API docs; update the field declaration for
anonymous (the boolean with `@Builder.Default`) to include `@Schema`(description =
"익명 여부", defaultValue = "false") or the project's standard description/example
attributes so Swagger shows a clear description and default value for this
field.

In
`@backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java`:
- Around line 318-324: Replace the duplicate anonymous-user construction in
getAnonymousUserInfo() with the centralized factory: remove or refactor
getAnonymousUserInfo() to call UserInfoResponse.anonymous(), and update any
callers (e.g., usages inside PostServiceImpl) to use
UserInfoResponse.anonymous() instead; this consolidates the logic already
duplicated in CommentResponse.getCommentUser() and eliminates the redundant
construction.
- Line 7: Replace the wildcard imports org.sejongisc.backend.board.dto.* and
org.sejongisc.backend.board.repository.* in PostServiceImpl with explicit
imports for the DTO and repository classes actually used in this file (e.g.,
import each specific DTO and repository type referenced by methods in
PostServiceImpl such as PostDto, CreatePostRequest, PostRepository, etc.); you
can run your IDE's "Optimize/Organize Imports" on PostServiceImpl.java to
automatically expand and remove unused imports and ensure only the precise
classes referenced by methods like the PostServiceImpl constructor and its
service methods remain imported.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ba543139-4152-4e52-bd86-9567b22da7ef

📥 Commits

Reviewing files that changed from the base of the PR and between 1de99bf and 614d5c5.

📒 Files selected for processing (9)
  • backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java
  • backend/src/main/java/org/sejongisc/backend/board/dto/CommentRequest.java
  • backend/src/main/java/org/sejongisc/backend/board/dto/CommentResponse.java
  • backend/src/main/java/org/sejongisc/backend/board/dto/PostRequest.java
  • backend/src/main/java/org/sejongisc/backend/board/dto/PostResponse.java
  • backend/src/main/java/org/sejongisc/backend/board/entity/Comment.java
  • backend/src/main/java/org/sejongisc/backend/board/entity/Post.java
  • backend/src/main/java/org/sejongisc/backend/board/service/PostInteractionService.java
  • backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java (1)

57-63: ⚠️ Potential issue | 🟠 Major

수정 API에 생성 DTO를 재사용해서 boardId가 불필요하게 필수가 됐습니다.

PostRequestboardId@NotNull이 걸려 있는데, 실제 수정 로직은 그 값을 쓰지 않습니다. 지금 상태에서는 “게시판 종류는 변경할 수 없음”이라고 문서화해놓고도 클라이언트가 boardId를 억지로 보내야 하며, 잘못된 값도 조용히 무시됩니다. 수정 전용 DTO로 분리하거나 update 경로에서는 boardId 검증을 제거하는 편이 맞습니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java`
around lines 57 - 63, The update API is reusing the create DTO (PostRequest)
which has `@NotNull` on boardId, forcing clients to supply a value that updatePost
doesn't use; fix by introducing an update-specific DTO (e.g., UpdatePostRequest)
without boardId or by removing the `@NotNull` constraint on boardId for update
flows, then change the controller method signature from `@ModelAttribute`
PostRequest to `@ModelAttribute` UpdatePostRequest (or the relaxed PostRequest)
and ensure postService.updatePost(request, postId, userId) accepts the new type;
also update any validation annotations and usages in postService.updatePost to
match the new DTO.
backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java (1)

73-80: ⚠️ Potential issue | 🟠 Major

익명 토글이 기존 활동 이력의 작성자 노출을 되돌리지 못합니다.

savePost()는 사용자명을 ActivityEvent에 문자열로 스냅샷 저장하는데, updatePost()는 이후 익명 여부를 다시 바꿀 수 있게 열어뒀습니다. 그래서 공개 글을 나중에 익명으로 바꾸면 이미 발행된 활동 이력에는 실명이 남습니다. 익명 여부는 최초 작성 시점에만 고정하거나, 관련 활동 이력까지 함께 정정하는 경로가 필요합니다.

Also applies to: 105-115

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java`:
- Around line 57-63: The update API is reusing the create DTO (PostRequest)
which has `@NotNull` on boardId, forcing clients to supply a value that updatePost
doesn't use; fix by introducing an update-specific DTO (e.g., UpdatePostRequest)
without boardId or by removing the `@NotNull` constraint on boardId for update
flows, then change the controller method signature from `@ModelAttribute`
PostRequest to `@ModelAttribute` UpdatePostRequest (or the relaxed PostRequest)
and ensure postService.updatePost(request, postId, userId) accepts the new type;
also update any validation annotations and usages in postService.updatePost to
match the new DTO.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0776ba8b-0835-48c5-9aa0-659c015e3a1c

📥 Commits

Reviewing files that changed from the base of the PR and between 614d5c5 and 67dd3c6.

📒 Files selected for processing (2)
  • backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java
  • backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java

Copy link
Contributor

@discipline24 discipline24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~~

@discipline24 discipline24 merged commit 19c1a31 into main Mar 11, 2026
1 check passed
@discipline24 discipline24 linked an issue Mar 11, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 [기능개선][게시판] 익명 기능 추가

2 participants