diff --git a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java index a7dd952..7ae310c 100644 --- a/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java +++ b/src/main/java/umc/meme/shop/domain/artist/controller/ArtistController.java @@ -23,13 +23,13 @@ public ApiResponse updateProfile(@RequestBody ArtistProfileDto profileDto){ @Operation(summary = "아티스트 프로필 관리 조회(수정 전 정보 불러오기 용)") @GetMapping("/mypage/profile/artist/{userId}") - public ApiResponse getProfile (@PathVariable Long userId){ + public ApiResponse getProfile (@PathVariable(name = "userId") Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.ARTIST_PROFILE_GET, artistService.getProfile(userId)); } @Operation(summary = "아티스트 프로필 조회") @GetMapping("/profile/{userId}/{artistId}") - public ApiResponse getArtistProfile(@PathVariable Long userId, @PathVariable Long artistId){ + public ApiResponse getArtistProfile(@PathVariable(name = "userId") Long userId, @PathVariable Long artistId){ return ApiResponse.SuccessResponse(SuccessStatus.ARTIST_PROFILE_GET, artistService.getArtistProfile(userId, artistId)); } diff --git a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java index b91cd0b..6ff951d 100644 --- a/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java +++ b/src/main/java/umc/meme/shop/domain/model/controller/ModelController.java @@ -34,7 +34,7 @@ public ApiResponse updateModelProfile (@RequestBody ModelProfileDto modelProfile @Operation(summary = "모델 프로필 관리 조회(수정 전 정보 불러오기 용)") @GetMapping("/mypage/profile/model/{userId}") - public ApiResponse getModelProfile (@PathVariable Long userId){ + public ApiResponse getModelProfile (@PathVariable(name = "userId") Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.MODEL_PROFILE_GET, modelService.getModelProfile(userId)); } @@ -42,14 +42,14 @@ public ApiResponse getModelProfile (@PathVariable Long userId){ @Operation(summary = "관심 아티스트 조회", description = "관심 아티스트를 조회하는 API입니다.") @GetMapping("/mypage/{modelId}/favorite/artist") - public ApiResponse getFavoriteArtist(@PathVariable Long modelId, + public ApiResponse getFavoriteArtist(@PathVariable(name = "modelId") Long modelId, @RequestParam(value = "page", defaultValue = "0", required = false)int page){ return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_ARTIST_GET, modelService.getFavoriteArtist(modelId, page)); } @Operation(summary = "관심 메이크업 조회", description = "관심 메이크업을 조회하는 API입니다.") @GetMapping("/mypage/{modelId}/favorite/portfolio") - public ApiResponse getFavoritePortfolio(@PathVariable Long modelId, + public ApiResponse getFavoritePortfolio(@PathVariable(name = "modelId") Long modelId, @RequestParam(value = "page", defaultValue = "0", required = false) int page ){ return ApiResponse.SuccessResponse(SuccessStatus.FAVORITE_PORTFOLIO_GET, modelService.getFavoritePortfolio(modelId, page)); diff --git a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java index 4adf7fb..0752ae1 100644 --- a/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java +++ b/src/main/java/umc/meme/shop/domain/mypage/controller/MyPageController.java @@ -18,7 +18,7 @@ public class MyPageController { @Operation(summary = "마이페이지 조회") @GetMapping("/profile/{userId}") - public ApiResponse getProfile(@PathVariable Long userId) { + public ApiResponse getProfile(@PathVariable(name = "userId") Long userId) { return ApiResponse.SuccessResponse(SuccessStatus.MYPAGE_GET, mypageService.getProfile(userId)); } @@ -31,7 +31,7 @@ public ApiResponse contact(@RequestBody MypageInquiryDto mypageInquiryDto){ @Operation(summary = "문의 조회하기", description = "문의 조회하기 API입니다.") @GetMapping("/contact/{userId}") - public ApiResponse getContact(@PathVariable Long userId){ + public ApiResponse getContact(@PathVariable(name = "userId") Long userId){ return ApiResponse.SuccessResponse(SuccessStatus.CONTACT_GET, mypageService.getInquiry(userId)); } } diff --git a/src/main/java/umc/meme/shop/domain/portfolio/controller/PortfolioController.java b/src/main/java/umc/meme/shop/domain/portfolio/controller/PortfolioController.java index 4784ef8..b015111 100644 --- a/src/main/java/umc/meme/shop/domain/portfolio/controller/PortfolioController.java +++ b/src/main/java/umc/meme/shop/domain/portfolio/controller/PortfolioController.java @@ -23,7 +23,7 @@ public ApiResponse createPortfolio(@RequestBody CreatePortfolioDto portfolioDto) @Operation(summary = "포트폴리오 전체 조회", description = "포트폴리오 전체를 조회하는 API입니다.") @GetMapping("/{artistId}") - public ApiResponse getPortfolio(@PathVariable Long artistId, + public ApiResponse getPortfolio(@PathVariable(name = "artistId") Long artistId, @RequestParam(value = "page", defaultValue = "0", required = false) int page ){ return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_GET, portfolioService.getPortfolio(artistId, page)); @@ -31,7 +31,7 @@ public ApiResponse getPortfolio(@PathVariable Long artistId, @Operation(summary = "포트폴리오 조회", description = "특정 포트폴리오를 조회하는 API입니다.") @GetMapping("/details/{userId}/{portfolioId}") - public ApiResponse getPortfolioDetails(@PathVariable Long userId, @PathVariable Long portfolioId) { + public ApiResponse getPortfolioDetails(@PathVariable(name = "portfolioId") Long userId, @PathVariable Long portfolioId) { return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_GET, portfolioService.getPortfolioDetails(userId, portfolioId)); } diff --git a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java index 4318141..898af89 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java +++ b/src/main/java/umc/meme/shop/domain/reservation/controller/ReservationController.java @@ -30,13 +30,13 @@ public ApiResponse alteration(@RequestBody AlterReservationDto alterReservationD @Operation(summary = "예약가능 장소 조회", description = "예약가능 장소 조회 기능을 수행하는 API입니다.") @GetMapping("/{artistId}/location") - public ApiResponse getArtistLocation(@PathVariable Long artistId){ + public ApiResponse getArtistLocation(@PathVariable(name = "artistId") Long artistId){ return ApiResponse.SuccessResponse(SuccessStatus.ARTIST_LOCATION_GET, reservationService.getArtistLocation(artistId)); } @Operation(summary = "예약가능 시간 조회", description = "예약가능 시간 조회 기능을 수행하는 API입니다.") @GetMapping("/{artistId}/time") - public ApiResponse getArtistTime(@PathVariable Long artistId){ + public ApiResponse getArtistTime(@PathVariable(name = "artistId") Long artistId){ return ApiResponse.SuccessResponse(SuccessStatus.ARTIST_TIME_GET, reservationService.getArtistTime(artistId)); } @@ -50,14 +50,28 @@ public ApiResponse createReservation(@RequestBody ReservationRequestDto reservat //아티스트 예약 조회 @Operation(summary = "아티스트 예약 조회", description = "예약 정보를 조회하는 API입니다.") @GetMapping("/{artistId}/artist") - public ApiResponse getArtistReservation(@PathVariable Long artistId){ + public ApiResponse getArtistReservation(@PathVariable(name = "artistId") Long artistId){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, reservationService.getArtistReservation(artistId)); } + //아티스트 예약 상세 조회 + @Operation(summary = "아티스트 예약 상세 조회", description = "Artist ver. 예약 정보를 상세조회하는 API입니다.") + @GetMapping("/{reservationId}/artist/details") + public ApiResponse getArtistReservationDetails(@PathVariable(name = "reservationId") Long reservationId){ + return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_DETAILS_GET, reservationService.getArtistDetailsReservation(reservationId)); + } + //모델 예약 조회 @Operation(summary = "모델 예약 조회", description = "예약 정보를 조회하는 API입니다.") @GetMapping("/{modelId}/model") - public ApiResponse getModelReservation(@PathVariable Long modelId){ + public ApiResponse getModelReservation(@PathVariable(name = "modelId") Long modelId){ return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_GET, reservationService.getModelReservation(modelId)); } + + //모델 예약 상세 조회 + @Operation(summary = "모델 예약 상세 조회", description = "Model ver. 예약 정보를 상세조회하는 API입니다.") + @GetMapping("/{reservationId}/model/details") + public ApiResponse getModelReservationDetails(@PathVariable(name = "reservationId") Long reservationId){ + return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_DETAILS_GET, reservationService.getModelDetailsReservation(reservationId)); + } } diff --git a/src/main/java/umc/meme/shop/domain/reservation/dto/response/ArtistReservationDetailDto.java b/src/main/java/umc/meme/shop/domain/reservation/dto/response/ArtistReservationDetailDto.java new file mode 100644 index 0000000..3d76841 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/dto/response/ArtistReservationDetailDto.java @@ -0,0 +1,48 @@ +package umc.meme.shop.domain.reservation.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.model.entity.Model; +import umc.meme.shop.domain.reservation.entity.Reservation; +import umc.meme.shop.global.enums.*; + +import java.util.Date; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ArtistReservationDetailDto { + private Long reservationId; + //모델 정보 + private String modelNickName; + private String modelProfileImg; + private Gender gender; + private SkinType skinType; + private PersonalColor personalColor; + //예약 정보 + private String portfolioName; + private Date date; +// private DayOfWeek dayOfWeek; +// private Times times; + private String location; + + public static ArtistReservationDetailDto from(Reservation reservation, Model model){ + return ArtistReservationDetailDto.builder() + .reservationId(reservation.getReservationId()) + .modelNickName(model.getNickname()) + .modelProfileImg(model.getProfileImg()) + .gender(model.getGender()) + .skinType(model.getSkinType()) + .personalColor(model.getPersonalColor()) + .portfolioName(reservation.getPortfolio().getMakeupName()) + .date(reservation.getReservationDate()) +// .dayOfWeek(reservation.getReservationDayOfWeekAndTime()) +// .times(reservation.getAvailableTime().getTimes()) + .location(reservation.getLocation()) + .build(); + } + +} diff --git a/src/main/java/umc/meme/shop/domain/reservation/dto/response/ModelReservationDetailDto.java b/src/main/java/umc/meme/shop/domain/reservation/dto/response/ModelReservationDetailDto.java new file mode 100644 index 0000000..3dfb436 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/reservation/dto/response/ModelReservationDetailDto.java @@ -0,0 +1,40 @@ +package umc.meme.shop.domain.reservation.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.artist.entity.Artist; +import umc.meme.shop.domain.portfolio.entity.Portfolio; +import umc.meme.shop.domain.reservation.entity.Reservation; +import umc.meme.shop.global.enums.Category; + +@Getter +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ModelReservationDetailDto { + private Long reservationId; + //아티스트 정보 + private String artistNickName; + private String artistProfileImg; + //예약 정보 + private String portfolioName; + private Category category; + private String location; + //TODO: Portfolio 관련 정보 추가논의 + + public static ModelReservationDetailDto from(Reservation reservation){ + Portfolio portfolio = reservation.getPortfolio(); + Artist artist = portfolio.getArtist(); + return ModelReservationDetailDto.builder() + .reservationId(reservation.getReservationId()) + .artistNickName(artist.getNickname()) + .artistProfileImg(artist.getProfileImg()) + .portfolioName(portfolio.getMakeupName()) + .category(portfolio.getCategory()) + .location(reservation.getLocation()) + .build(); + } + +} \ No newline at end of file diff --git a/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java b/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java index 5f7b9bf..4159888 100644 --- a/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java +++ b/src/main/java/umc/meme/shop/domain/reservation/service/ReservationService.java @@ -11,10 +11,7 @@ import umc.meme.shop.domain.portfolio.repository.PortfolioRepository; import umc.meme.shop.domain.reservation.dto.request.AlterReservationDto; import umc.meme.shop.domain.reservation.dto.request.ReservationRequestDto; -import umc.meme.shop.domain.reservation.dto.response.ArtistLocationDto; -import umc.meme.shop.domain.reservation.dto.response.ArtistTimeDto; -import umc.meme.shop.domain.reservation.dto.response.ReservationCompleteDto; -import umc.meme.shop.domain.reservation.dto.response.ReservationResponseDto; +import umc.meme.shop.domain.reservation.dto.response.*; import umc.meme.shop.domain.reservation.entity.Reservation; import umc.meme.shop.global.enums.Status; import umc.meme.shop.domain.reservation.repository.ReservationRepository; @@ -116,6 +113,17 @@ public List getArtistReservation(Long artistId){ .collect(Collectors.toList()); } + //아티스트ver. 예약 상세 조회 + public ArtistReservationDetailDto getArtistDetailsReservation(Long reservationId){ + Reservation reservation = reservationRepository.findById(reservationId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_RESERVATION)); + + Model model = modelRepository.findById(reservation.getModel().getUserId()) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_MODEL)); + + return ArtistReservationDetailDto.from(reservation, model); + } + //모델 예약 조회 public List getModelReservation(Long modelId) { Model model = modelRepository.findById(modelId) @@ -127,6 +135,13 @@ public List getModelReservation(Long modelId) { .collect(Collectors.toList()); } + //Modelver. 예약 상세 조회 + public ModelReservationDetailDto getModelDetailsReservation(Long reservationId){ + Reservation reservation = reservationRepository.findById(reservationId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_RESERVATION)); + return ModelReservationDetailDto.from(reservation); + } + private boolean checkDuplicateReservation(Date date1, Date date2){ //두 date가 동일하면 false if(date1.getYear() == date2.getYear()){ diff --git a/src/main/java/umc/meme/shop/domain/review/controller/ReviewController.java b/src/main/java/umc/meme/shop/domain/review/controller/ReviewController.java index 5b8bb91..2067d28 100644 --- a/src/main/java/umc/meme/shop/domain/review/controller/ReviewController.java +++ b/src/main/java/umc/meme/shop/domain/review/controller/ReviewController.java @@ -20,12 +20,18 @@ public class ReviewController { @Operation(summary = "리뷰 리스트 조회", description = "리뷰 리스트를 조회하는 API입니다.") @GetMapping("/{portfolioId}") - public ApiResponse getReviewList(@PathVariable Long portfolioId, + public ApiResponse getReviewList(@PathVariable(name = "portfolioId") Long portfolioId, @RequestParam(value = "page", defaultValue = "0", required = false) int page ){ return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_GET, reviewService.getReviewList(portfolioId, page)); } + @Operation(summary = "리뷰 작성 가능 예약 리스트 조회", description = "리뷰 작성이 가능한 예약 리스트를 조회하는 API입니다.") + @GetMapping("/available/{modelId}") + public ApiResponse getReviewReservationList(@PathVariable(name = "modelId") Long modelId){ + return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_AVAILABLE_GET, reviewService.getReviewReservationList(modelId)); + } + @Operation(summary = "리뷰 작성", description = "리뷰를 작성하는 API입니다.") @PostMapping() public ApiResponse createReview(@RequestBody ReviewDto reviewDto){ @@ -33,9 +39,15 @@ public ApiResponse createReview(@RequestBody ReviewDto reviewDto){ return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_CREATE); } + @Operation(summary = "리뷰 세부 조회", description = "리뷰를 세부 조회하는 API입니다.") + @GetMapping("/details/{reviewId}") + public ApiResponse getReviewDetails(@PathVariable(name = "reviewId") Long reviewId){ + return ApiResponse.SuccessResponse(SuccessStatus.RESERVATION_DETAILS_GET, reviewService.getReviewDetails(reviewId)); + } + @Operation(summary = "내가 쓴 리뷰 조회", description = "본인이 쓴 리뷰를 조회하는 API입니다.") @GetMapping("/me/{modelId}") - public ApiResponse getMyReview(@PathVariable Long modelId){ + public ApiResponse getMyReview(@PathVariable(name = "modelId") Long modelId){ return ApiResponse.SuccessResponse(SuccessStatus.REVIEW_GET, reviewService.getMyReview(modelId)); } diff --git a/src/main/java/umc/meme/shop/domain/review/dto/response/MyReviewResponseDto.java b/src/main/java/umc/meme/shop/domain/review/dto/response/MyReviewResponseDto.java new file mode 100644 index 0000000..c4deba9 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/review/dto/response/MyReviewResponseDto.java @@ -0,0 +1,31 @@ +package umc.meme.shop.domain.review.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.review.entity.Review; + +import java.time.LocalDateTime; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class MyReviewResponseDto { + private Long reviewId; + private String artistNickName; + private String portfolioImg; + private String location; //장소 + private LocalDateTime createdAt; + + public static MyReviewResponseDto from(Review review){ + return MyReviewResponseDto.builder() + .reviewId(review.getReviewId()) + .artistNickName(review.getPortfolio().getArtist().getNickname()) + .portfolioImg(review.getPortfolio().getPortfolioImgList().get(0).getSrc()) //첫 번째 포트폴리오 이미지 + .location(review.getPortfolio().getArtist().getShopLocation()) + .createdAt(review.getCreatedAt()) + .build(); + } +} diff --git a/src/main/java/umc/meme/shop/domain/review/dto/response/ReviewAvailableListDto.java b/src/main/java/umc/meme/shop/domain/review/dto/response/ReviewAvailableListDto.java new file mode 100644 index 0000000..353b5e6 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/review/dto/response/ReviewAvailableListDto.java @@ -0,0 +1,35 @@ +package umc.meme.shop.domain.review.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.reservation.entity.Reservation; + +import java.util.Date; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ReviewAvailableListDto { + private Long reservationId; + private Long portfolioId; + private String artistNickName; + private String makeupName; + private String portfolioImg; + private Date reservationDate; + private String shopLocation; //샵 위치 + + public static ReviewAvailableListDto from(Reservation reservation) { + return ReviewAvailableListDto.builder() + .reservationId(reservation.getReservationId()) + .portfolioId(reservation.getReservationId()) + .artistNickName(reservation.getPortfolio().getArtist().getNickname()) + .makeupName(reservation.getPortfolio().getMakeupName()) + .portfolioImg(reservation.getPortfolio().getPortfolioImgList().get(0).getSrc()) + .reservationDate(reservation.getReservationDate()) + .shopLocation(reservation.getLocation()) + .build(); + } +} diff --git a/src/main/java/umc/meme/shop/domain/review/dto/response/ReviewDetailsDto.java b/src/main/java/umc/meme/shop/domain/review/dto/response/ReviewDetailsDto.java new file mode 100644 index 0000000..13db1d6 --- /dev/null +++ b/src/main/java/umc/meme/shop/domain/review/dto/response/ReviewDetailsDto.java @@ -0,0 +1,36 @@ +package umc.meme.shop.domain.review.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import umc.meme.shop.domain.review.entity.Review; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ReviewDetailsDto { + private String artistNickName; + private String makeupName; + private int star; + private String comment; + private List reviewImgDtoList; + + public static ReviewDetailsDto from(Review review){ + List reviewImgDtoList = review.getReviewImgList() + .stream() + .map(ReviewImgDto::from) + .toList(); + + return ReviewDetailsDto.builder() + .artistNickName(review.getPortfolio().getArtist().getNickname()) + .makeupName(review.getPortfolio().getMakeupName()) + .star(review.getStar()) + .comment(review.getComment()) + .reviewImgDtoList(reviewImgDtoList) + .build(); + } +} diff --git a/src/main/java/umc/meme/shop/domain/review/service/ReviewService.java b/src/main/java/umc/meme/shop/domain/review/service/ReviewService.java index 6fac751..c4619a0 100644 --- a/src/main/java/umc/meme/shop/domain/review/service/ReviewService.java +++ b/src/main/java/umc/meme/shop/domain/review/service/ReviewService.java @@ -12,22 +12,21 @@ import umc.meme.shop.domain.portfolio.entity.Portfolio; import umc.meme.shop.domain.portfolio.repository.PortfolioRepository; import umc.meme.shop.domain.reservation.entity.Reservation; +import umc.meme.shop.domain.review.dto.response.MyReviewResponseDto; +import umc.meme.shop.domain.review.dto.response.ReviewAvailableListDto; +import umc.meme.shop.domain.review.dto.response.ReviewDetailsDto; import umc.meme.shop.global.enums.Status; import umc.meme.shop.domain.reservation.repository.ReservationRepository; import umc.meme.shop.domain.review.dto.request.DeleteReviewDto; import umc.meme.shop.domain.review.dto.request.ReviewDto; import umc.meme.shop.domain.review.dto.response.ReviewListPageDto; -import umc.meme.shop.domain.review.dto.response.ReviewResponseDto; import umc.meme.shop.domain.review.entity.Review; import umc.meme.shop.domain.review.entity.ReviewImg; -import umc.meme.shop.domain.review.repository.ReviewImgRepository; import umc.meme.shop.domain.review.repository.ReviewRepository; import umc.meme.shop.global.ErrorStatus; import umc.meme.shop.global.exception.GlobalException; -import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; @Service @RequiredArgsConstructor @@ -70,15 +69,22 @@ public void createReview(ReviewDto reviewDto) { reservation.updateIsReview(true); } + //리뷰 상세 조회 + public ReviewDetailsDto getReviewDetails(Long reviewId){ + Review review = reviewRepository.findById(reviewId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_REVIEW)); + return ReviewDetailsDto.from(review); + } + //내가 쓴 리뷰 조회 - public List getMyReview(Long modelId){ + public List getMyReview(Long modelId){ Model model = modelRepository.findById(modelId) .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_MODEL)); //리뷰 리스트 조회 List reviewList = reviewRepository.findByModel(model); return reviewList.stream() - .map(ReviewResponseDto::from) + .map(MyReviewResponseDto::from) .toList(); } @@ -94,6 +100,24 @@ public ReviewListPageDto getReviewList(Long portfolioId, int page) { return ReviewListPageDto.from(reviewPage); } + //리뷰 작성 가능 예약 리스트 조회 + public List getReviewReservationList(Long modelId){ + Model model = modelRepository.findById(modelId) + .orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_MODEL)); + List reservationList = model.getReservationList(); + + //status != COMPLETE 이면 리스트에서 제거 + //TODO: DevCon 이후 수정 +// reservationList.removeIf(Reservation::isAvailableReview); + + //리뷰 작성 완료시 리스트에서 제거 + reservationList.removeIf(Reservation::isReview); + + return reservationList.stream() + .map(ReviewAvailableListDto::from) + .toList(); + } + //리뷰 삭제 @Transactional public void deleteReview(DeleteReviewDto reviewDto){ diff --git a/src/main/java/umc/meme/shop/global/SuccessStatus.java b/src/main/java/umc/meme/shop/global/SuccessStatus.java index 53b43cf..7616c78 100644 --- a/src/main/java/umc/meme/shop/global/SuccessStatus.java +++ b/src/main/java/umc/meme/shop/global/SuccessStatus.java @@ -37,9 +37,12 @@ public enum SuccessStatus { REVIEW_CREATE(200, "리뷰 작성이 완료되었습니다"), REVIEW_GET(200, "리뷰 조회가 완료되었습니다"), REVIEW_DELETE(200, "리뷰 삭제가 완료되었습니다"), + REVIEW_DETAILS_GET(200, "리뷰 상세 조회가 완료되었습니다"), + REVIEW_AVAILABLE_GET(200, "리뷰 작성 가능 예약 리스트 조회가 완료되었습니다"), /**reservation**/ RESERVATION_CREATE(200, "예약이 완료되었습니다"), + RESERVATION_DETAILS_GET(200, "예약 상세 조회가 완료되었습니다"), RESERVATION_GET(200, "예약 조회가 완료되었습니다"), RESERVATION_UPDATE(200, "예약 상태 변경이 완료되었습니다"), ARTIST_LOCATION_GET(200, "아티스트의 예약 가능 장소 조회가 완료되었습니다"),