Skip to content

Commit

Permalink
feat: 리뷰 남긴 카페 조회 시 내가 남긴 리뷰 함께 조회
Browse files Browse the repository at this point in the history
  • Loading branch information
jung-woo-kim committed Nov 12, 2023
1 parent cfbc66b commit 98f4286
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mocacong.server.dto.response;

import lombok.*;
import mocacong.server.domain.CafeDetail;
import mocacong.server.domain.cafedetail.StudyType;

@Getter
Expand All @@ -13,12 +14,24 @@ public class MyReviewCafeResponse {
private String myStudyType;
private int myScore;
private String roadAddress;
private String wifi;
private String parking;
private String toilet;
private String power;
private String sound;
private String desk;

public MyReviewCafeResponse(String mapId, String name, StudyType myStudyType, int myScore, String roadAddress) {
public MyReviewCafeResponse(String mapId, String name, StudyType myStudyType, int myScore, String roadAddress, CafeDetail cafeDetail) {
this.mapId = mapId;
this.name = name;
this.myStudyType = myStudyType.toString();
this.myStudyType = myStudyType.getValue();
this.myScore = myScore;
this.roadAddress = roadAddress;
this.wifi = cafeDetail.getWifiValue();
this.parking = cafeDetail.getParkingValue();
this.toilet = cafeDetail.getToiletValue();
this.power = cafeDetail.getPowerValue();
this.sound = cafeDetail.getSoundValue();
this.desk = cafeDetail.getDeskValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public interface CafeRepository extends JpaRepository<Cafe, Long> {
"where m.id = :id")
Slice<Cafe> findByMyFavoriteCafes(Long id, Pageable pageRequest);

@Query("select new mocacong.server.dto.response.MyReviewCafeResponse(c.mapId,c.name,r.cafeDetail.studyType,s.score,c.roadAddress) from Review r " +
@Query("select new mocacong.server.dto.response.MyReviewCafeResponse(c.mapId,c.name,r.cafeDetail.studyType,s.score,c.roadAddress, r.cafeDetail) from Review r " +
"join r.cafe c " +
"join r.member m " +
"join c.score s " +
Expand Down

0 comments on commit 98f4286

Please sign in to comment.