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

숙소, 객실, 예약 Entity 설계 #7

Merged
merged 10 commits into from
Jan 4, 2024
Merged

숙소, 객실, 예약 Entity 설계 #7

merged 10 commits into from
Jan 4, 2024

Conversation

Hwang-Kyu-Cheol
Copy link
Contributor

개요

숙소, 객실, 예약 Entity 구현
Resolves: #5

PR 유형

어떤 변경 사항이 있나요?

  • 새로운 기능 추가
  • 버그 수정
  • CSS 등 사용자 UI 디자인 변경
  • 코드에 영향을 주지 않는 변경사항(오타 수정, 탭 사이즈 변경, 변수명 변경)
  • 코드 리팩토링
  • 주석 추가 및 수정
  • 문서 수정
  • 테스트 추가, 테스트 리팩토링
  • 빌드 부분 혹은 패키지 매니저 수정
  • 파일 혹은 폴더명 수정
  • 파일 혹은 폴더 삭제

PR Checklist

PR이 다음 요구 사항을 충족하는지 확인하세요.

  • 커밋 메시지 컨벤션에 맞게 작성했습니다. Commit message convention 참고 (Ctrl + 클릭하세요.)
  • 변경 사항에 대한 테스트를 했습니다.(버그 수정/기능에 대한 테스트)

Accommodation Entity 구현
Room Entity 구현
RoomOrder Entity 구현
RoomOrder Entity 구현
import문 알파벳에 맞게 정렬
Member Entity에 ID 추가
Comment on lines 55 to 57
private String image;

private Accommodation(
Copy link
Contributor

@Programmer-may Programmer-may Jan 3, 2024

Choose a reason for hiding this comment

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

이 사이에 숙박 옵션과 룸 리스트를 갖는게 없습니다 규철님!!
`@OneToOne(
fetch = FetchType.LAZY, mappedBy = "accommodation",
cascade = CascadeType.PERSIST, orphanRemoval = true
)
private AccommodationOption accommodationOption;

@OneToMany(
    fetch = FetchType.LAZY, mappedBy = "accommodation",
    cascade = CascadeType.PERSIST, orphanRemoval = true
)
private final List<Room> rooms = new ArrayList<>();`

다음 코드가 들어가야할 것 같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아직 숙박 옵션이 정해지지 않아서 Entity로 설계를 안해놓았고, 숙소에서 룸 리스트를 가지는 연관관계가 필요 없다고 생각해서 만들지 않았습니다.

  • 숙박 옵션이 정해지면, 숙박 옵션 Entity를 설계해서 수정하려고 합니다.
  • 숙소에서 룸 리스트를 가지는 연관관계가 꼭 필요할지 의문입니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

전 영속성 전이를 사용해서 룸 데이터를 등록할 때 숙박 아이디로 숙박을 찾고 거기에 addRoom 메소드로 숙박에 룸을 넣어두면 나중에 숙박만을 찾아도 룸을 찾게 돼서 좋더라구요! 페치타입은 lazy로 하면 지연호출해서 부를때 가져오기도 하구요!

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.

주현님 혹시 cascade를 ALL이 아닌 PERSIST로만 해놓으신 이유가 있을까요?
ALL로 하면 PERSIST랑 REMOVE도 추가되는데, REMOVE도 있으면 부모가 삭제되면 자식도 삭제되거든요! 숙소가 없는 룸이 없으니깐 ALL로 하는게 더 좋지 않을까요??

@Programmer-may
Copy link
Contributor

간단하게 리뷰 남겨 보았습니다! 수정 되면 Approve 누르겠습니다! 고생하셨습니다

City에서 Region으로 변경
AccommodationOption, RoomOption Entity 구현
숙소 Entity와 룸 Entity사이 연관관계 추가
숙소 옵션, 룸 옵션에 @entity 어노테이션 추가
PaymentType paymentType,
Integer adultCount,
Integer childCount
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

위 필드들에 대한 null 검증 로직이 필요하지 않을까요?

Copy link
Contributor

@deltawing71911 deltawing71911 left a comment

Choose a reason for hiding this comment

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

확인했습니다. 수고하셨습니다.^^

@Hwang-Kyu-Cheol Hwang-Kyu-Cheol merged commit 392ac11 into develop Jan 4, 2024
2 checks passed
@Hwang-Kyu-Cheol Hwang-Kyu-Cheol deleted the feature/5 branch January 5, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants