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

refactor : 이벤트 오픈 api 분리 #320

Merged
merged 3 commits into from
Feb 8, 2023
Merged

refactor : 이벤트 오픈 api 분리 #320

merged 3 commits into from
Feb 8, 2023

Conversation

gengminy
Copy link
Member

@gengminy gengminy commented Feb 7, 2023

개요

작업사항

  • 이벤트 오픈 요청 시 이벤트 체크리스트를 달성해야 열리도록 검증 로직 추가했습니다
  • 이벤트 status 변경과 이벤트 open API 를 분리했습니다
  • 각 status 별 이미 있는 상태값에 대해 중복 요청 시 예외 처리를 추가했습니다

변경로직

  • 내용을 적어주세요.

@gengminy gengminy added For: API [이슈 대상] 외부 API Type: Refactor [이슈 목적] 프로덕션 코드 리팩토링 labels Feb 7, 2023
@gengminy gengminy self-assigned this Feb 7, 2023
Copy link
Member

@ImNM ImNM left a comment

Choose a reason for hiding this comment

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

엘쥐티엠!

Comment on lines 27 to 36
final Event event = eventAdaptor.findById(eventId);
final Boolean hasBasic = event.hasEventBasic() && event.hasEventPlace();
final Boolean hasDetail = event.hasEventDetail();
final Boolean hasTicketItem = ticketItemAdaptor.existsByEventId(event.getId());
if (hasBasic && hasDetail && hasTicketItem) {
return EventResponse.of(eventService.openEvent(event));
}
// 체크리스트를 달성하지 않으면 이벤트를 열 수 없음
throw CannotOpenEventException.EXCEPTION;
}
Copy link
Member

Choose a reason for hiding this comment

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

도메인 레이어 까지 내리는게.. 좋아보입니다! 검증은요!

Copy link
Member Author

@gengminy gengminy Feb 7, 2023

Choose a reason for hiding this comment

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

도메인 레이어 까지 내리는게.. 좋아보입니다! 검증은요!

티켓 아이템 걸려있어서 일부로 안내렸어요

Copy link
Member

Choose a reason for hiding this comment

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

도메인 서비스에 내리시는건 어떨까요!
이럴때 쓰라구있는 서비스이니
@gengminy

Copy link
Member Author

Choose a reason for hiding this comment

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

도메인 서비스에 내리시는건 어떨까요! 이럴때 쓰라구있는 서비스이니 @gengminy

티켓 아이템 서비스에다 검증 하라는 말인지요

Copy link
Member

Choose a reason for hiding this comment

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

eventService.openEvent 해당 메서드로 옮기시면 좋을듯합니다

추천드린책에도 도메인서비스에서 다른 도메인 참고해도 좋다는 내용나와요!

Copy link
Member Author

Choose a reason for hiding this comment

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

eventService.openEvent 해당 메서드로 옮기시면 좋을듯합니다

추천드린책에도 도메인서비스에서 다른 도메인 참고해도 좋다는 내용나와요!

흠 확실히 이벤트 서비스에 내리는게 맞긴 한데 티켓 아이템 서비스 낀게 모양이 맘에 안드네요

Comment on lines 35 to 32
throw CannotOpenEventException.EXCEPTION;
eventService.validateEventBasicExistence(event);
eventService.validateEventDetailExistence(event);
ticketItemService.validateExistenceByEventId(eventId);

return EventResponse.of(eventService.openEvent(event));
}
Copy link
Member

Choose a reason for hiding this comment

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

eventService.openEvent(event)
해당 메소드 내부에

eventService.validateEventBasicExistence(event);
eventService.validateEventDetailExistence(event);
ticketItemService.validateExistenceByEventId(eventId);
세 메소드가 들어가면 더더 좋을것 같아요!ㅎㅎ

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 300 Code Smells

16.4% 16.4% Coverage
0.0% 0.0% Duplication

Copy link
Member

@sanbonai06 sanbonai06 left a comment

Choose a reason for hiding this comment

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

LGTM

@gengminy gengminy merged commit 9d34dfa into dev Feb 8, 2023
@ImNM ImNM deleted the refactor/301-open branch February 9, 2023 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For: API [이슈 대상] 외부 API Type: Refactor [이슈 목적] 프로덕션 코드 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🔨[refactor] 이벤트 오픈 시 단계완료되었는지 체크
3 participants