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

[feat]: 공연,날짜,회차에 대한 좌석 조회 API 추가 #42

Merged
merged 19 commits into from
Dec 29, 2023

Conversation

ssssujini99
Copy link
Contributor

📄 무엇을 개발했나요?

  • 공연 좌석 정보 조회 controller, application, repository 구현 및 각 레이어 별 테스트 구현 완료

🍸 무엇을 집중적으로 리뷰해야할까요?

  • 네이밍, 컨벤션 확인
  • application 비즈니즈 로직 확인
  • 테스트에서 중복되는 객체 생성에 대해 fixture로 빼고 리팩토링까지 함께 진행했습니다

Copy link

🦞 Test Coverage Report

Overall Project NaN% NaN% 🟢

There is no coverage information present for the Files changed

Copy link

🦞 Test Coverage Report

Overall Project NaN% NaN% 🟢

There is no coverage information present for the Files changed

Copy link
Member

@EunChanNam EunChanNam 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 +25 to +26
@RequestParam("date") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date,
@RequestParam("round") int round
Copy link
Member

Choose a reason for hiding this comment

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

이런건 Request dto 를 만드는게 어떨까요??

Comment on lines 28 to 29
List<SeatsInfoDto> seatsInfoDtoList = seatRepository.findSeatInfoByShowIdAndDateAndRound(showId,
date, round);
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
Contributor Author

Choose a reason for hiding this comment

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

반영완료했습니다!

Comment on lines +41 to +45
private void throwIfShowDoesNotExist(Long showId) {
showRepository.findById(showId).orElseThrow(
() -> new NotFoundException(ShowErrorCode.SHOW_NOT_FOUND)
);
}
Copy link
Member

Choose a reason for hiding this comment

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

Seat 에 대한 조회인데 저는 이부분에서 Show 에대한 검증이 없어도 될거같아요 🤔
그리고 해야된다면 메소드 네이밍은 검증의 역할이 강한거같은데 validateShowExist 이렇게 가는게 어떨까요?

Copy link
Contributor Author

@ssssujini99 ssssujini99 Dec 29, 2023

Choose a reason for hiding this comment

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

throwIfShowDoesNotExist 라고 했는데 (show가 존재하지 않으면 예외를 던진다) 라는 의미입니다!! 혹시 어떠신가요?

Comment on lines 125 to 141
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Seat seat = (Seat)o;
return isSeat == seat.isSeat && price == seat.price && Objects.equals(show, seat.show)
&& seatGrade == seat.seatGrade && Objects.equals(positionInfo, seat.positionInfo)
&& Objects.equals(showDate, seat.showDate) && Objects.equals(showRound, seat.showRound)
&& seatStatus == seat.seatStatus;
}

@Override
public int hashCode() {
return Objects.hash(show, seatGrade, isSeat, positionInfo, price, showDate, showRound, seatStatus);
}
Copy link
Member

Choose a reason for hiding this comment

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

id 비교도 추가하는게 좋을거같네요!

Comment on lines 21 to 23
@Param("showId") Long showId,
@Param("date") LocalDate date,
@Param("round") int round
Copy link
Member

Choose a reason for hiding this comment

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

퓨어 인터페이스에는 Param 어노테이션 없어도 됩니다!

Copy link
Contributor Author

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.

Fixture 클래스를 도메인별로 가져가는건 어떨까요?
일단 저는 도메인으로 나눠서 작성했고 Fixture 클래스 많아지면 관리가 힘들지 않을까 생각합니다....!

Copy link
Member

Choose a reason for hiding this comment

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

아 그리고..! testFixture 모듈로 이전하는건 별로일까요? api 테스트할때 사용할 일이 있을수도 있을거같아서 건의드려요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

저는 더 커지면 그때 리팩토링하며 나누려고 했었습니다..!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵 해당 클래스는 testFixture모듈에 있으면 더 좋을것같네요 ㅎㅎ 패키지 위치 옮겨놓았습니당 ㅎㅎ!!

Comment on lines +76 to +85
given(showRepository.findById(showId)).willReturn(Optional.of(show));

given(seatRepository.findSeatInfoByShowIdAndDateAndRound(showId, date, round))
.willReturn(seatsInfoDtoList);
given(seatRepository.findSeatsByShowIdAndDateAndRoundAndGrade(showId, date, round, VIP))
.willReturn(vipSeatsDetailDtoList);
given(seatRepository.findSeatsByShowIdAndDateAndRoundAndGrade(showId, date, round, S))
.willReturn(sSeatsDetailDtoList);
given(seatRepository.findSeatsByShowIdAndDateAndRoundAndGrade(showId, date, round, A))
.willReturn(aSeatsDetailDtoList);
Copy link
Member

Choose a reason for hiding this comment

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

고생하신 흔적이....보이네요 👏

Place place = new Place(
"블루스퀘어 신한카드홀",
"1544-1591",
"서울특별시 용산구 이태원로 294 블루스퀘어(한남동)",
"http://www.bluesquare.kr/index.asp"
);
Place place = TestFixture.getPlace();
Place savedPlace = placeRepository.save(place);
ShowPeriod showPeriod = new ShowPeriod(LocalDate.of(2023, 10, 10), LocalDate.of(2023, 10, 12));
ShowTime showTime = new ShowTime(150, 15);
Show show = new Show
("레미제라블",
MUSICAL,
showPeriod,
showTime,
"만 8세 이상",
300,
savedPlace
);

