Skip to content

문소현 1주차 과제 #2

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

sohyun022
Copy link
Member

@sohyun022 sohyun022 commented Sep 26, 2024

도서관 데이터베이스 테이블 - 책, 회원

책은 도서관에서 대출받을 수 있는 항목을 나타내며, 회원은 이에 해당하는 책을 대출할 수 있다

스크린샷 2024-09-26 오후 10 35 32

@jjunhub jjunhub self-assigned this Sep 27, 2024
private String author;
private String publisher;
private String isbn;
private char available;
Copy link
Member

@jjunhub jjunhub Oct 1, 2024

Choose a reason for hiding this comment

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

Suggested change
private char available;
private bool available;

우선 char을 다음과 'Y'와 'N'을 표현하기 위해서 디테일한 필드 작성 너무 좋습니다!
이에 대해서 한 가지 코멘트 드릴 것이 있다면..
만약 avaiable의 상태가 Y, N을 제외한 추가적인 상황이 있다면 이는 ENUM의 형태로 처리하는 것이 유지보수면에서 좋을 것 같습니다. 그리고 2가지만으로 분류가 된다면 boolean(MySQL에서는 tinyint)로 처리하는 쪽이 어떨까 생각이 들었습니다.

Comment on lines +23 to +24
@Email
private String email;
Copy link
Member

Choose a reason for hiding this comment

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

유효성 체크 좋네용

private String email;
private String phone;
private LocalDate joinDate;
private Long borrow;
Copy link
Member

Choose a reason for hiding this comment

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

해당 필드는 borrow Table에 대해서 연관 관계를 나타내기 위해서 추가해주신 부분일까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

borrow는 빌린 책이 몇 권인지 나타내는 필드입니다..!

Copy link
Member

Choose a reason for hiding this comment

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

앗! 위에 테이블에 적혀있었군요ㅋㅋ.. 고생하셨습니다!!


Book book1 = bookRepository.findByTitleAndAuthor("모순","양귀자");

System.out.println("Member Id = " + book1.getBookId());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
System.out.println("Member Id = " + book1.getBookId());
Assertions.assertThat(book1).isNotNull();
Assertions.assertThat(book1.getTitle()).isEqualTo("모순");
Assertions.assertThat(book1.getAuthor()).isEqualTo("양귀자");
Assertions.assertThat(book1.getIsbn()).isEqualTo("9788998441012");
Assertions.assertThat(book1.getPublisher()).isEqualTo("쓰다");

종종 직접 값에 대해 print하는 것도 눈으로 확인하고 더욱 확신이 가고 좋습니다.
다만 위처럼 Assertions를 이용하여 값에 대한 검증을 프로그램에게 넘긴다면, 여러 개의 테스트 케이스를 확인하는데 훨씬 편리하다는 점 참고하시면 될 것 같습니다!! 고생하셨습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants