feat(social): 댓글/대댓글, 좋아요 기능 및 신고, 소셜 정지 기능 구현#167
Merged
Conversation
daily_report_id, author_id, parent_comment_id FK 구성, 댓글/대댓글 구조, 리포지토리 구현
댓글/대댓글 CRUD API 구현, 비밀 댓글 열람 권한 및 마스킹 처리, 차단·탈퇴 유저 필터링, visibleSubCommentCount 계산
피드 응답에 내 공유 리포트(myReport) 필드 추가
COMMENT_ON_MY_REPORT, REPLY_ON_MY_COMMENT, REPLY_ON_PARTICIPATED_COMMENT 알림 타입 추가, 알림 대상 탈퇴 유저 필터링, FriendNotificationEventListener 패키지 friend → social 이동
삭제된 댓글도 유지하는 것이 추후 확장 시에 유리할 것이라 생각해 물리 삭제에서 소프트 딜리트로 전환
daily_report_likes, comment_likes 테이블 마이그레이션 추가, 게시글·댓글/대댓글 좋아요·취소·리스트 API 구현, CommentResponse, FeedResponse에 isLiked·hasLikes 필드 추가, FeedListResponse에 myReport 필드 추가
social_suspensions 테이블 추가 및 content_reports 테이블에 comment_id 컬럼 추가, daily_report_id FK를 ON DELETE SET NULL로 변경해 게시글 삭제 후에도 신고 이력 보존, 기존 SharingSuspensionService를 social_suspensions 기반으로 재구현, 신고 누적 조건 만족시 정지 자동 발동, 오늘 공유 게시글 일괄 비공개 처리, 정지 상태 조회 API 추가
CommentCommandService·LikeCommandService의 write 메서드 전체에 소셜 정지 상태인지 체크하는 메서드 추가, CommentQueryService·LikeQueryService의 getExcludedUserIds에 지 중인 유저 ID를 포함해 조회 시 자동 필터링, CommentRepository 댓글·대댓글·서브카운트 쿼리 3개에 NOT EXISTS 서브쿼리 추가하여 내가 신고한 댓글 미노출
countAllReports / countAllDistinctReporters 새 메서드 추가, @Modifying(clearAutomatically = true) 추가, deleteComment Swagger에 409 COMMENT_DELETED 추가
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.
📝 요약(Summary)
친구 피드 기반 소셜 기능(댓글/대댓글·좋아요·신고 개편)을 구현했습니다.
API
Method: GET
Path: /api/v1/comments?dailyReportId={id}
설명: 댓글 목록 (커서 기반, 최신순)
────────────────────────────────────────
Method: POST
Path: /api/v1/comments
설명: 댓글 작성
────────────────────────────────────────
Method: GET
Path: /api/v1/comments/{commentId}/sub-comments
설명: 대댓글 목록 (커서 기반)
────────────────────────────────────────
Method: POST
Path: /api/v1/comments/{commentId}/sub-comments
설명: 대댓글 작성
────────────────────────────────────────
Method: PATCH
Path: /api/v1/comments/{commentId}
설명: 내용 수정 (작성자 본인만, isSecret 변경 불가)
────────────────────────────────────────
Method: DELETE
Path: /api/v1/comments/{commentId}
설명: 삭제 (작성자 본인 또는 리포트 당사자)
접근 제어
비밀 댓글
조회 필터링 (getExcludedUserIds)
visibleSubCommentCount
전체 대댓글 수에서 위 필터 대상 + 열람 권한 없는 비밀 대댓글을 제외한 값. 단일 집계 쿼리(countVisibleSubCommentsByParentIds)로 처리
소프트딜리트
알림 (즉시 FCM)
피드 응답 변경
GET /api/v1/feed 응답에 myReport(오늘 내 공유 리포트, 미공유 시 null) 필드 추가
API
Method: POST
Path: /api/v1/feed/{dailyReportId}/likes
설명: 게시글 좋아요
────────────────────────────────────────
Method: DELETE
Path: /api/v1/feed/{dailyReportId}/likes
설명: 게시글 좋아요 취소
────────────────────────────────────────
Method: GET
Path: /api/v1/feed/{dailyReportId}/likes
설명: 게시글 좋아요 리스트 (리포트 당사자만)
────────────────────────────────────────
Method: POST
Path: /api/v1/comments/{commentId}/likes
설명: 댓글/대댓글 좋아요
────────────────────────────────────────
Method: DELETE
Path: /api/v1/comments/{commentId}/likes
설명: 댓글/대댓글 좋아요 취소
────────────────────────────────────────
Method: GET
Path: /api/v1/comments/{commentId}/likes
설명: 댓글/대댓글 좋아요 리스트
제약 조건
좋아요 리스트 응답
최신순, 차단 관계 양방향 + 정지 유저 제외. isFriend 플래그로 친구 여부 전달(친구면 삭제/차단, 아니면 친구 신청 버튼)
피드·댓글 응답 변경
DB 변경
신고 API 변경
POST /api/v1/moderation/reports에 commentId 추가 (nullable). dailyReportId / commentId 중 하나 필수. 게시글·댓글 신고 단일 테이블 통합
소셜 정지 자동 발동
정지 중 차단 API
댓글 작성·수정·삭제, 게시글/댓글 좋아요·취소 → SOCIAL_SUSPENDED(400)
신규 API
GET /api/v1/moderation/suspension/status — 정지 여부 및 해제일 반환 (팝업용)
🔗 Related Issue
💬 공유사항
✅ PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.