Show show = TestFixture.getShow(savedPlace);
Copy link
Member

Choose a reason for hiding this comment

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

깔끔해졌네요! 👍

Comment on lines +36 to +70
jsonPath("$.seatsInfo").isArray(),
jsonPath("$.seatsInfo[0].grade").isString(),
jsonPath("$.seatsInfo[0].leftSeats").isNumber(),
jsonPath("$.seatsInfo[0].price").isNumber(),
jsonPath("$.seatsInfo[0].seats[0].id").isNumber(),
jsonPath("$.seatsInfo[0].seats[0].date").isString(),
jsonPath("$.seatsInfo[0].seats[0].isBookingAvailable").isString(),
jsonPath("$.seatsInfo[0].seats[0].seat").isBoolean(),
jsonPath("$.seatsInfo[0].seats[0].positionInfo_sector").isString(),
jsonPath("$.seatsInfo[0].seats[0].positionInfo_row").isString(),
jsonPath("$.seatsInfo[0].seats[0].positionInfo_col").isNumber(),

jsonPath("$.seatsInfo").isArray(),
jsonPath("$.seatsInfo[1].grade").isString(),
jsonPath("$.seatsInfo[1].leftSeats").isNumber(),
jsonPath("$.seatsInfo[1].price").isNumber(),
jsonPath("$.seatsInfo[1].seats[0].id").isNumber(),
jsonPath("$.seatsInfo[1].seats[0].date").isString(),
jsonPath("$.seatsInfo[1].seats[0].isBookingAvailable").isString(),
jsonPath("$.seatsInfo[1].seats[0].seat").isBoolean(),
jsonPath("$.seatsInfo[1].seats[0].positionInfo_sector").isString(),
jsonPath("$.seatsInfo[1].seats[0].positionInfo_row").isString(),
jsonPath("$.seatsInfo[1].seats[0].positionInfo_col").isNumber(),

jsonPath("$.seatsInfo").isArray(),
jsonPath("$.seatsInfo[2].grade").isString(),
jsonPath("$.seatsInfo[2].leftSeats").isNumber(),
jsonPath("$.seatsInfo[2].price").isNumber(),
jsonPath("$.seatsInfo[2].seats[0].id").isNumber(),
jsonPath("$.seatsInfo[2].seats[0].date").isString(),
jsonPath("$.seatsInfo[2].seats[0].isBookingAvailable").isString(),
jsonPath("$.seatsInfo[2].seats[0].seat").isBoolean(),
jsonPath("$.seatsInfo[2].seats[0].positionInfo_sector").isString(),
jsonPath("$.seatsInfo[2].seats[0].positionInfo_row").isString(),
jsonPath("$.seatsInfo[2].seats[0].positionInfo_col").isNumber()
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
Contributor Author

Choose a reason for hiding this comment

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

감사합니당 😆


public interface SeatRepository {

void saveAll(Iterable<Seat> seats);

List<SeatDateRoundDto> findSeatDateRoundInfoByShowId(Long showId);

List<SeatsInfoDto> findSeatInfoByShowIdAndDateAndRound(
Copy link
Member

Choose a reason for hiding this comment

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

DTO 로 필요한 데이터만 조회하는거 좋은거같아요 👍

Copy link

🦞 Test Coverage Report

Overall Project NaN% NaN% 🟢

There is no coverage information present for the Files changed

Copy link
Member

@EunChanNam EunChanNam left a comment

Choose a reason for hiding this comment

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

리뷰반영까지 고생하셨습니다~
방금 얘기 나눈것만 반영해주시고 머지하면 될거같아요~ 👏

Copy link

🦞 Test Coverage Report

Overall Project NaN% NaN% 🟢

There is no coverage information present for the Files changed

@ssssujini99 ssssujini99 merged commit de8ee0d into dev Dec 29, 2023
2 checks passed
@EunChanNam EunChanNam deleted the feat/#36/show-seats-api branch December 29, 2023 05:50
EunChanNam pushed a commit that referenced this pull request Jan 15, 2024
* [test]: ShowSeatsApiController test 추가

* [feat]: 공연 좌석 조회 controller 추가

* [feat]: 공연 좌석 조회 Application 추가

* [refactor]: 좌석 도메인 리팩토링

* [test]: TestFixture 추가 및 기존 코드 리팩토링

* [test]: 공연 좌석 조회 Application 테스트 추가

* [feat]: 공연 좌석 조회 - SeatRepository, SeatRepositoryAdaptor 추가

* [test]: 공연 좌석 조회 - jpa query 테스트, adaptor 테스트 추가

* [docs]: 인수테스트용 sql 더미데이터 파일 추가

* [refactor]: 코드 리팩토링

* [refactor]: 코드 라인 줄맞춤

* [refactor]: EqualsAndHashCode 수정

* [refactor]: 쿼리모델, 응답모델 분리

* [refactor]: 줄맞춤 리팩토링

* [refactor]: sql 코드 라인 줄맞춤

* [refactor]: testFixture 클래스 위치 변경

* [refactor]: 2차 리팩토링
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Feat 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat]: 사용자는 공연의 특정 날짜에 예매 가능한 회차와 좌석을 조회할 수 있다
2 participants