Skip to content

Commit 7280103

Browse files
committed
fix: 아티스트 정보 보완
1 parent 28839d8 commit 7280103

6 files changed

Lines changed: 1323 additions & 145 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ public RsData<Integer> enrich(
4545
return RsData.success("enrich 성공", updated);
4646
}
4747

48+
@Operation(summary = "MusicBrainz ID 수집", description = "아티스트의 MusicBrainz ID를 수집합니다.")
49+
@PostMapping("/musicbrainz-id")
50+
public RsData<Integer> fetchMusicBrainzIds(
51+
@RequestParam(required = false, defaultValue = "100") int limit
52+
) {
53+
int updated = enrichService.fetchMusicBrainzIds(limit);
54+
return RsData.success("MusicBrainz ID 수집 성공", updated);
55+
}
56+
4857
@Operation(summary = "아티스트 생성", description = "아티스트를 등록합니다.")
4958
@PostMapping()
5059
public RsData<Void> create(

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public class Artist {
3434
@Column(name = "spotify_artist_id", unique = true)
3535
private String spotifyArtistId;
3636

37+
@Column(name = "musicbrainz_id")
38+
private String musicBrainzId;
39+
3740
@Column(name = "name_ko", length = 200)
3841
private String nameKo;
3942

@@ -89,4 +92,8 @@ public void decreaseLikeCount() {
8992
this.likeCount--;
9093
}
9194
}
95+
96+
public void setMusicBrainzId(String musicBrainzId) {
97+
this.musicBrainzId = musicBrainzId;
98+
}
9299
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ public interface ArtistRepository extends JpaRepository<Artist, Long> {
1515
@Query("SELECT a FROM Artist a WHERE a.nameKo IS NULL ORDER BY a.id ASC")
1616
List<Artist> findByNameKoIsNullOrderByIdAsc(Pageable pageable);
1717

18+
@Query("SELECT a FROM Artist a WHERE a.musicBrainzId IS NULL ORDER BY a.id ASC")
19+
List<Artist> findByMusicBrainzIdIsNullOrderByIdAsc(Pageable pageable);
20+
1821
boolean existsByArtistName(String artistName);
1922
boolean existsByNameKo(String nameKo);
2023

0 commit comments

Comments
 (0)