Repository navigation
Спринт 12 - Промежуточное задание. Схема БД #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,2 +1,5 @@ | ||
| # java-filmorate | ||
| Template repository for Filmorate project. | ||
|
|
||
| ### Database scheme | ||
|  |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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
39 changes: 39 additions & 0 deletions
39
src/main/java/ru/yandex/practicum/filmorate/controller/GenreController.java
This file contains hidden or 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,39 @@ | ||
| package ru.yandex.practicum.filmorate.controller; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| 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 ru.yandex.practicum.filmorate.dto.GenreDto; | ||
| import ru.yandex.practicum.filmorate.service.GenreService; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/genres") | ||
| public class GenreController { | ||
| private final GenreService genreService; | ||
|
|
||
| @Autowired | ||
| public GenreController(GenreService genreService) { | ||
| this.genreService = genreService; | ||
| } | ||
|
|
||
| /** | ||
| * Возвращает жанр по id | ||
| */ | ||
| @GetMapping("/{id}") | ||
| public ResponseEntity<GenreDto> getGenreById(@PathVariable int id) { | ||
| return ResponseEntity.ok(genreService.getGenreById(id)); | ||
| } | ||
|
|
||
| /** | ||
| * Возвращает все жанры в виде списка | ||
| */ | ||
| @GetMapping | ||
| public ResponseEntity<List<GenreDto>> getGenres() { | ||
| return ResponseEntity.ok(genreService.getGenres()); | ||
| } | ||
| } |
36 changes: 36 additions & 0 deletions
36
src/main/java/ru/yandex/practicum/filmorate/controller/MpaController.java
This file contains hidden or 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,36 @@ | ||
| package ru.yandex.practicum.filmorate.controller; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.*; | ||
| import ru.yandex.practicum.filmorate.dto.MpaDto; | ||
| import ru.yandex.practicum.filmorate.service.MpaService; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/mpa") | ||
| public class MpaController { | ||
| private final MpaService mpaService; | ||
|
|
||
| @Autowired | ||
| public MpaController(MpaService mpaService) { | ||
| this.mpaService = mpaService; | ||
| } | ||
|
|
||
| /** | ||
| * Возвращает рейтинг MPA по id | ||
| */ | ||
| @GetMapping("/{id}") | ||
| public ResponseEntity<MpaDto> getMpaById(@PathVariable int id) { | ||
| return ResponseEntity.ok(mpaService.getMpaById(id)); | ||
| } | ||
|
|
||
| /** | ||
| * Возвращает все рейтинги MPA | ||
| */ | ||
| @GetMapping | ||
| public ResponseEntity<List<MpaDto>> getMpaList() { | ||
| return ResponseEntity.ok(mpaService.getMpaList()); | ||
| } | ||
| } |
This file contains hidden or 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
11 changes: 11 additions & 0 deletions
11
src/main/java/ru/yandex/practicum/filmorate/dto/GenreDto.java
This file contains hidden or 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,11 @@ | ||
| package ru.yandex.practicum.filmorate.dto; | ||
|
|
||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Data | ||
| @NoArgsConstructor | ||
| public class GenreDto { | ||
| private Integer id; | ||
| private String name; | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/main/java/ru/yandex/practicum/filmorate/dto/MpaDto.java
This file contains hidden or 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,11 @@ | ||
| package ru.yandex.practicum.filmorate.dto; | ||
|
|
||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Data | ||
| @NoArgsConstructor | ||
| public class MpaDto { | ||
| private Integer id; | ||
| private String name; | ||
| } |
23 changes: 23 additions & 0 deletions
23
src/main/java/ru/yandex/practicum/filmorate/dto/film/FilmDto.java
This file contains hidden or 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,23 @@ | ||
| package ru.yandex.practicum.filmorate.dto.film; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
| import ru.yandex.practicum.filmorate.model.Genre; | ||
| import ru.yandex.practicum.filmorate.model.Mpa; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.Set; | ||
|
|
||
| @Data | ||
| @NoArgsConstructor | ||
| public class FilmDto { | ||
| @JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||
| private int id; | ||
| private String name; | ||
| private String description; | ||
| private LocalDate releaseDate; | ||
| private Integer duration; | ||
| private Set<Genre> genres; | ||
| private Mpa mpa; | ||
| } |
24 changes: 24 additions & 0 deletions
24
src/main/java/ru/yandex/practicum/filmorate/dto/film/NewFilmRequest.java
This file contains hidden or 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,24 @@ | ||
| package ru.yandex.practicum.filmorate.dto.film; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
| import ru.yandex.practicum.filmorate.model.Genre; | ||
| import ru.yandex.practicum.filmorate.model.Mpa; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.Set; | ||
|
|
||
| @Data | ||
| @Builder | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class NewFilmRequest { | ||
| private String name; | ||
| private String description; | ||
| private LocalDate releaseDate; | ||
| private Integer duration; | ||
| private Set<Genre> genres; | ||
| private Mpa mpa; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
наличие картинки соответствует тз