Skip to content

Conversation

@Just-Roman
Copy link
Owner

No description provided.

private void validateReleaseDate(Film film) {
log.debug("validateReleaseDate start for {}", film);
LocalDate birthdayFilm = LocalDate.of(1895, 12, 28);
if (film.getReleaseDate() != null) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

у фильма может не быть описания (это ведь кто-то должен его написать), но вот отсутствие даты выпуска уже повод бросить исключение. Можно это реализовать здесь или в классе Film через аннотацию @NotNull

}
}

private void validateCloneName(Film film) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

спорная проверка, в Задании нет требований, чтобы наименование фильма было уникальным, да и в жизни не мало фильмов с одинаковым названием

log.debug("POST, create user {}", user);
cloneSearchEmail(user);
user.setId(getNextId());
if (user.getName() == null) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

эта логика нужна и в методе update(), поэтому лучше вынести в отдельный внутренний метод и переиспользовать

private String description;
private LocalDate releaseDate;
@Positive
private Integer duration;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

для этого поля еще нужна аннотация @NotNull с комментарием

private String login;
private String name;
@Past
private LocalDate birthday;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и сюда тоже

@Just-Roman Just-Roman merged commit 5134392 into main Dec 14, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants