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

GTB-75 [feat] DTO 예외처리 수정 #87

Merged
merged 13 commits into from
Sep 22, 2024
Merged

GTB-75 [feat] DTO 예외처리 수정 #87

merged 13 commits into from
Sep 22, 2024

Conversation

jwnnoh
Copy link
Member

@jwnnoh jwnnoh commented Sep 16, 2024

1. 무슨 이유로 코드를 변경했나요?

DTO 내용 수정 및 예외처리를 추가적으로 적용합니다.

DTO 수정

  • 주점 상세조회 API에 썸네일 필드를 추가하였습니다.

날짜 표기 방식 변경

M월 D일 (E) HH:MM

  • DateTimeFormatters 클래스를 별도로 생성하여, 해당 클래스에서 상수로 포맷팅을 관리하는 방식으로 적용하였습니다.
  • 표기 방식을 변경하기 위해, 웨이팅 상세조회 DTO의 생성자를 빌더로 변경 및 적용하였습니다.

정책 변경

삭제

  • 현재 주점을 이용중인 사용자가 다른 주점에 웨이팅을 신청하는 것을 막는 예외처리를 삭제하였습니다.

추가

  • 웨이팅 신청시 대기 마감일 경우의 예외처리를 추가하였습니다.
    public class Pub
    ...
        public void checkStatus() {
          if (!this.openStatus) {
              throw new PubNotOpenException();
          }
    
          if (!this.waitingStatus) {
              throw new PubClosedForWaitingException();
          }
      }
    ...
  • 테이블 번호의 중복 입력에 대한 예외처리를 추가하였습니다.

2. 어떤 위험이나 장애를 발견했나요?


3. 관련 스크린샷을 첨부해주세요.

시간 표기 방식 수정

사용자

사용자 웨이팅 내역 조회 사용자 웨이팅 현황 조회 알림톡 웨이팅 현황

어드민

어드민 테이블 조회

4. 완료 사항

  • DTO 수정
    • thumbnail 필드 추가
    • 날짜 표기 방식 변경
  • 예외처리 추가
  • 로직 변경

이슈 번호

close #86


5. 추가 사항

로직 변경

중복 주점에 대한 웨이팅 신청을 판별하는 로직을 람다 형식으로 변경하여 스타일을 통일하였습니다.

AS-IS

private void checkDuplicatePubWaiting(Pub pub, User user) {
        if (waitingRepository.findByTelAndPubAndWaitingStatusOrWaitingStatus(
                user.getUserTel(), pub, Status.WAITING, Status.AVAILABLE).isPresent()) {
            throw new WaitingAlreadyExistsException();
        }
    }

TO-BE

private void checkDuplicatePubWaiting(Pub pub, User user) {
        waitingRepository
                .findByTelAndPubAndWaitingStatusOrWaitingStatus(
                        user.getUserTel(), pub, Status.WAITING, Status.AVAILABLE)
                .ifPresent(waiting -> {
                    throw new WaitingAlreadyExistsException();
                });
    }

@jwnnoh jwnnoh added ✨ feature 새로운 기능 ♻️ refactor 코드 리팩토링 labels Sep 16, 2024
@jwnnoh jwnnoh self-assigned this Sep 16, 2024
@jwnnoh jwnnoh requested review from rootTiket, hoonyworld and yechan-kim and removed request for rootTiket and hoonyworld September 16, 2024 08:14
Copy link
Contributor

@rootTiket rootTiket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다. 현재 구현 된 부분에서 크게 문제되는 부분은 없어보이네요 !

@yechan-kim
Copy link
Contributor

고생하셨습니다. 지금까지 구현된 부분에서는 이상 없어 보입니다. 남은 로직도 파이팅입니다👍

@jwnnoh jwnnoh requested review from rootTiket, hoonyworld and yechan-kim and removed request for yechan-kim, rootTiket and hoonyworld September 21, 2024 12:54
@yechan-kim
Copy link
Contributor

고생하셨습니다! 남은 로직도 잘 구현하신 것 같습니다! 추후에 여건이 된다면 다른 코드들도 스타일을 통일하면, 가독성에 큰 도움이 될 것 같습니다!

@jwnnoh jwnnoh merged commit ced58fd into develop Sep 22, 2024
@jwnnoh jwnnoh deleted the GTB-75 branch September 22, 2024 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature 새로운 기능 ♻️ refactor 코드 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GTB-75 [feat] DTO 예외처리 수정
3 participants