Skip to content

Conversation

@GoHyunA
Copy link
Collaborator

@GoHyunA GoHyunA commented Jul 12, 2025

#️⃣ 연관 이슈

feat/12

📝 요약

댓글 CRUD 기본 구현
게시글(Cast)에 댓글을 달고 / 조회하고 / 수정하고 / 삭제할 수 있는 REST API 제공

  • Comment 엔티티 보강 (content 길이 255, FK nullable, updatedAt 제거)
    -CommentRepository 생성 - findByCastIdOrderByCreatedAtAsc
    -DTO 3종 - CreateCommentRequest, UpdateCommentRequest, CommentResponse
    -CommentService 작성 - CRUD + 작성자 권한 검증
    -CommentController 작성 (POST/GET/PUT/DELETE 엔드포인트)

🙏 리뷰 요청사항

리뷰어가 확인해줬으면 하는 부분을 적어주세요

✅ PR 유형

다음과 같은 변경 사항이 있습니다.

  • [v] 새로운 기능 추가
  • [v] 기존 로직 수정
  • 버그 수정
  • 코드에 영향을 주지 않는 변경사항 (주석 및 오타 수정, 탭 사이즈 변경, 변수명 변경)
  • 코드 리팩토링
  • 파일 혹은 폴더명 수정
  • 파일 혹은 폴더 삭제
  • 문서 수정

변경사항 상세

Comment 엔티티 수정

content 컬럼 → @column(length = 255, nullable = false)
member, cast 연관관계 → optional = true (DDL 일치)
updatedAt 필드 제거

##CommentRepository 생성
findByCastIdOrderByCreatedAtAsc(Long castId)
@entitygraph(attributePaths = "member")로 N+1 방지

DTO 3종 생성

CreateCommentRequest (댓글 등록용)
UpdateCommentRequest (댓글 수정용)
CommentResponse (Comment → 응답 객체로 변환)

CommentService 구현

create, list, update, delete 메서드 작성
Cast, Member 조회 + 작성자 권한 체크

CommentController 구현

REST 엔드포인트
POST /casts/{castId}/comments
GET /casts/{castId}/comments
PUT /casts/{castId}/comments/{commentId}
DELETE /casts/{castId}/comments/{commentId}
CastRepository 생성 (JpaRepository<Cast, Long>)

GoHyunA added 4 commits July 12, 2025 23:57
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@GoHyunA GoHyunA linked an issue Jul 12, 2025 that may be closed by this pull request
5 tasks
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.

feat: comment 기능 구현

2 participants