Class SongController

java.lang.Object
inha.dayoook_e.song.api.controller.SongController

@RestController @RequestMapping("/api/v1/songs") public class SongController extends Object
SongController은 동요 관련 엔드포인트를 처리.
  • Constructor Details

    • SongController

      public SongController()
  • Method Details

    • getSongs

      @GetMapping public BaseResponse<org.springframework.data.domain.Slice<SongSearchPageResponse>> getSongs(@AuthenticationPrincipal User user, @Validated @ModelAttribute SearchCond searchCond, @RequestParam("page") Integer page)
      동요 조회 API

      동요를 조회합니다.

      Parameters:
      searchCond - 검색 조건
      page - 페이지 번호
      Returns:
      동요 조회 결과를 포함하는 BaseResponse<Slice>
    • getSong

      @GetMapping("/{songId}") public BaseResponse<SongSearchResponse> getSong(@AuthenticationPrincipal User user, @PathVariable("songId") Integer songId)
      동요 상세 조회 API

      동요를 상세 조회합니다.

      Parameters:
      user - 로그인한 사용자
      songId - 동요 ID
      Returns:
      동요 상세 조회 결과를 포함하는 BaseResponse
    • createSong

      @PostMapping(consumes="multipart/form-data") @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public BaseResponse<SongResponse> createSong(@AuthenticationPrincipal User user, @Validated @RequestPart("song") CreateSongRequest createSongRequest, @RequestPart("thumbnail") org.springframework.web.multipart.MultipartFile thumbnail, @RequestPart("media") org.springframework.web.multipart.MultipartFile media)
      동요 생성 API

      동요를 생성합니다.

      Parameters:
      createSongRequest - 동요 생성 요청
      thumbnail - 썸네일 이미지
      media - 미디어 파일
      Returns:
      동요 생성 결과를 포함하는 BaseResponse
    • toggleLike

      @PostMapping("/{songId}/toggle-like") public BaseResponse<LikedTuteeSongProgressResponse> toggleLike(@AuthenticationPrincipal User user, @PathVariable("songId") Integer songId)
      좋아요 토글 API

      좋아요를 토글합니다.

      Parameters:
      user - 로그인한 사용자
      songId - 동요 ID
      Returns:
      좋아요 토글 결과를 포함하는 BaseResponse
    • completeSong

      @PostMapping("/{songId}/complete") public BaseResponse<SongResponse> completeSong(@AuthenticationPrincipal User user, @PathVariable("songId") Integer songId)
      동요 완료 API

      동요 듣는 것을 완료합니다.

      Parameters:
      user - 로그인한 사용자
      songId - 동요 ID
      Returns:
      동요 완료 결과를 포함하는 BaseResponse