Skip to content

[4주차] 김동빈/feat 게시물·댓글·신고 도메인 상태 전이 및 중복 방지 및 게시글 좋아요 API 구현#139

Open
kdobi wants to merge 5 commits intoLeets-Official:김동빈/mainfrom
kdobi:김동빈/4주차

Hidden character warning

The head ref may contain hidden characters: "\uae40\ub3d9\ube48/4\uc8fc\ucc28"
Open

[4주차] 김동빈/feat 게시물·댓글·신고 도메인 상태 전이 및 중복 방지 및 게시글 좋아요 API 구현#139
kdobi wants to merge 5 commits intoLeets-Official:김동빈/mainfrom
kdobi:김동빈/4주차

Conversation

@kdobi
Copy link
Copy Markdown

@kdobi kdobi commented Apr 28, 2026

1. 과제 요구사항 중 구현한 내용

  • 게시물/댓글/신고 도메인 활용
  • 상태 변경PENDING -> RESOLVED 구현
  • 단순 CRUD를 넘는 기능 설계 및 구현
  • API 3개 이상 구현
  • 게시글 좋아요 기능 구현

구현 API(주요):

  • POST /api/posts/{postId}/reports 게시물 신고
  • POST /api/comments/{commentId}/reports 댓글 신고
  • PATCH /api/reports/{reportId}/resolve 신고 처리 완료 (PENDING -> RESOLVED)
  • POST /api/posts/{postId}/likes 게시물 좋아요 생성 및 중복 좋아요 방지 처리

2. 핵심 변경 사항

  • 신고 ( report ) => 게시물/댓글 신고 API 및 신고 처리 완료 API 구현, 신고 상태 PENDING/
    RESOLVED 관리

  • 좋아요 ( like ) => 게시물 좋아요 생성 API 구현, 동일 유저의 동일 게시물 좋아요 중복
    방지

3. 실행 및 검증 결과

  • 실행 결과:
  • GET /health 응답:
  • POST /string/repeat 요청/응답:

4. 완료 사항

  1. 게시글 신고
게시글 신고
  1. 댓글 신고
댓글 신고
  1. 신고 중복 검증
댓글 신고 중복 검증
  1. 게시글 좋아요
게시글 좋야요
  1. 좋아요 중복 검증
좋아요 중복 검증

5. 추가 사항

  • 관련 이슈: closed #134

제출 체크리스트

  • PR 제목이 규칙에 맞다
  • base가 {이름}/main 브랜치다
  • compare가 {이름}/{숫자}주차 브랜치다
  • 프로젝트가 정상 실행된다
  • 본인을 Assignee로 지정했다
  • 파트 담당 Reviewer를 지정했다
  • [] 리뷰 피드백을 반영한 뒤 머지/PR close를 진행한다

Reviewer 참고

@kdobi kdobi requested a review from a team April 28, 2026 07:35
@kdobi kdobi self-assigned this Apr 28, 2026
@HandoA01
Copy link
Copy Markdown

4주차 개발도 수고 많으셨습니다!!

Comment on lines +53 to +59
public static PostReport create(User user, Post post, String reason) {
return PostReport.builder()
.user(user)
.post(post)
.reason(reason)
.build();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

엔티티에 create() 정적 팩토리 메서드를 둬서 객체 생성을 캡슐화한 부분 좋네요. 저는 Converter 클래스로 빼서 처리했는데, 이렇게 엔티티 안에 두니까 서비스에서 PostReport.create(user, post, reason) 한 줄로 끝나서 더 깔끔한 것 같습니다!! 잘 배워갑니다! :)

@HyeonSeongIM HyeonSeongIM self-requested a review April 30, 2026 05:42
@Getter
@Builder
@AllArgsConstructor
public class PostLikeResponse {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

DTO를 class 형태가 아닌 record 형태로 바꿔보시는 건 어떨까요?! record만의 장점이 따로 있는데 이 장점들이 DTO에 적합한거 같아요!


@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

서비스 전체에 트랜잭션을 건다면 추후 코드가 확장될 때 무자비한 트랜잭션들이 걸릴 것 같습니다!

@@ -52,4 +72,8 @@ public void update(String title, String content) {
this.content = content;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

update 메서드로직을 보니 title이 null이거나 blank일 경우 content가 같이 업데이트 되지 않을 수도 있을 거 같아요! 의도하신게 아니라면 두 개를 분리해서 체크하시는게 어떨까 합니당

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.

4 participants