Skip to content
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

도서 반환 및 대출 연장 오류 #327

Closed
limehee opened this issue May 3, 2024 · 0 comments · Fixed by #328
Closed

도서 반환 및 대출 연장 오류 #327

limehee opened this issue May 3, 2024 · 0 comments · Fixed by #328
Assignees
Labels
🐞 Bug 버그 제보 및 수정

Comments

@limehee
Copy link
Collaborator

limehee commented May 3, 2024

버그 설명

도서의 상태에 무관하게 도서 대출 신청을 보낼 수 있도록 시스템을 변경하는 과정에서 발생한 예외.

public BookLoanRecord getBookLoanRecordByBookAndReturnedAtIsNullOrThrow(Book book) {
        return bookLoanRecordRepository.findByBookAndReturnedAtIsNull(book)
                .orElseThrow(() -> new NotFoundException("해당 도서 대출 기록이 없습니다."));
    }

도서 대출 기록을 가져올 때 조건식이 추가로 필요함.

예상 결과

/api/v1/book-loan-records/approve/6 PATCH 200

실제 결과

Resolved [org.springframework.dao.IncorrectResultSizeDataAccessException: Query did not return a unique result: 2 results were returned]

시뮬레이션

도서 대출 요청이 여러 개 있는 상황에서 도서 대출 연장 또는 반납 신청

로그

2024-05-03T22:58:34.652+09:00  WARN 2423391 --- [nio-5001-exec-2] p.c.a.g.handler.GlobalExceptionHandler   : Query did not return a unique result: 2 results were returned
2024-05-03T22:58:34.654+09:00  WARN 2423391 --- [nio-5001-exec-2] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.dao.IncorrectResultSizeDataAccessException: Query did not return a unique result: 2 results were returned]

환경

OS: 라즈베리파이4 Ubuntu LTS 22.04

ETC

No response

@limehee limehee added the 🐞 Bug 버그 제보 및 수정 label May 3, 2024
@limehee limehee self-assigned this May 3, 2024
@limehee limehee linked a pull request May 3, 2024 that will close this issue
@limehee limehee closed this as completed May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug 버그 제보 및 수정
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant