Skip to content

Commit e1d8ba6

Browse files
committed
[main_svc] Добавил транзакцию для обновления RequestEntity
1 parent 2b85b09 commit e1d8ba6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

main-service/src/main/java/ru/practicum/ewm/serices/RequestService.java

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public RequestDto addRequest(long userId, long eventId) {
7272
return Mapper.toRequestDto(requestEntity);
7373
}
7474

75+
@Transactional
7576
public RequestDto cancelOwnRequest(long userId, long requestId) {
7677
var requestEntity = requestRepository.findById(requestId)
7778
.orElseThrow(() -> new NotFoundException("Request not found", requestId));
@@ -83,6 +84,7 @@ public RequestDto cancelOwnRequest(long userId, long requestId) {
8384
requestEntity.setStatus(RequestStatus.CANCELED);
8485

8586
requestRepository.saveAndFlush(requestEntity);
87+
8688
return Mapper.toRequestDto(requestEntity);
8789
}
8890
}

0 commit comments

Comments
 (0)