-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add request and test. Add gateway #5
Conversation
itemRequest = itemRequestRepository.findById(itemDto.getRequestId()) | ||
.orElseThrow(() -> new NotFoundException("Request with id - " + itemDto.getRequestId() + " not found")); | ||
} | ||
Item item = itemRepository.save(itemMapper.fromDto(itemDto, user, itemRequest)); | ||
return itemMapper.toDto(item); | ||
} |
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.
над методами сервиса необходимо расставить @transactional (только над теми, которые этого требуют, т.е. изменяют состояние бд)
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.
в методе checkIfExistsUser нет необходимости - у репозитория есть метод exist
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.
если я добавлю @transactional в сервисе Usera над методами создания и изменения у меня не получается отловить ошибку, чтобы вывести информацию что email такой уже есть.
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.