-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
🦞 Test Coverage Report
|
🦞 Test Coverage Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!! 👏
이번 리뷰는 좀 고봉밥이네요 ...ㅎㅎ
내일 스크럼하고 같이 리뷰 얘기나눠봅시당 ㅎㅎ
@RequestParam("date") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date, | ||
@RequestParam("round") int round |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런건 Request dto 를 만드는게 어떨까요??
List<SeatsInfoDto> seatsInfoDtoList = seatRepository.findSeatInfoByShowIdAndDateAndRound(showId, | ||
date, round); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파라미터를 한줄에 나열하거나 너무길면 한라인씩 분리해서 표현하는게 보기 좋을거같습니다 ..! ㅎㅎ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영완료했습니다!
private void throwIfShowDoesNotExist(Long showId) { | ||
showRepository.findById(showId).orElseThrow( | ||
() -> new NotFoundException(ShowErrorCode.SHOW_NOT_FOUND) | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seat 에 대한 조회인데 저는 이부분에서 Show 에대한 검증이 없어도 될거같아요 🤔
그리고 해야된다면 메소드 네이밍은 검증의 역할이 강한거같은데 validateShowExist 이렇게 가는게 어떨까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throwIfShowDoesNotExist
라고 했는데 (show가 존재하지 않으면 예외를 던진다) 라는 의미입니다!! 혹시 어떠신가요?
@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); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id 비교도 추가하는게 좋을거같네요!
@Param("showId") Long showId, | ||
@Param("date") LocalDate date, | ||
@Param("round") int round |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
퓨어 인터페이스에는 Param 어노테이션 없어도 됩니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
와 ㅋㅋㅋㅋ 저걸 왜넣었지? ㅋㅋ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixture 클래스를 도메인별로 가져가는건 어떨까요?
일단 저는 도메인으로 나눠서 작성했고 Fixture 클래스 많아지면 관리가 힘들지 않을까 생각합니다....!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 그리고..! testFixture 모듈로 이전하는건 별로일까요? api 테스트할때 사용할 일이 있을수도 있을거같아서 건의드려요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 더 커지면 그때 리팩토링하며 나누려고 했었습니다..!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 해당 클래스는 testFixture모듈에 있으면 더 좋을것같네요 ㅎㅎ 패키지 위치 옮겨놓았습니당 ㅎㅎ!!
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
깔끔해졌네요! 👍
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
와우 꼼꼼하시네요 ㅋㅋㅋ 👍
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DTO 로 필요한 데이터만 조회하는거 좋은거같아요 👍
🦞 Test Coverage Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리뷰반영까지 고생하셨습니다~
방금 얘기 나눈것만 반영해주시고 머지하면 될거같아요~ 👏
🦞 Test Coverage Report
|
* [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차 리팩토링
📄 무엇을 개발했나요?
🍸 무엇을 집중적으로 리뷰해야할까요?