Skip to content

Commit 3510fe5

Browse files
authored
Merge pull request #208 from Dugout-Developers/fix/#207
[FIX] 직관신청 수락 & 거절시 발생하는 오류 수정
2 parents 1547568 + a043222 commit 3510fe5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/com/back/catchmate/domain/enroll/service/EnrollServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public UpdateEnrollInfo acceptEnroll(Long enrollId, Long userId) throws IOExcept
198198
enroll.respondToEnroll(AcceptStatus.ACCEPTED);
199199
enterChatRoom(enrollApplicant, board);
200200

201-
Notification notification = notificationRepository.findByUserIdAndBoardIdAndAcceptStatusAndDeletedAtIsNull(enroll.getBoard().getUser().getId(), enroll.getBoard().getId(), AcceptStatus.PENDING)
201+
Notification notification = notificationRepository.findByUserIdAndBoardIdAndSenderIdAndAcceptStatusAndDeletedAtIsNull(enroll.getBoard().getUser().getId(), enroll.getBoard().getId(), enrollApplicant.getId(), AcceptStatus.PENDING)
202202
.orElseThrow(() -> new BaseException(ErrorCode.NOTIFICATION_NOT_FOUND));
203203
notification.updateAcceptStatus(AcceptStatus.ALREADY_ACCEPTED);
204204

@@ -243,7 +243,7 @@ public UpdateEnrollInfo rejectEnroll(Long enrollId, Long userId) throws IOExcept
243243
throw new BaseException(ErrorCode.ENROLL_REJECT_INVALID);
244244
}
245245

246-
Notification notification = notificationRepository.findByUserIdAndBoardIdAndAcceptStatusAndDeletedAtIsNull(enroll.getBoard().getUser().getId(), enroll.getBoard().getId(), AcceptStatus.PENDING)
246+
Notification notification = notificationRepository.findByUserIdAndBoardIdAndSenderIdAndAcceptStatusAndDeletedAtIsNull(enroll.getBoard().getUser().getId(), enroll.getBoard().getId(), enrollApplicant.getId(), AcceptStatus.PENDING)
247247
.orElseThrow(() -> new BaseException(ErrorCode.NOTIFICATION_NOT_FOUND));
248248
notification.updateAcceptStatus(AcceptStatus.ALREADY_REJECTED);
249249

src/main/java/com/back/catchmate/domain/notification/repository/NotificationRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public interface NotificationRepository extends JpaRepository<Notification, Long
1515

1616
Optional<Notification> findByBoardIdAndUserIdAndSenderIdAndDeletedAtIsNull(Long boardId, Long userId, Long senderId);
1717

18-
Optional<Notification> findByUserIdAndBoardIdAndAcceptStatusAndDeletedAtIsNull(Long userId, Long boardId, AcceptStatus acceptStatus);
18+
Optional<Notification> findByUserIdAndBoardIdAndSenderIdAndAcceptStatusAndDeletedAtIsNull(Long userId, Long boardId, Long senderId, AcceptStatus acceptStatus);
1919

2020
Boolean existsByUserIdAndIsReadFalseAndDeletedAtIsNull(Long userId);
2121
}

0 commit comments

Comments
 (0)