-
Notifications
You must be signed in to change notification settings - Fork 0
Add database #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
Add database #3
Conversation
| private Integer duration; | ||
| private int likes; | ||
| private int likesCount; | ||
| List<Genre> genres; |
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.
Не указаны модификаторы доступа
| @Past | ||
| @NotNull | ||
| private LocalDate birthday; | ||
| Set<Integer> friends; |
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.
Не указан модификатор доступа
| public Collection<Genre> getAll() { | ||
| return genreDbStorage.getAll(); | ||
| } | ||
|
|
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.
Слишком много пустых строк
|
|
||
| private static final String GET_BY_ID = """ | ||
| SELECT | ||
| f.id AS film_id, |
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.
Поля выборки можно так же вынести в отдельную строку, чтобы не дублировать их во всех запросах
| return jdbc.query(GET_FILM_BY_LIKES, rowMapper, sizeFilms); | ||
| } | ||
|
|
||
| private static Integer getMaxIdMapper(ResultSet resultSet, int rowNum) throws SQLException { |
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.
static кажется излишним для приватных методов
| } | ||
| } | ||
|
|
||
| private void validateIdMpa(Integer id) { |
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.
Кажется проще будет проверять путем нахождения mpa по переданном id, если не найден, то NotFoundException("Ваш id = " + id + " в таблице mpa не найден");
| } | ||
| } | ||
|
|
||
| private void validateIdGenre(Integer id) { |
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.
Аналогичный комментарий для жанра
| return jdbc.query(GET_ALL, GenreDbStorage::getGenreMapper); | ||
| } | ||
|
|
||
| private static Genre getGenreMapper(ResultSet resultSet, int rowNum) throws SQLException { |
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.
static кажется излишним для приватных методов
| } | ||
|
|
||
|
|
||
| private static MpaRating getMpaRatingMapper(ResultSet resultSet, int rowNum) throws SQLException { |
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.
static кажется излишним для приватных методов
src/main/resources/schema.sql
Outdated
| login VARCHAR(100) NOT NULL UNIQUE, | ||
| name VARCHAR(100), | ||
| birthday DATE NOT NULL, | ||
| friend_id INTEGER |
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.
Эта колонка кажется лишней, так как связь дружбы лежит в таблице friendship
No description provided.