From b0e679f5c95d90b60c996865d2f44d71205e3f85 Mon Sep 17 00:00:00 2001 From: hong-sile Date: Wed, 28 Aug 2024 23:36:50 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20MusicResponse=20isrc=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80(#117)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pluv/history/application/dto/MusicResponse.java | 7 ++++--- .../play/pluv/history/domain/TransferredMusic.java | 10 +++++++--- src/test/java/play/pluv/api/FeedApiTest.java | 2 ++ src/test/java/play/pluv/api/HistoryApiTest.java | 3 +++ .../java/play/pluv/fixture/HistoryEntityFixture.java | 5 ++--- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/main/java/play/pluv/history/application/dto/MusicResponse.java b/src/main/java/play/pluv/history/application/dto/MusicResponse.java index 35ecbdc..62e01cb 100644 --- a/src/main/java/play/pluv/history/application/dto/MusicResponse.java +++ b/src/main/java/play/pluv/history/application/dto/MusicResponse.java @@ -7,20 +7,21 @@ public record MusicResponse( String title, String imageUrl, - String artistNames + String artistNames, + String isrcCode ) { public static MusicResponse from(final TransferredMusic transferredMusic) { return new MusicResponse( transferredMusic.getTitle(), transferredMusic.getImageUrl(), - transferredMusic.getArtistNames() + transferredMusic.getArtistNames(), transferredMusic.getIsrcCode() ); } public static MusicResponse from(final TransferFailMusic transferFailMusic) { return new MusicResponse( transferFailMusic.getTitle(), transferFailMusic.getImageUrl(), - transferFailMusic.getArtistNames() + transferFailMusic.getArtistNames(), null ); } diff --git a/src/main/java/play/pluv/history/domain/TransferredMusic.java b/src/main/java/play/pluv/history/domain/TransferredMusic.java index 44ea39c..75295c6 100644 --- a/src/main/java/play/pluv/history/domain/TransferredMusic.java +++ b/src/main/java/play/pluv/history/domain/TransferredMusic.java @@ -28,17 +28,21 @@ public class TransferredMusic extends BaseEntity { private String imageUrl; @Getter private String artistNames; + @Getter + private String isrcCode; @Embedded private HistoryMusicId musicId; @Builder - public TransferredMusic(final Long historyId, final String title, final String imageUrl, - final String artistNames, - final HistoryMusicId musicId) { + public TransferredMusic( + final Long historyId, final String title, final String imageUrl, + final String artistNames, final String isrcCode, final HistoryMusicId musicId + ) { this.historyId = historyId; this.title = title; this.imageUrl = imageUrl; this.artistNames = artistNames; + this.isrcCode = isrcCode; this.musicId = musicId; } } diff --git a/src/test/java/play/pluv/api/FeedApiTest.java b/src/test/java/play/pluv/api/FeedApiTest.java index b790302..dccf0eb 100644 --- a/src/test/java/play/pluv/api/FeedApiTest.java +++ b/src/test/java/play/pluv/api/FeedApiTest.java @@ -131,6 +131,8 @@ public class FeedApiTest extends ApiTest { fieldWithPath("data[]").type(ARRAY).description("이전한 음악들"), fieldWithPath("data[].title").type(STRING).description("음악 이름"), fieldWithPath("data[].imageUrl").type(STRING).description("음악 이미지 url"), + fieldWithPath("data[].isrcCode").type(STRING).description("음악의 isrc Code") + .optional(), fieldWithPath("data[].artistNames").type(STRING).description("가수들") ) )); diff --git a/src/test/java/play/pluv/api/HistoryApiTest.java b/src/test/java/play/pluv/api/HistoryApiTest.java index c7c47a1..97d7419 100644 --- a/src/test/java/play/pluv/api/HistoryApiTest.java +++ b/src/test/java/play/pluv/api/HistoryApiTest.java @@ -122,6 +122,7 @@ public class HistoryApiTest extends ApiTest { fieldWithPath("msg").type(STRING).description("상태 코드에 해당하는 메시지"), fieldWithPath("data[]").type(ARRAY).description("이전하지 못한 음악들"), fieldWithPath("data[].title").type(STRING).description("음악 이름"), + fieldWithPath("data[].isrcCode").type(STRING).description("null값").optional(), fieldWithPath("data[].imageUrl").type(STRING).description("음악 이미지 url"), fieldWithPath("data[].artistNames").type(STRING).description("가수들") ) @@ -155,6 +156,8 @@ public class HistoryApiTest extends ApiTest { fieldWithPath("msg").type(STRING).description("상태 코드에 해당하는 메시지"), fieldWithPath("data[]").type(ARRAY).description("이전한 음악들"), fieldWithPath("data[].title").type(STRING).description("음악 이름"), + fieldWithPath("data[].isrcCode").type(STRING).description("음악의 isrc Code") + .optional(), fieldWithPath("data[].imageUrl").type(STRING).description("음악 이미지 url"), fieldWithPath("data[].artistNames").type(STRING).description("가수들") ) diff --git a/src/test/java/play/pluv/fixture/HistoryEntityFixture.java b/src/test/java/play/pluv/fixture/HistoryEntityFixture.java index 2b4e257..117d104 100644 --- a/src/test/java/play/pluv/fixture/HistoryEntityFixture.java +++ b/src/test/java/play/pluv/fixture/HistoryEntityFixture.java @@ -6,7 +6,6 @@ import java.time.LocalDateTime; import java.util.List; -import play.pluv.feed.application.dto.FeedDetailResponse; import play.pluv.history.domain.History; import play.pluv.history.domain.HistoryMusicId; import play.pluv.history.domain.TransferFailMusic; @@ -40,9 +39,9 @@ public class HistoryEntityFixture { public static List 이전한_음악들(final Long historyId) { return List.of( new TransferredMusic(historyId, "다시 사랑한다 말할까", "imagerUrl", "김동률", - new HistoryMusicId(SPOTIFY, "ab")), + "isrc", new HistoryMusicId(SPOTIFY, "ab")), new TransferredMusic(historyId, "오래된 노래", "imagerUrl", "김동률", - new HistoryMusicId(SPOTIFY, "cd")) + "isrc", new HistoryMusicId(SPOTIFY, "cd")) ); } From 86ccf1fb612e0d1f992369471de43efe4c159a81 Mon Sep 17 00:00:00 2001 From: hong-sile Date: Wed, 28 Aug 2024 23:37:41 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20isrcCode=EB=A5=BC=20TransferredMusi?= =?UTF-8?q?c=EC=97=90=20=EC=B6=94=EA=B0=80(#117)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../play/pluv/progress/domain/TransferredMusicInContext.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/play/pluv/progress/domain/TransferredMusicInContext.java b/src/main/java/play/pluv/progress/domain/TransferredMusicInContext.java index e86c9f1..5ba2a65 100644 --- a/src/main/java/play/pluv/progress/domain/TransferredMusicInContext.java +++ b/src/main/java/play/pluv/progress/domain/TransferredMusicInContext.java @@ -22,6 +22,7 @@ public TransferredMusic toTransferredMusic(final Long historyId) { .imageUrl(imageUrl) .title(title) .musicId(musicId) + .isrcCode(isrcCode) .build(); } }