Skip to content

Commit

Permalink
hotfix: Artist ver. get artist profile API 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
daeun084 committed Mar 31, 2024
1 parent 6130f90 commit b8ce9d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ public ApiResponse getProfile (@PathVariable(name = "userId") Long userId){
return ApiResponse.SuccessResponse(SuccessStatus.ARTIST_PROFILE_GET, artistService.getProfile(userId));
}

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

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

//temp method for Artist create
@Operation(summary = "temp 아티스트 생성(프론트랑 상관X)")
@PostMapping("/artist")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public ArtistProfileDto getProfile(Long userId){
return ArtistProfileDto.from(artist);
}

//아티스트 프로필 조회
//아티스트 프로필 조회 (Model Ver.)
public ArtistDto getArtistProfile(Long userId, Long artistId){
Model model = modelRepository.findById(userId)
.orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_MODEL));
Expand All @@ -54,6 +54,13 @@ public ArtistDto getArtistProfile(Long userId, Long artistId){
return ArtistDto.from(artist, isFavorite);
}

//아티스트 프로필 조회 (Artist Ver.)
public ArtistDto getArtistProfileFromArtist(Long artistId){
Artist artist = artistRepository.findById(artistId)
.orElseThrow(() -> new GlobalException(ErrorStatus.NOT_EXIST_ARTIST));
return ArtistDto.from(artist, true);
}

//temp method for create Artist
@Transactional
public void createArtist(ArtistProfileDto dto){
Expand Down

0 comments on commit b8ce9d4

Please sign in to comment.