-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.flickspick.movie.dto; | ||
|
||
import java.util.List; | ||
|
||
import com.flickspick.movie.model.MovieModel; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class MovieResponse { | ||
private MovieModel movie; | ||
private List<MovieModel> recMovies; | ||
|
||
public static MovieResponse toResponse(MovieModel movieModel, List<MovieModel> recMovies) { | ||
return new MovieResponse(movieModel, recMovies); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/flickspick/movie/presentation/MovieController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.flickspick.movie.presentation; | ||
|
||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.flickspick.auth.model.AuthUser; | ||
import com.flickspick.common.model.dto.ResponseDto; | ||
import com.flickspick.home.application.HomeService; | ||
import com.flickspick.movie.application.MovieService; | ||
import com.flickspick.movie.dto.MovieResponse; | ||
import com.flickspick.movie.model.MovieModel; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Tag(name = "무비") | ||
@RestController | ||
@RequestMapping(value = "/api/v1/movies", produces = MediaType.APPLICATION_JSON_VALUE) | ||
@RequiredArgsConstructor | ||
public class MovieController { | ||
private final MovieService movieService; | ||
|
||
@Operation(summary = "무비 조회") | ||
@GetMapping(path = "/{movieId}") | ||
public ResponseEntity<?> getMovie(AuthUser user, @PathVariable Long movieId) { | ||
MovieResponse response = movieService.getMovie(movieId); | ||
return ResponseDto.ok(response); | ||
} | ||
} |