Skip to content

SISC-BE-부모게시판 목록 조회#123

Merged
discipline24 merged 7 commits intomainfrom
SIsC1-151-BE-게시판-추가
Nov 19, 2025

Hidden character warning

The head ref may contain hidden characters: "SIsC1-151-BE-\uac8c\uc2dc\ud310-\ucd94\uac00"
Merged

SISC-BE-부모게시판 목록 조회#123
discipline24 merged 7 commits intomainfrom
SIsC1-151-BE-게시판-추가

Conversation

@nayoung04
Copy link
Contributor

@nayoung04 nayoung04 commented Nov 19, 2025

Summary by CodeRabbit

  • 새로운 기능
    • 최상위(부모) 게시판 목록을 조회하는 신규 API 엔드포인트가 추가되었습니다. 인증된 사용자가 호출하면 최상위 레벨의 게시판들을 일괄로 받아볼 수 있어 게시판 구조 확인 및 UI 구성에 편의성이 향상됩니다.

@coderabbitai
Copy link

coderabbitai bot commented Nov 19, 2025

Walkthrough

새로운 API 엔드포인트 GET /api/board/parents가 추가되어 인증된 사용자로부터 PostService의 getParentBoards()를 호출해 부모 보드 목록을 BoardResponse 리스트로 반환합니다. BoardResponse DTO와 Repository 조회 메서드도 추가되었습니다.

Changes

Cohort / File(s) 변경 요약
컨트롤러
backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java
새 엔드포인트 getParentBoards() 추가: GET /api/board/parents, @AuthenticationPrincipal 요구, ResponseEntity<List<BoardResponse>> 반환으로 postService.getParentBoards() 호출.
DTO
backend/src/main/java/org/sejongisc/backend/board/dto/BoardResponse.java
새로운 DTO 클래스 추가: boardId(UUID), boardName(String), createdBy(User), parentBoardId(UUID). Lombok 어노테이션 및 정적 팩토리 메서드 of(Board) 추가.
저장소
backend/src/main/java/org/sejongisc/backend/board/repository/BoardRepository.java
List<Board> findAllByParentBoardIsNull() 메서드 시그니처 추가(부모가 없는 최상위 보드 조회).
서비스 인터페이스
backend/src/main/java/org/sejongisc/backend/board/service/PostService.java
List<BoardResponse> getParentBoards() 메서드 선언 추가.
서비스 구현
backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java
@Transactional(readOnly = true)getParentBoards() 구현 추가: findAllByParentBoardIsNull() 결과를 BoardResponse.of()로 매핑하여 반환. (파일에 동일 구현의 중복 선언이 존재하는 것으로 보임)

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller as BoardController
    participant Service as PostService
    participant Repo as BoardRepository

    Client->>Controller: GET /api/board/parents (with auth)
    activate Controller
    Controller->>Service: getParentBoards()
    activate Service
    Service->>Repo: findAllByParentBoardIsNull()
    activate Repo
    Repo-->>Service: List<Board> (parentBoard == null)
    deactivate Repo
    Note over Service: Map each Board -> BoardResponse.of()
    Service-->>Controller: List<BoardResponse>
    deactivate Service
    Controller-->>Client: 200 OK (List<BoardResponse>)
    deactivate Controller
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30분

  • 추가로 집중 검토할 항목:
    • PostServiceImpl 파일 내 getParentBoards() 중복 선언 여부 및 불필요 복제 제거.
    • Controller의 라우팅/애노테이션(경로 및 HTTP 메서드)이 기존 엔드포인트와 충돌하는지 확인.
    • BoardResponse.of()의 null 안전성(특히 createdByparentBoard) 검증.

Possibly related PRs

Suggested reviewers

  • discipline24

Poem

"나는 당근 들고 달려왔네,
부모 없는 판을 찾아내는 기쁨이네. 🥕
DTO로 포장해 전해줄게,
컨트롤러 문 열고 호출하면,
보드들이 줄지어 인사하네!"

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 핵심인 부모 게시판 목록 조회 기능 추가를 명확하게 나타냅니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch SIsC1-151-BE-게시판-추가

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8deff33 and a044291.

📒 Files selected for processing (1)
  • backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java

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

