Skip to content

Feature/comment#29

Merged
YuuuuuuYu merged 11 commits intodevelopfrom
feature/comment
Feb 24, 2025
Merged

Feature/comment#29
YuuuuuuYu merged 11 commits intodevelopfrom
feature/comment

Conversation

@YuuuuuuYu
Copy link
Member

🚀 작업 내용 설명

  • 댓글 생성 추가
  • 댓글 조회 추가

📢 그 외

  • 지금은 BaseEntity에서 createdBy, updatedBy가 null로 들어갑니다. 별도로 Auditor 설정을 해야하는데 현재 UserInfo의 userId 값으로 넣으려고 하지만 이 값이 Long 타입이어서 1차 MVP 이후에 다시 검토할 예정입니다.

📌 �관련 이슈

#24

@YuuuuuuYu YuuuuuuYu added the enhancement New feature or request label Feb 24, 2025
@YuuuuuuYu YuuuuuuYu requested a review from wlsh44 February 24, 2025 03:24
@YuuuuuuYu YuuuuuuYu self-assigned this Feb 24, 2025
Copy link
Contributor

@wlsh44 wlsh44 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 몇 가지만 수정해주시면 좋을 것 같아요!

지금은 BaseEntity에서 createdBy, updatedBy가 null로 들어갑니다. 별도로 Auditor 설정을 해야하는데 현재 UserInfo의 userId 값으로 넣으려고 하지만 이 값이 Long 타입이어서 1차 MVP 이후에 다시 검토할 예정입니다.

요 부분도 확인했습니다

package com.swyp8team2.comment.domain;

import com.swyp8team2.common.domain.BaseEntity;
import jakarta.persistence.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

요거 개별 import로 수정해주시면 좋을 것 같아요


@GetMapping("")
public ResponseEntity<CursorBasePaginatedResponse<CommentResponse>> findComments(
public ResponseEntity<CursorBasePaginatedResponse<CommentResponse>> selectComments(
Copy link
Contributor

Choose a reason for hiding this comment

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

이거는 통일하면 좋을 것 같은데 조회에서는 select를 더 선호하시나요?

Copy link
Member Author

Choose a reason for hiding this comment

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

create update에 맞춰서 select했었는데 그 외에는 큰 이유가 없어서
select는 find로 통일하도록 하겠습니다

CursorBasePaginatedResponse<CommentResponse> response =
new CursorBasePaginatedResponse<>(null, false, commentList);

when(commentService.selectComments(eq(postId), eq(cursor), eq(size))).thenReturn(response);
Copy link
Contributor

Choose a reason for hiding this comment

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

이건 취향인데 저는 개인적으로 BDDMockitogiven을 더 선호하기는 합니다!
물론 이대로 냅두셔도 좋아요~

Copy link
Member Author

Choose a reason for hiding this comment

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

리팩토링 기간에 given도 참고하면서 비교해보겠습니다!

fieldWithPath("data[].voteId")
.type(JsonFieldType.NUMBER)
.optional()
.description("작성자 투표 Id (투표 없을 시 null)"),
Copy link
Contributor

Choose a reason for hiding this comment

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

이거 댓글 작성자가 어떤 사진에 투표했는지 알기 위해서 추가한 값이라 있어야 할 것 같아요
아직 제가 투표 구현한 걸 못 올려서 dto 만들 때 null 값으로 넣고 응답하는 식으로 해주시면 감사하겠습니다!


private CommentResponse createCommentResponse(Comment comment) {
Optional<User> user = userRepository.findById(comment.getUserNo());
return CommentResponse.of(comment, user.get());
Copy link
Contributor

Choose a reason for hiding this comment

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

user.get()에서 유저가 없을 때 예외처리가 필요할 것 같습니다

@YuuuuuuYu
Copy link
Member Author

내용 수정했습니다!

Copy link
Contributor

@wlsh44 wlsh44 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

@YuuuuuuYu YuuuuuuYu merged commit 17f13e6 into develop Feb 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants