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 e6086f6..a7dd952 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 @@ -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; @@ -22,6 +21,12 @@ 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/{userId}/{artistId}") public ApiResponse getArtistProfile(@PathVariable Long userId, @PathVariable Long artistId){ diff --git a/src/main/java/umc/meme/shop/domain/artist/dto/request/ArtistProfileDetailDto.java b/src/main/java/umc/meme/shop/domain/artist/dto/request/ArtistProfileDetailDto.java deleted file mode 100644 index 77b0fce..0000000 --- a/src/main/java/umc/meme/shop/domain/artist/dto/request/ArtistProfileDetailDto.java +++ /dev/null @@ -1,16 +0,0 @@ -package umc.meme.shop.domain.artist.dto.request; - -import jakarta.validation.constraints.NotNull; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ArtistProfileDetailDto{ - @NotNull - private Long userId; - @NotNull - private Long artistId; -} diff --git a/src/main/java/umc/meme/shop/domain/artist/dto/request/ArtistProfileDto.java b/src/main/java/umc/meme/shop/domain/artist/dto/request/ArtistProfileDto.java index 25e94b1..a8a3581 100644 --- a/src/main/java/umc/meme/shop/domain/artist/dto/request/ArtistProfileDto.java +++ b/src/main/java/umc/meme/shop/domain/artist/dto/request/ArtistProfileDto.java @@ -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; @@ -11,6 +13,7 @@ @Data @NoArgsConstructor @AllArgsConstructor +@Builder public class ArtistProfileDto { private Long userId; private String profileImg; @@ -23,4 +26,20 @@ public class ArtistProfileDto { private MakeupLocation makeupLocation; private String shopLocation; private Map 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(); + } } diff --git a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java index 3545921..0d56eaf 100644 --- a/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java +++ b/src/main/java/umc/meme/shop/domain/artist/service/ArtistService.java @@ -32,6 +32,13 @@ public void updateArtistProfile(ArtistProfileDto profileDto){ artist.updateArtist(profileDto); } + //아티스트 프로필 조회 (관리 조회 용) + 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)