Skip to content

Commit

Permalink
Merge pull request #138 from MEME-UMC/chore/#136_tmp
Browse files Browse the repository at this point in the history
[Chore] Reservation, Review 상세 정보 수정
  • Loading branch information
daeun084 authored Mar 25, 2024
2 parents d3f1974 + ac5716e commit 6c676b1
Show file tree
Hide file tree
Showing 14 changed files with 283 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ 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));
}

/**favorite**/

@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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand All @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ 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));
}

@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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand All @@ -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));
}
}
Original file line number Diff line number Diff line change
@@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -116,6 +113,17 @@ public List<ReservationResponseDto> 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<ReservationResponseDto> getModelReservation(Long modelId) {
Model model = modelRepository.findById(modelId)
Expand All @@ -127,6 +135,13 @@ public List<ReservationResponseDto> 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()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,34 @@ 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){
reviewService.createReview(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));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
Loading

0 comments on commit 6c676b1

Please sign in to comment.