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/#34 Review API #35

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open

Feat/#34 Review API #35

wants to merge 15 commits into from

Conversation

JiinHong
Copy link
Collaborator

🌍 이슈 번호

#34

📝 구현 내용

리뷰 등록 API
포토부스 별점 조회 API
포토부스 사진 6개 조회 API
포토부스 최근 리뷰 2개 조회 API
모든 리뷰 사진 조회 API
리뷰 포토부스 특징 조회 API
리뷰 촬영 특징 조회 API
포토부스 이름 조회(at 리뷰 등록 페이지) API

🍀 확인해야 할 부분

이미지 파일을 불러올 때도 presigned URL을 발급해줘야됨.
이건 추후에 수정할 예정입니다~

@Jeongh00 Jeongh00 added the api This will not be worked on label Oct 13, 2024
List<JpaReview> findTop2ByPhotoBoothIdOrderByIdDesc(@Param("photoboothId") Long photoboothId);

@Query("SELECT bf, COUNT(r) as featureCount FROM JpaReview r JOIN r.review.boothFeatures bf WHERE r.photoBooth.id = :photoboothId GROUP BY bf ORDER BY featureCount DESC")
List<Object[]> findTop4ByBoothFeature(@Param("photoboothId") Long photoboothId);
Copy link
Member

Choose a reason for hiding this comment

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

Object[] 로 반환하는 방식이 과연 최선의 방식일까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ReviewPhotoFeatureDto와 ReviewBoothFeatureDto를 이용하는 방식을 바꾸겠습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

시도해봤는데, JPA에서 쿼리 결과를 DTO로 변환할 때 오류가 발생했습니다.
JPA가 Tuple 형식으로 반환하는데, 자동으로 ReviewPhotoFeatureDto로 변환할 수 없다고 합니다.
JPQL 대신 네이티브 쿼리 사용하거나, JPQL에서 new를 이용해서 DTO를 매핑하는 방법이 있는데, 이 두 방식보다는 Object[]를 이용하는 것이 나을 것 같아서 이건 유지하겠습니다!

Copy link
Member

Choose a reason for hiding this comment

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

Object[] 를 쓰면 어떤 게 안 좋을까요?^^ 타입 안정성도 떨어지고 가독성도 떨어지겠죠? 저럴 때 쓰기 좋은게 QueryDSL 이에요 저건 제가 수정하겠습니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

넵!!

Copy link
Member

@Jeongh00 Jeongh00 left a comment

Choose a reason for hiding this comment

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

전체적으로 잘했고,, comment 단것들 수정해주세요 ^^ 고생하셨습니당


List<BoothFeatureDTO> findTop4ByBoothFeature(Long photoboothId);

List<PhotoFeatureDTO> findTop4ByPhotoFeature(Long photoboothId);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

도메인 모듈에 ReviewBoothFeatureDto와, ReviewPhotoFeatureDto를 만들어 놓았는데, outbound에서 Dto를 한 번 더 만들어서, 또 변환해야할 이유가 있나요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants