Skip to content

Commit 1a08166

Browse files
Merge pull request #226 from prgrms-web-devcourse-final-project/bug/#199
[Artist] 아티스트 저장 로직 수정
2 parents 622cdd0 + dd6c88a commit 1a08166

23 files changed

Lines changed: 4286 additions & 1232 deletions

src/main/java/com/back/web7_9_codecrete_be/domain/artists/controller/ArtistAdminController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
import com.back.web7_9_codecrete_be.domain.artists.service.ArtistService;
66
import com.back.web7_9_codecrete_be.global.rsData.RsData;
77
import io.swagger.v3.oas.annotations.Operation;
8+
import io.swagger.v3.oas.annotations.tags.Tag;
89
import jakarta.validation.Valid;
910
import lombok.RequiredArgsConstructor;
1011
import org.springframework.web.bind.annotation.*;
1112

1213
@RestController
1314
@RequestMapping("/api/v1/admin/artists")
1415
@RequiredArgsConstructor
16+
@Tag(name = "ArtistAdmin", description = "아티스트 관리자 API 입니다.")
1517
public class ArtistAdminController {
1618

1719
private final ArtistService artistService;

src/main/java/com/back/web7_9_codecrete_be/domain/artists/controller/GenreController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.back.web7_9_codecrete_be.domain.artists.dto.response.GenreResponse;
44
import com.back.web7_9_codecrete_be.domain.artists.service.GenreService;
55
import com.back.web7_9_codecrete_be.global.rsData.RsData;
6+
import io.swagger.v3.oas.annotations.Operation;
7+
import io.swagger.v3.oas.annotations.tags.Tag;
68
import lombok.RequiredArgsConstructor;
79
import org.springframework.web.bind.annotation.GetMapping;
810
import org.springframework.web.bind.annotation.RequestMapping;
@@ -13,10 +15,12 @@
1315
@RestController
1416
@RequestMapping("/api/v1/genre")
1517
@RequiredArgsConstructor
18+
@Tag(name = "Genre", description = "장르 관련 API 입니다.")
1619
public class GenreController {
1720

1821
private final GenreService genreService;
1922

23+
@Operation(summary = "전체 장르 목록", description = "DB에 저장되어있는 전체 장르 목록을 반환합니다.")
2024
@GetMapping()
2125
public RsData<List<GenreResponse>> genreList() {
2226
return RsData.success("전체 장르 조회 성공", genreService.genreList());

src/main/java/com/back/web7_9_codecrete_be/domain/artists/entity/Artist.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public class Artist {
4040
@Column(name = "name_ko", length = 200)
4141
private String nameKo;
4242

43+
@Column(name = "real_name", length = 200)
44+
private String realName;
45+
4346
@Column(name = "like_count", nullable = false)
4447
private int likeCount = 0;
4548

src/main/java/com/back/web7_9_codecrete_be/domain/artists/repository/ArtistRepository.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@ List<Artist> findTop5ByGenreIdAndIdNot(@org.springframework.data.repository.quer
5353
// 인기순 정렬 (좋아요 많은 순)
5454
@Query("SELECT a FROM Artist a ORDER BY a.likeCount DESC")
5555
Slice<Artist> findAllOrderByLikeCountDesc(Pageable pageable);
56+
57+
// 배치 조회: spotifyId 리스트로 존재하는 아티스트의 spotifyId만 반환
58+
@Query("SELECT a.spotifyArtistId FROM Artist a WHERE a.spotifyArtistId IN :spotifyIds")
59+
List<String> findSpotifyIdsBySpotifyIdsIn(@org.springframework.data.repository.query.Param("spotifyIds") List<String> spotifyIds);
5660
}

0 commit comments

Comments
 (0)