-
Notifications
You must be signed in to change notification settings - Fork 0
Add item requests and gateway #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
base: main
Are you sure you want to change the base?
Conversation
Рефакторинг мапперов на static методы
…вил тестирование контроллеров
server/src/main/java/ru/practicum/shareit/booking/BookingController.java
Outdated
Show resolved
Hide resolved
server/src/main/java/ru/practicum/shareit/booking/storage/BookingStorageInDb.java
Show resolved
Hide resolved
| import lombok.Builder; | ||
|
|
||
| @Builder | ||
| public record ItemToUpdateDto( |
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.
Нужно добавить аннотации для валидации
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.
Не нужно. Нет правил к заполнению
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.
Ок, если частично обновлять, то не нужно.
| import ru.practicum.shareit.rest.RestService; | ||
|
|
||
| @Service | ||
| public class BookingService extends RestService { |
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.
Эти классы не логично называть Service, т.к. в них нет никакой бизнес-логики по работе с сущностями. Лучше назвать RestClient и BookingClient и пометить аннотацией @Component
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.
Сервис, потому что стоят за контроллером. А клиентом не хочу называть, т.к. клиент внутри используется.
И бизнес-логика подразумевалась в задании, в описании маршрутизации рест-запросов
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.
Классы получают аннотацию @Service потому что они принадлежат сервисному слою приложения, а не потому что стоят за контроллером. Маршрутизация -это не бизнес-логика. В задании как раз говорится, что "shareIt-server будет содержать всю основную логику ", а в shareIt-gateway нужно вынести "всю валидацию входных данных".
PS
Если хочешь подчеркнуть, что основная задача класса маршрутизация, то можно назвать Router
VadimZharkov
left a comment
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.
В тесты нужно добавить интеграционные тесты. Это когда хранилище не мокаем, а используем реальную базу. В данной работе достаточно будет протестировать репозитории с помощью @DataJpaTest
VadimZharkov
left a comment
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.
Нужно еще доработать
No description provided.