Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] 댓글 조회 기능 #90 #124

Merged
merged 14 commits into from
Jan 22, 2025
Merged

[Feat] 댓글 조회 기능 #90 #124

merged 14 commits into from
Jan 22, 2025

Conversation

yr0202
Copy link
Collaborator

@yr0202 yr0202 commented Jan 21, 2025

🚀 Pull Request

  • 댓글 조회 기능입니다
  • 커서 기반 페이징 처리 하였습니다

#️⃣ 연관된 이슈

📋 작업 내용

  • 컨트롤러, 서비스, 커스텀 레파지토리를 구현하였습니다.

🔧 변경된 코드 설명

  • 기존에는 offset 기반으로 페이징처리를 하였는데 커서기반으로 바꾸었습니다.
  • CommentRepositoryCustomCommentRepositoryCustomImpl로 나누어 작성하였습니다. 그 이유는 아래와 같습니다

Custom Repository의 역할

Spring Data JPA에서 기본적으로 제공되지 않는 복잡한 쿼리나 커스텀 로직을 구현하기 위해 Custom Repository를 사용합니다.

CommentRepositoryCustom (인터페이스): 사용자 정의 쿼리를 선언하기 위한 계약 역할을 합니다.
실제 구현 내용은 포함하지 않고, 필요한 메서드의 시그니처만 정의합니다.
CommentRepositoryCustomImpl (구현체): CommentRepositoryCustom 인터페이스를 구현하여 실제 QueryDSL 기반의 복잡한 쿼리 로직을 작성합니다.

구조 요약

CommentRepository
├── JpaRepository<Comment, Long>
├── CommentRepositoryCustom
└── CommentRepositoryCustomImpl (QueryDSL 구현체)

✅ 테스트 여부

  • 테스트 코드 실행 여부
  • 서버 실행 여부
  • 스웨거 테스트 여부

👽 비고

  • FortuneContentReadRepositoryTest 에서 테스트 실패합니다.
  • Expected :2, Actual :0여서 값 확인 해보셔야 할 것 같아요

@yr0202 yr0202 linked an issue Jan 21, 2025 that may be closed by this pull request
Copy link
Collaborator

@yschoi123 yschoi123 left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines 36 to 38
@RequestParam Long postId,
@RequestParam(required = false) Long cursorKey,
@RequestParam(defaultValue = "10") Integer size) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

DTO로 분리해서 관리하면 편합니다

@GetMapping("/search")
	public ResponseEntity<List<ContentReadListDto>> searchFortuneContent(
		@ParameterObject @ModelAttribute SearchRequest searchRequest
	) {
		// 키워드를 포함하는 이름을 가진 컨텐츠 목록 가져오기
		List<ContentReadListDto> searchResult = fortuneContentService.getSearchList(searchRequest);

		return ResponseEntity
			.status(HttpStatus.OK)
			.body(searchResult);
	}

위 코드 참고해 주세욥 😃

Copy link
Collaborator

@dona722 dona722 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~

@yr0202 yr0202 merged commit 02ac49f into dev Jan 22, 2025
2 checks passed
@yr0202 yr0202 deleted the feature/comment-read/#90 branch February 9, 2025 06:36
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] 댓글/대댓글 조회
4 participants