generated from yandex-praktikum/java-filmorate
-
Notifications
You must be signed in to change notification settings - Fork 0
Add database #7
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
Open
GrettaSmith
wants to merge
20
commits into
main
Choose a base branch
from
add-database
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add database #7
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c8e7b27
2
GrettaSmith 6b115df
2
GrettaSmith 09b3992
Update FilmStorage.java
GrettaSmith 14c4fe9
Update FilmStorage.java
GrettaSmith ecb45e5
Update FilmStorage.java
GrettaSmith 5e2e9bf
Update FilmStorage.java
GrettaSmith 851f061
Update FilmStorage.java
GrettaSmith 033d4c5
Update FilmStorage.java
GrettaSmith f5310e3
Update FilmStorage.java
GrettaSmith a3df228
Update FilmStorage.java
GrettaSmith 4e45684
Update FilmStorage.java
GrettaSmith dd6f169
Update FilmStorage.java
GrettaSmith 41ec9a4
Update UserStorage.java
GrettaSmith 54bdc9c
Update pom.xml
GrettaSmith cd1fb0b
Update User.java
GrettaSmith dd1119f
4
GrettaSmith 3bd6c04
4
GrettaSmith c89db5a
4
GrettaSmith 8c1e0c9
4
GrettaSmith 17dddbe
4
GrettaSmith 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
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
30 changes: 30 additions & 0 deletions
30
src/main/java/ru/yandex/practicum/filmorate/controllers/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,30 @@ | ||
| package ru.yandex.practicum.filmorate.controllers; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| 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.model.Genre; | ||
| import ru.yandex.practicum.filmorate.storage.dao.FilmDao; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/genres") | ||
| @Slf4j | ||
| @RequiredArgsConstructor | ||
| public class GenreController { | ||
| private final FilmDao filmDao; | ||
|
|
||
| @GetMapping | ||
| public List<Genre> getGenres() { | ||
| return filmDao.getGenres(); | ||
| } | ||
|
|
||
| @GetMapping("/{id}") | ||
| public Genre getGenreByID(@PathVariable Integer id) { | ||
| return filmDao.getGenreById(id); | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
src/main/java/ru/yandex/practicum/filmorate/controllers/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,30 @@ | ||
| package ru.yandex.practicum.filmorate.controllers; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| 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.model.MPARating; | ||
| import ru.yandex.practicum.filmorate.storage.dao.FilmDao; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/mpa") | ||
| @Slf4j | ||
| @RequiredArgsConstructor | ||
| public class MpaController { | ||
| private final FilmDao filmDao; | ||
|
|
||
| @GetMapping | ||
| public List<MPARating> getRatings() { | ||
| return filmDao.getMPAS(); | ||
| } | ||
|
|
||
| @GetMapping("/{id}") | ||
| public MPARating getGenreByID(@PathVariable Integer id) { | ||
| return filmDao.getMPAbyId(id); | ||
| } | ||
| } |
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
17 changes: 17 additions & 0 deletions
17
src/main/java/ru/yandex/practicum/filmorate/model/Genre.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,17 @@ | ||
| package ru.yandex.practicum.filmorate.model; | ||
|
|
||
|
|
||
| import lombok.AccessLevel; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
| import lombok.experimental.FieldDefaults; | ||
|
|
||
| @Data | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| @FieldDefaults(level = AccessLevel.PRIVATE) | ||
| public class Genre { | ||
| Integer id; | ||
| String name; | ||
| } |
16 changes: 16 additions & 0 deletions
16
src/main/java/ru/yandex/practicum/filmorate/model/MPARating.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,16 @@ | ||
| package ru.yandex.practicum.filmorate.model; | ||
|
|
||
| import lombok.AccessLevel; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
| import lombok.experimental.FieldDefaults; | ||
|
|
||
| @Data | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| @FieldDefaults(level = AccessLevel.PRIVATE) | ||
| public class MPARating { | ||
| Integer id; | ||
| String name; | ||
| } |
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
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.
Валидировать лучше в слое контроллеров