Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/MEME-UMC/MEME_SERVICE in…
Browse files Browse the repository at this point in the history
…to ci/#114
  • Loading branch information
sunwupark committed Feb 18, 2024
2 parents d5a8bde + 6f30342 commit ad1ae39
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import umc.meme.shop.domain.artist.dto.request.ArtistProfileDetailDto;
import umc.meme.shop.domain.artist.dto.request.ArtistProfileDto;
import umc.meme.shop.domain.artist.service.ArtistService;
import umc.meme.shop.global.SuccessStatus;
Expand All @@ -22,10 +21,16 @@ public ApiResponse updateProfile(@RequestBody ArtistProfileDto profileDto){
return ApiResponse.SuccessResponse(SuccessStatus.ARTIST_PROFILE_UPDATE);
}

@Operation(summary = "아티스트 프로필 관리 조회(수정 전 정보 불러오기 용)")
@GetMapping("/mypage/profile/artist/{userId}")
public ApiResponse getProfile (@PathVariable Long userId){
return ApiResponse.SuccessResponse(SuccessStatus.ARTIST_PROFILE_GET, artistService.getProfile(userId));
}

@Operation(summary = "아티스트 프로필 조회")
@GetMapping("/profile")
public ApiResponse getArtistProfile(@RequestBody ArtistProfileDetailDto profileDetailDto){
return ApiResponse.SuccessResponse(SuccessStatus.ARTIST_PROFILE_GET, artistService.getArtistProfile(profileDetailDto));
@GetMapping("/profile/{userId}/{artistId}")
public ApiResponse getArtistProfile(@PathVariable Long userId, @PathVariable Long artistId){
return ApiResponse.SuccessResponse(SuccessStatus.ARTIST_PROFILE_GET, artistService.getArtistProfile(userId, artistId));
}

//temp method for Artist create
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package umc.meme.shop.domain.artist.dto.request;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import umc.meme.shop.domain.artist.entity.Artist;
import umc.meme.shop.global.enums.*;

import java.util.List;
Expand All @@ -11,6 +13,7 @@
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ArtistProfileDto {
private Long userId;
private String profileImg;
Expand All @@ -23,4 +26,20 @@ public class ArtistProfileDto {
private MakeupLocation makeupLocation;
private String shopLocation;
private Map<DayOfWeek, Times> availableDayOfWeek;

public static ArtistProfileDto from(Artist artist){
return ArtistProfileDto.builder()
.userId(artist.getUserId())
.profileImg(artist.getProfileImg())
.nickname(artist.getNickname())
.gender(artist.getGender())
.introduction(artist.getIntroduction())
.workExperience(artist.getWorkExperience())
.region(artist.getRegion())
.specialization(artist.getSpecialization())
.makeupLocation(artist.getMakeupLocation())
.shopLocation(artist.getShopLocation())
.availableDayOfWeek(artist.getAvailableDayOfWeekAndTime())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import umc.meme.shop.domain.artist.dto.request.ArtistProfileDetailDto;
import umc.meme.shop.domain.artist.dto.request.ArtistProfileDto;
import umc.meme.shop.domain.artist.dto.response.ArtistDto;
import umc.meme.shop.domain.artist.entity.Artist;
Expand Down Expand Up @@ -33,11 +32,15 @@ public void updateArtistProfile(ArtistProfileDto profileDto){
artist.updateArtist(profileDto);
}

//아티스트 프로필 조회
public ArtistDto getArtistProfile(ArtistProfileDetailDto profileDetailDto){
Long userId = profileDetailDto.getUserId();
Long artistId = profileDetailDto.getArtistId();
//아티스트 프로필 조회 (관리 조회 용)
public ArtistProfileDto getProfile(Long userId){
Artist artist = artistRepository.findById(userId)
.orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_ARTIST));
return ArtistProfileDto.from(artist);
}

//아티스트 프로필 조회
public ArtistDto getArtistProfile(Long userId, Long artistId){
Model model = modelRepository.findById(userId)
.orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_MODEL));
Artist artist = artistRepository.findById(artistId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public ApiResponse updateModelProfile (@RequestBody ModelProfileDto modelProfile
return ApiResponse.SuccessResponse(SuccessStatus.MODEL_PROFILE_UPDATE);
}

@Operation(summary = "모델 프로필 관리 조회(수정 전 정보 불러오기 용)")
@GetMapping("/mypage/profile/model/{userId}")
public ApiResponse getModelProfile (@PathVariable Long userId){
return ApiResponse.SuccessResponse(SuccessStatus.MODEL_PROFILE_GET, modelService.getModelProfile(userId));
}

/**favorite**/

@Operation(summary = "관심 아티스트 조회", description = "관심 아티스트를 조회하는 API입니다.")
Expand Down Expand Up @@ -84,15 +90,15 @@ public ApiResponse deleteFavoritePortfolio(@RequestBody FavoritePortfolioDto fav

@Operation(summary = "메이크업 검색", description = "메이크업을 검색/최근 검색어로 검색하는 API입니다.")
@GetMapping("/search")
public ApiResponse search(@Parameter String query,
public ApiResponse search(@RequestParam(value = "query") String query,
@RequestParam(value = "page", defaultValue = "0", required = false) int page,
@RequestParam(value = "sort", defaultValue = "desc") String sort){
return ApiResponse.SuccessResponse(SuccessStatus.SEARCH_GET, modelService.search(query, page, sort));
}

@Operation(summary = "메이크업 검색 - 관심 아티스트", description = "관심 아티스트로 검색하는 API입니다.")
@GetMapping("/search/artist")
public ApiResponse searchArtist(@Parameter Long artistId,
public ApiResponse searchArtist(@RequestParam(value = "artistId") Long artistId,
@RequestParam(value = "page", defaultValue = "0", required = false) int page,
@RequestParam(value = "sort", defaultValue = "desc") String sort
){
Expand All @@ -101,7 +107,7 @@ public ApiResponse searchArtist(@Parameter Long artistId,

@Operation(summary = "메이크업 검색 - 카테고리", description = "메이크업 카테고리로 검색하는 API입니다.")
@GetMapping("/search/category")
public ApiResponse searchCategory(@Parameter Category category,
public ApiResponse searchCategory(@RequestParam(value = "category") Category category,
@RequestParam(value = "page", defaultValue = "0", required = false) int page,
@RequestParam(value = "sort", defaultValue = "desc") String sort
){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
package umc.meme.shop.domain.model.dto.request;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import umc.meme.shop.domain.model.entity.Model;
import umc.meme.shop.global.enums.Gender;
import umc.meme.shop.global.enums.PersonalColor;
import umc.meme.shop.global.enums.SkinType;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ModelProfileDto {
private Long userId;
private String profileImg;
private String nickname;
private Gender gender;
private SkinType skinType;
private PersonalColor personalColor;

public static ModelProfileDto from(Model model){
return ModelProfileDto.builder()
.userId(model.getUserId())
.profileImg(model.getProfileImg())
.nickname(model.getNickname())
.gender(model.getGender())
.skinType(model.getSkinType())
.personalColor(model.getPersonalColor())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ public void updateModelProfile(ModelProfileDto request){
model.updateModel(request);
}

//모델 프로필 관리 조회
public ModelProfileDto getModelProfile(Long userId){
Model model = modelRepository.findById(userId)
.orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_MODEL));
return ModelProfileDto.from(model);
}


//관심 아티스트 조회
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public ApiResponse getPortfolio(@PathVariable Long artistId,
}

@Operation(summary = "포트폴리오 조회", description = "특정 포트폴리오를 조회하는 API입니다.")
@GetMapping("/details")
public ApiResponse getPortfolioDetails(@RequestBody PortfolioDetailRequestDto detailDto) {
return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_GET, portfolioService.getPortfolioDetails(detailDto));
@GetMapping("/details/{userId}/{portfolioId}")
public ApiResponse getPortfolioDetails(@PathVariable Long userId, @PathVariable Long portfolioId) {
return ApiResponse.SuccessResponse(SuccessStatus.PORTFOLIO_GET, portfolioService.getPortfolioDetails(userId, portfolioId));
}

@Operation(summary = "포트폴리오 수정/삭제", description = "포트폴리오를 수정/삭제하는 API입니다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
public class PortfolioDetailDto {
private Long portfolioId;

private Long userId;

private Boolean isFavorite;

private Category category;

private String artistProfileImg;

private String artistNickName;

private String makeupName;
Expand Down Expand Up @@ -56,8 +60,10 @@ public static PortfolioDetailDto from(Portfolio portfolio, boolean isFavorite) {

return PortfolioDetailDto.builder()
.portfolioId(portfolio.getPortfolioId())
.userId(portfolio.getArtist().getUserId())
.isFavorite(isFavorite)
.category(portfolio.getCategory())
.artistProfileImg(artist.getProfileImg())
.artistNickName(artist.getNickname())
.makeupName(portfolio.getMakeupName())
.price(portfolio.getPrice())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class PortfolioDto {
private Category category;

private String artistNickName;
private Long userId;

private String makeupName;

Expand Down Expand Up @@ -54,6 +55,7 @@ public static PortfolioDto from(Portfolio portfolio) {

return PortfolioDto.builder()
.portfolioId(portfolio.getPortfolioId())
.userId(portfolio.getArtist().getUserId())
.category(portfolio.getCategory())
.artistNickName(artist.getNickname())
.makeupName(portfolio.getMakeupName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@Builder
public class PortfolioPageDto {
private List<PortfolioDto> content;
private Long userId; // 유저 아이디
private int currentPage; //현재 페이지 번호
private int pageSize; //페이지 크기
private int totalNumber; //전체 메이크업 개수
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import umc.meme.shop.domain.model.entity.Model;
import umc.meme.shop.domain.model.repository.ModelRepository;
import umc.meme.shop.domain.portfolio.dto.request.CreatePortfolioDto;
import umc.meme.shop.domain.portfolio.dto.request.PortfolioDetailRequestDto;
import umc.meme.shop.domain.portfolio.dto.request.UpdatePortfolioDto;
import umc.meme.shop.domain.portfolio.dto.response.PortfolioDetailDto;
import umc.meme.shop.domain.portfolio.dto.response.PortfolioImgDto;
Expand Down Expand Up @@ -79,10 +78,7 @@ public PortfolioPageDto getPortfolio(Long artistId, int page) {
}

// 포트폴리오 하나만 조회
public PortfolioDetailDto getPortfolioDetails(PortfolioDetailRequestDto dto) {
Long userId = dto.getUserId();
Long portfolioId = dto.getPortfolioId();

public PortfolioDetailDto getPortfolioDetails(Long userId, Long portfolioId) {
Model model = modelRepository.findById(userId)
.orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_MODEL));
Portfolio portfolio = portfolioRepository.findById(portfolioId)
Expand All @@ -96,7 +92,7 @@ public PortfolioDetailDto getPortfolioDetails(PortfolioDetailRequestDto dto) {
if(favoritePortfolio.isPresent())
isFavorite = true;

return PortfolioDetailDto.from(portfolio, false);
return PortfolioDetailDto.from(portfolio, isFavorite);
}

// 포트폴리오 수정/삭제
Expand Down
1 change: 1 addition & 0 deletions src/main/java/umc/meme/shop/global/SuccessStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public enum SuccessStatus {

/**model**/
MODEL_PROFILE_UPDATE(200, "모델 프로필 수정이 완료되었습니다"),
MODEL_PROFILE_GET(200, "모델 프로필 조회가 완료되었습니다."),

FAVORITE_ARTIST_GET(200, "관심 아티스트 조회가 완료되었습니다"),
FAVORITE_PORTFOLIO_GET(200, "관심 메이크업 조회가 완료되었습니다"),
Expand Down

0 comments on commit ad1ae39

Please sign in to comment.