Conversation
- 차후 각 서비스로 이전 예정
- PostDetailResponseDTO, PollInfoResponseDTO를 포함하는 PostPageItemResponseDTO 래퍼 도입 - 목록/상세/베스트 등 모든 게시글 응답을 래퍼 DTO(List<PostPageItemResponseDTO> 등)로 일원화 - 중복 DTO 변환 로직 toPageItemDTO로 통합, Object 반환/instanceof 분기 제거
- 이전 postDetailResponse 변경 전파 사항
- PostService의 이미지, 조회수, 베스트, 투표 등 부가 기능/서브 로직을 SeperatedPostService로 분리 - PostService는 핵심 비즈니스 흐름/응답 조립에만 집중하도록 응집도(cohesion) 강화 - 부가 기능은 별도 서비스로 위임하여 결합도(coupling) 낮춤 - 테스트 코드도 DI 구조에 맞게 리팩토링
- post, comment, reply 의 user 정보 mapping
- 댓글/대댓글 추가/삭제 시 댓글 수 및 BestScore 반영 순서 정비 - 조회 로직 내 사용자 정보 매핑, 응답 DTO 생성 등 책임 분리 - 중복 제거 및 성능 고려 유저 정보 조회 방식 적용
- 상위 도메인 Repository 직접 참조 제거 (Comment → Post 등) - 상위 도메인 쿼리 서비스(PostQueryService 등)에서 유효성 검사 처리 - 의존성 순환 문제 발생 → Query/Command 분리로 해결
- Post 도메인 내 Scheduler 및 ErrorCode 의존성 정리 - 도메인 계층별로 올바른 ErrorCode 및 예외 처리 방식 적용
- 각 서비스내 redisBestService 호출 Best Domain으로 책임 이동
221 Refactor Post 및 하위 도메인 PR 머지
feat : 투표 이벤트 관련 API 비로그인 유저 접근 허용
Contributor
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthrough이 PR은 게시판/댓글/대댓글/투표 전반에 CQRS(명령/조회) 구조로 리팩터링하고, DTO/예외/스케줄러/베스트 포스트/보안 유틸을 재구성했습니다. 다수의 컨트롤러 시그니처가 Void 응답으로 변경되었고, 엔티티 팩토리 메서드 도입, 패키지 경로 정리, 테스트 스위트 대거 추가 및 기존 서비스(단일 Post/Comment/Poll 등) 제거가 포함됩니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant PC as PostController
participant PCS as PostCommandService
participant PQS as PostQueryService
participant OA as OwnershipPolicy
participant PI as PostInteractionService
participant PR as PostRepository
Note over PC,PCS: 생성/수정(Delete 포함) = Command 흐름
U->>PC: createPost(request, images)
PC->>PCS: createPost(...)
PCS->>PI: handleImageUpload(images)
PCS->>PR: save(PostEntity.create(...))
PR-->>PCS: Post saved
PCS-->>PC: void
PC-->>U: 201 Created (Void)
Note over PC,PQS: 조회 = Query 흐름
U->>PC: getPostWithDetail(postId)
PC->>PQS: getPostWithDetail(postId)
PQS->>PR: findByIdAndNotDeleted
PR-->>PQS: PostEntity
PQS->>PI: increaseHits(post, currentUser)
PQS-->>PC: PostPageItemResponseDTO
PC-->>U: 200 OK (DTO)
sequenceDiagram
autonumber
actor U as User
participant PollC as PollController
participant PollCS as PollCommandService
participant PollQS as PollQueryService
participant PoR as PostRepository
participant PlR as PollRepository
participant PVR as PollVoteRepository
Note over PollC,PollCS: 투표 생성 (Command)
U->>PollC: createPoll(dto)
PollC->>PollCS: createPoll(dto)
PollCS->>PoR: save(PostEntity.create(...))
PollCS->>PlR: save(PollEntity.from(...))
PlR-->>PollCS: Poll saved
PollCS-->>PollC: void
PollC-->>U: 201 Created (Void)
Note over PollC,PollCS: 투표하기 (Command)
U->>PollC: votingPoll(postId, selections)
PollC->>PollCS: votingPoll(...)
PollCS->>PlR: findByPostId(postId)
PollCS->>PVR: existsByPollIdAndUserId
PollCS->>PlR: incOption / validate
PollCS->>PVR: save(PollVoteEntity.from(...))
PollCS-->>PollC: void
PollC-->>U: 201 Created (Void)
Note over PollC,PollQS: 투표 정보 조회 (Query)
U->>PollC: getPollInfo(postId)
PollC->>PollQS: getPollInfo(post, userId)
PollQS->>PlR: findByPostId
PollQS->>PVR: countByPollId / findByPollIdAndUserId
PollQS-->>PollC: PollInfoResponseDTO
PollC-->>U: 200 OK (DTO)
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (91)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣ 연관된 이슈
#263
#242
Summary by CodeRabbit
신규 기능
리팩터링
문서
테스트