Skip to content

Commit

Permalink
feat: 애플뮤직으로 이전하는 기능 추가(#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
hong-sile committed Aug 16, 2024
1 parent ebd9c89 commit 464e359
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/main/java/play/pluv/music/controller/MusicController.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,12 @@ public BaseResponse<String> transferYoutubeMusics(
musicService.transferMusics(request, YOUTUBE);
return BaseResponse.created();
}

@PostMapping("/apple/add")
public BaseResponse<String> transferAppleMusics(
@Valid @RequestBody final MusicAddRequest request
) {
musicService.transferMusics(request, APPLE);
return BaseResponse.created();
}
}
17 changes: 16 additions & 1 deletion src/test/java/play/pluv/api/MusicApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class MusicApiTest extends ApiTest {
)};
private static final Snippet[] TRANSFER_MUSIC_SNIPPET = {requestFields(
fieldWithPath("destinationAccessToken").type(STRING)
.description("플레이리스트 제공자의 accessToken"),
.description("플레이리스트 제공자의 accessToken(애플의 경우엔 musicUserToken)"),
fieldWithPath("musicIds[]").type(ARRAY).description("음악 id들"),
fieldWithPath("playListName").type(STRING).description("플레이리스트 이름들")
),
Expand Down Expand Up @@ -152,4 +152,19 @@ public class MusicApiTest extends ApiTest {
TRANSFER_MUSIC_SNIPPET
));
}

@Test
void 음악들을_애플뮤직의_새로운_플리에_추가한다() throws Exception {
final MusicAddRequest 음악_추가_요청 = 음악_추가_요청();

final String requestBody = objectMapper.writeValueAsString(음악_추가_요청);

mockMvc.perform(post("/music/apple/add")
.contentType(APPLICATION_JSON_VALUE)
.content(requestBody))
.andExpect(status().isOk())
.andDo(document("add-apple-music",
TRANSFER_MUSIC_SNIPPET
));
}
}

0 comments on commit 464e359

Please sign in to comment.