🧹 Nitpick comments (3)
backend/src/main/java/org/sejongisc/backend/board/repository/BoardRepository.java (1)

3-10: 최상위 게시판 조회 메서드 정의 적절함

findAllByParentBoardIsNull() 네이밍이 명확하고 Spring Data JPA 규칙에 잘 맞습니다. 최상위(부모 없음) 게시판 조회 용도로 충분히 직관적입니다.
프론트에서 일관된 정렬(예: 생성일 오름차순, 이름순 등)을 요구한다면, findAllByParentBoardIsNullOrderByCreatedDateAsc() 같은 메서드를 추가로 두는 것도 장기적으로는 고려해볼 만합니다.

backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java (1)

298-307: 부모 게시판 조회 로직이 단순하고 역할에 충실함

findAllByParentBoardIsNull()으로 엔티티를 조회하고, BoardResponse.of()로 DTO 매핑하는 흐름이 간결하고 이해하기 쉽습니다. @Transactional(readOnly = true) 도입도 적절합니다.
다만, 화면에서 특정 정렬 순서를 기대한다면 이 단계에서 정렬(예: 생성일/이름 기준)을 보장하도록 Repository 메서드 또는 Stream 정렬을 추가하는 것도 고려해볼 수 있습니다.

backend/src/main/java/org/sejongisc/backend/board/dto/BoardResponse.java (1)

1-37: 매핑 로직은 명확하지만 User 엔티티 직접 노출은 장기적으로 리스크

BoardResponse.of(Board board)에서 boardId, boardName, createdBy, parentBoardId를 빌더로 매핑하는 부분은 간결하고 NPE 처리도 잘 되어 있습니다.

다만 createdBy 타입을 User 엔티티로 두면:

  • User 안에 비밀번호 해시, 이메일 등 민감 정보가 포함되어 있을 경우 그대로 API 응답에 노출될 수 있고,
  • 양방향 연관관계가 걸려 있다면 직렬화 시 순환 참조나 과도한 JSON 페이로드가 생길 수 있습니다.

새 DTO 도입 부담이 있다면 당장은 유지하되, 중장기적으로는 예를 들어 UserSummaryResponse(userId, nickname 정도만 포함) 같은 별도 DTO로 축소하여 응답하는 구조로 리팩터링하는 것을 추천합니다.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62ef6e8 and 8deff33.

📒 Files selected for processing (5)
  • backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java (2 hunks)
  • backend/src/main/java/org/sejongisc/backend/board/dto/BoardResponse.java (1 hunks)
  • backend/src/main/java/org/sejongisc/backend/board/repository/BoardRepository.java (1 hunks)
  • backend/src/main/java/org/sejongisc/backend/board/service/PostService.java (2 hunks)
  • backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
backend/src/main/java/org/sejongisc/backend/board/controller/BoardController.java (1)
backend/src/main/java/org/sejongisc/backend/common/auth/springsecurity/CustomUserDetailsService.java (1)
  • RequiredArgsConstructor (16-38)
🔇 Additional comments (2)
backend/src/main/java/org/sejongisc/backend/board/service/PostService.java (1)

3-7: Service 인터페이스에 부모 게시판 조회 기능이 자연스럽게 확장됨

List<BoardResponse> getParentBoards() 추가로 부모 게시판 조회 책임이 PostService에 잘 녹아들었습니다. DTO를 반환하도록 설계한 점도 컨트롤러와의 경계를 명확히 해 줍니다.

Also applies to: 34-35

backend/src/main/java/org/sejongisc/backend/board/service/PostServiceImpl.java (1)

8-8: createBoard 오버라이드 명시로 구현 명확성 향상

인터페이스 PostService#createBoard에 대응하는 구현 메서드에 @Override를 명시해 둔 것은 유지보수 시 시그니처 변경 누락을 방지하는 데 도움이 됩니다. 로직 자체는 기존 구현을 잘 유지하고 있어 문제 없습니다.

Also applies to: 268-296

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 e3a08ac into main Nov 19, 2025
1 check passed
@discipline24 discipline24 deleted the SIsC1-151-BE-게시판-추가 branch November 19, 2025 11:26
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