-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from PawWithU/feat/51-get-home-reviews-api
[Feature] 이동봉사자 봉사 후기 전체 조회 API 구현
- Loading branch information
Showing
8 changed files
with
161 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/com/pawwithu/connectdog/domain/review/dto/response/ReviewGetAllResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.pawwithu.connectdog.domain.review.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public record ReviewGetAllResponse(String dogName, String volunteerNickname, String mainImage, List<String> images, | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Seoul") | ||
LocalDate startDate, | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Seoul") | ||
LocalDate endDate, | ||
String departureLoc, String arrivalLoc, | ||
String intermediaryName, String content | ||
) { | ||
|
||
// 리뷰 이미지 리스트 필드를 제외한 생성자 | ||
public ReviewGetAllResponse(String dogName, String volunteerNickname, String mainImage, | ||
LocalDate startDate, LocalDate endDate, String departureLoc, String arrivalLoc, | ||
String intermediaryName, String content) { | ||
this(dogName, volunteerNickname, mainImage, null, startDate, endDate, departureLoc, arrivalLoc, intermediaryName, content); | ||
} | ||
|
||
// 리뷰 이미지 리스트 필드를 포함한 생성자 | ||
public static ReviewGetAllResponse of(ReviewGetAllResponse response, List<String> images) { | ||
return new ReviewGetAllResponse(response.dogName, response.volunteerNickname, response.mainImage, images, | ||
response.startDate, response.endDate, response.departureLoc, response.arrivalLoc, response.intermediaryName, response.content); | ||
} | ||
|
||
} | ||
|
30 changes: 30 additions & 0 deletions
30
src/main/java/com/pawwithu/connectdog/domain/review/dto/response/ReviewGetOneResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.pawwithu.connectdog.domain.review.dto.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public record ReviewGetOneResponse(String dogName, String volunteerNickname, String mainImage, List<String> images, | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Seoul") | ||
LocalDate startDate, | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "Asia/Seoul") | ||
LocalDate endDate, | ||
String departureLoc, String arrivalLoc, | ||
String intermediaryName, String content | ||
) { | ||
|
||
// 리뷰 이미지 리스트 필드를 제외한 생성자 | ||
public ReviewGetOneResponse(String dogName, String volunteerNickname, String mainImage, | ||
LocalDate startDate, LocalDate endDate, String departureLoc, String arrivalLoc, | ||
String intermediaryName, String content) { | ||
this(dogName, volunteerNickname, mainImage, null, startDate, endDate, departureLoc, arrivalLoc, intermediaryName, content); | ||
} | ||
|
||
// 리뷰 이미지 리스트 필드를 포함한 생성자 | ||
public static ReviewGetOneResponse of(ReviewGetOneResponse response, List<String> images) { | ||
return new ReviewGetOneResponse(response.dogName, response.volunteerNickname, response.mainImage, images, | ||
response.startDate, response.endDate, response.departureLoc, response.arrivalLoc, response.intermediaryName, response.content); | ||
} | ||
|
||
} |
29 changes: 0 additions & 29 deletions
29
src/main/java/com/pawwithu/connectdog/domain/review/dto/response/ReviewGetResponse.java
This file was deleted.
Oops, something went wrong.
12 changes: 9 additions & 3 deletions
12
src/main/java/com/pawwithu/connectdog/domain/review/repository/CustomReviewRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
package com.pawwithu.connectdog.domain.review.repository; | ||
|
||
import com.pawwithu.connectdog.domain.review.dto.response.ReviewGetResponse; | ||
import com.pawwithu.connectdog.domain.review.dto.response.ReviewGetAllResponse; | ||
import com.pawwithu.connectdog.domain.review.dto.response.ReviewGetOneResponse; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
import java.util.List; | ||
|
||
public interface CustomReviewRepository { | ||
// 리뷰 상세 조회 (대표 이미지를 제외한 다른 이미지 포함 X) | ||
ReviewGetResponse getOneReview(Long id, Long reviewId); | ||
|
||
// 대표 이미지를 제외한 리뷰 이미지 조회 | ||
List<String> getOneReviewImages(Long reviewId); | ||
// 리뷰 단건 조회 (대표 이미지를 제외한 다른 이미지 포함 X) | ||
ReviewGetOneResponse getOneReview(Long id, Long reviewId); | ||
|
||
// 리뷰 전체 조회 (최신 순) | ||
List<ReviewGetAllResponse> getAllReviews(Pageable pageable); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters