Skip to content

[Reservation] 리팩토링#81

Open
J-Cheol wants to merge 4 commits intodevfrom
80-reservation-리펙토링

Hidden character warning

The head ref may contain hidden characters: "80-reservation-\ub9ac\ud399\ud1a0\ub9c1"
Open

[Reservation] 리팩토링#81
J-Cheol wants to merge 4 commits intodevfrom
80-reservation-리펙토링

Conversation

@J-Cheol
Copy link
Copy Markdown
Contributor

@J-Cheol J-Cheol commented Jan 19, 2025

이슈

작업 내용

  • 필요없는 Swagger 설명 제거 및 변경
    • 불필요한 설명 제거
    • 설명이 필요한 부분 추가
  • Reservation CQRS 적용
    • Service, Repository 분리 및 적용
  • Reservation, AdminReservation page defalutValue 설정
    • page기본값 설정으로 오류 최소화

참고사항

이번 취지는 Reservation만 리팩토링을 진행하는것을 목표로 하였기에 전체 page defalutValue를 수정하지 않은 점 참고부탁드립니다.
CQRS 적용 및 Swagger 정리를 하였고 비즈니스 로직 수정은 Cart 리팩토링 후 진행할 것 같습니다.

@J-Cheol J-Cheol added the refactoring 코드 리팩토링 작업 시 label Jan 19, 2025
@J-Cheol J-Cheol requested review from junggg097 and ppusda January 19, 2025 14:47
@J-Cheol J-Cheol self-assigned this Jan 19, 2025
@J-Cheol J-Cheol linked an issue Jan 19, 2025 that may be closed by this pull request
3 tasks

public interface ReservationCommandRepository extends JpaRepository<Reservation, Long> {

List<Reservation> findAllByStatus(ReservationStatus reservationStatus);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CommandRepository로 나누게 되었다면 findAllByStatus는 QueryRepository로 분리하는 게 더 좋을 것 같다고 생각됩니다.

좀 더 찾아보니 아래와 같은 구조도 사용되는 것 같아서 참고하셔도 좋을 것 같아용.

복잡한 쿼리의 경우에만 분리

기존 JpaRepository 를 상속받는 Repository를 그대로 사용 (간단한 조회 및 CUD 사용)
QueryRepository (복잡한 쿼리의 경우에 사용, 보통 QueryDsl을 사용함)

이렇게 하면 QueryService의 경우 두 가지 Repository를 의존해야 한다는 점이 문제지만, 서비스가 복잡하지 않은 경우에는 이 방법이 더 좋을 것 같다고도 생각이 드네용.

향후 조회 로직을 모두 QueryDsl을 활용하여 QueryRepository에서 최적화하여 구현하여 완전히 분리하는 방법도 있을 것 같습니다.

참고 - CQRS 리포지토리 질문

Copy link
Copy Markdown
Contributor

@junggg097 junggg097 left a comment

Choose a reason for hiding this comment

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

고생하셨습니당

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring 코드 리팩토링 작업 시

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Reservation] 리펙토링

3 participants