From 550e347bfd92572592244cfcb7ef3877f182de44 Mon Sep 17 00:00:00 2001 From: hong-sile Date: Sun, 29 Sep 2024 22:29:44 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=B0=98=ED=99=98=ED=98=95?= =?UTF-8?q?=EC=8B=9D=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../play/pluv/feed/application/FeedReader.java | 2 +- .../play/pluv/feed/controller/FeedController.java | 1 - .../playlist/controller/PlayListController.java | 12 ++++++------ src/test/java/play/pluv/api/PlayListApiTest.java | 14 ++++++++------ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/play/pluv/feed/application/FeedReader.java b/src/main/java/play/pluv/feed/application/FeedReader.java index b22b258..cc350b8 100644 --- a/src/main/java/play/pluv/feed/application/FeedReader.java +++ b/src/main/java/play/pluv/feed/application/FeedReader.java @@ -23,7 +23,7 @@ public class FeedReader { public List findAll() { return feedRepository.findAll().stream() .sorted(comparing(Feed::getCreatedAt).reversed()) - .sorted(comparing(feed -> feed.getId() <= 116)) + .sorted(comparing(feed -> feed.getId() > 116)) .toList(); } diff --git a/src/main/java/play/pluv/feed/controller/FeedController.java b/src/main/java/play/pluv/feed/controller/FeedController.java index 82eb84e..f96c51f 100644 --- a/src/main/java/play/pluv/feed/controller/FeedController.java +++ b/src/main/java/play/pluv/feed/controller/FeedController.java @@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import play.pluv.base.BaseResponse; import play.pluv.feed.application.FeedService; diff --git a/src/main/java/play/pluv/playlist/controller/PlayListController.java b/src/main/java/play/pluv/playlist/controller/PlayListController.java index acb2b0c..f951db9 100644 --- a/src/main/java/play/pluv/playlist/controller/PlayListController.java +++ b/src/main/java/play/pluv/playlist/controller/PlayListController.java @@ -29,21 +29,21 @@ public class PlayListController { private final PlayListService playListService; @PostMapping("/spotify/read") - public ResponseEntity> readSpotifyPlayLists( + public BaseResponse> readSpotifyPlayLists( @Valid @RequestBody final PlayListReadRequest request ) { final var playLists = playListService.getPlayLists(request.accessToken(), SPOTIFY); final List response = PlayListOverViewResponse.createList(playLists); - return ResponseEntity.ok(response); + return BaseResponse.ok(response); } @PostMapping("/youtube/read") - public ResponseEntity> readYoutubePlayLists( + public BaseResponse> readYoutubePlayLists( @Valid @RequestBody final PlayListReadRequest request ) { final var playLists = playListService.getPlayLists(request.accessToken(), YOUTUBE); final List response = PlayListOverViewResponse.createList(playLists); - return ResponseEntity.ok(response); + return BaseResponse.ok(response); } @PostMapping("/ocr/read") @@ -74,12 +74,12 @@ public BaseResponse> readYoutubeMusics( } @PostMapping("/apple/read") - public ResponseEntity> readApplePlayLists( + public BaseResponse> readApplePlayLists( @Valid @RequestBody final ApplePlayListReadRequest request ) { final var playLists = playListService.getPlayLists(request.musicUserToken(), APPLE); final List response = PlayListOverViewResponse.createList(playLists); - return ResponseEntity.ok(response); + return BaseResponse.ok(response); } @PostMapping("/apple/{id}/read") diff --git a/src/test/java/play/pluv/api/PlayListApiTest.java b/src/test/java/play/pluv/api/PlayListApiTest.java index 8d7f0f2..f388ce5 100644 --- a/src/test/java/play/pluv/api/PlayListApiTest.java +++ b/src/test/java/play/pluv/api/PlayListApiTest.java @@ -34,12 +34,14 @@ public class PlayListApiTest extends ApiTest { private static final FieldDescriptor[] PLAY_LIST_RESPONSE = { - fieldWithPath("[]").type(ARRAY).description("플레이리스트 전체"), - fieldWithPath("[].thumbNailUrl").type(STRING).description("플레이리스트 섬네일 url"), - fieldWithPath("[].songCount").type(NUMBER).description("플레이리스트 안에 있는 곡 수").optional(), - fieldWithPath("[].name").type(STRING).description("플레이리스트 이름"), - fieldWithPath("[].source").type(STRING).description("플레이리스트 출처"), - fieldWithPath("[].id").type(STRING).description("플레이리스트 식별자")}; + fieldWithPath("code").type(NUMBER).description("상태 코드"), + fieldWithPath("msg").type(STRING).description("상태 코드에 해당하는 메시지"), + fieldWithPath("data[]").type(ARRAY).description("플레이리스트 전체"), + fieldWithPath("data[].thumbNailUrl").type(STRING).description("플레이리스트 섬네일 url"), + fieldWithPath("data[].songCount").type(NUMBER).description("플레이리스트 안에 있는 곡 수").optional(), + fieldWithPath("data[].name").type(STRING).description("플레이리스트 이름"), + fieldWithPath("data[].source").type(STRING).description("플레이리스트 출처"), + fieldWithPath("data[].id").type(STRING).description("플레이리스트 식별자")}; private static final FieldDescriptor[] MUSIC_RESPONSE = { fieldWithPath("code").type(NUMBER).description("상태 코드"),