Skip to content

Conversation

@ayoung-dev
Copy link
Collaborator

resolved :

👩‍💻 요구 사항과 구현 내용

  • center) id로 name 조회, 커뮤니티 상세 페이지에 들어갈 프로필 조회 기능 삭제
  • volunteer) 커뮤니티 상세 페이지에 들어갈 프로필 조회 기능 삭제
  • 커뮤니티 게시글 상세 조회 response 값의 writer_nickname -> writer_id로 변경
  • 커뮤니티 게시글 리스트 조회 반환값 변경(QueryDSL로 게시글 리스트 조회 시 작성자 nickname 한 번에 조회하도록 수정)

✅ PR 포인트 & 궁금한 점

  • repository에서 DTO를 반환하고 싶지 않아서 추가로 class를 만들긴 했는데 이렇게 하는게 맞는 걸까요?ㅠㅠ

Copy link
Collaborator

@m-a-king m-a-king left a comment

Choose a reason for hiding this comment

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

수고하셨습니다. querydsl 한참 생각해 봤는데, 이렇게 사용하는 것이 맞는 것 같습니다!
혹시 나중에 더 알게 되는 정보가 있다면 공유하겠습니다.


@Getter
@RequiredArgsConstructor
public class CommunityBoardWithNickname {
Copy link
Collaborator

Choose a reason for hiding this comment

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

레코드는 어떨까요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

그리고 이것 자체가 DTO 같은데 추가로 클래스를 만들지 않았다는 PR 포인트가 이해가 잘 안되는데 추가적인 설명을 부탁드리고 싶어요!

Copy link
Collaborator Author

@ayoung-dev ayoung-dev Nov 27, 2024

Choose a reason for hiding this comment

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

추가한 클래스는 repository-service에서 사용하는 엔티티? 개념으로 생각했습니다.
그래서 다른 DTO들과는 차이점이 있다고 생각해서 구분지어 말하려했는데 명확하지 않았던 거 같네요
네이밍을 다르게 해야할 거 같은데 뭐가 좋을지 고민이 되네요..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

CommunityBoardView를 추천해주는데
다들 어떠신지 이거 보시면 남겨주시면 감사하겠습니다

Copy link
Collaborator

Choose a reason for hiding this comment

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

저도 찾아봤는데 마땅히 끌리는게 없어서 아영 님 진행하는대로 따라가게씁니다

Copy link
Collaborator

Choose a reason for hiding this comment

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

repository-service에서 사용하는 엔티티라면 영속성 레이어의 엔티티라고 보면 되는걸까요?
그럼 서비스로 넘길때 뭔가 비즈니스 레이어에서 사용하는 형태로 변형시켜줘야 되는지도 궁금해요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

DB 테이블이랑 직접 매핑되지 않기도 하고 객체 같은 느낌이라 영속성 엔티티라고 보긴 어려울 거 같아요...
그럼.. repository-service단에서 사용하는 DTO라고 하는게 맞을까요?

지금은 기존 entity-dto 처럼 서비스에서 dto로 변환하고 있습니다!

Copy link
Collaborator

Choose a reason for hiding this comment

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

저는 지금 괜찮아보입니다.!
서로다른 두가지 테이블에 있는 데이터를 묶어주기 위한 엔티티로 보이네요

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public record CommunityBoardGetDetailResponseDto(
Long id,
UUID writerId,
Copy link
Collaborator

Choose a reason for hiding this comment

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

volunteerId보다 writerId가 좋을까요? 사실 저도 모르겠어요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

혹시나 추후에 센터도 작성 가능하게 될 걸 고려해서 바꾸지 않았는데 volunteerId로 바꾸는게 나을까요?
저도 고민되어서 바꾸지 않고 그냥 뒀습니다..

Copy link
Collaborator

Choose a reason for hiding this comment

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

이것도 자유롭게 결정해주셔도 될 것 같아요

@7zrv
Copy link
Collaborator

7zrv commented Nov 27, 2024

고생하셨습니다! branch is out-of-date with the base branch가 나오는데 리베이스 한번 해주시면 사라질 것 같습니다

- entity -> dto 메서드 추출
- CommunityBoardView record로 변경
- CommunityBoard 조회 쿼리 추출
Copy link
Collaborator

@leebs0521 leebs0521 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다.


@Getter
@RequiredArgsConstructor
public class CommunityBoardWithNickname {
Copy link
Collaborator

Choose a reason for hiding this comment

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

저는 지금 괜찮아보입니다.!
서로다른 두가지 테이블에 있는 데이터를 묶어주기 위한 엔티티로 보이네요

.selectFrom(communityBoard)
.select(Projections.constructor(CommunityBoardWithNickname.class,
communityBoard,
volunteer.nickname))
Copy link
Collaborator

Choose a reason for hiding this comment

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

감사합니다... 이 방법 전 좋아요

…project/WEB1_1_Bongdari_BE into refactor/60-modify-community-board-query

# Conflicts:
#	src/main/java/com/somemore/community/service/CommunityBoardQueryService.java
@sonarqubecloud
Copy link

Copy link
Collaborator

@m-a-king m-a-king left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!!!

@ayoung-dev ayoung-dev merged commit 49bff8b into main Nov 28, 2024
2 checks passed
@ayoung-dev ayoung-dev deleted the refactor/60-modify-community-board-query branch November 28, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] 커뮤니티 게시글 조회 기능 리팩토링 (봉사자로 한정)

5 participants