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

[4기 홍혁준, 신재윤, 박세연] Spring Boot JPA로 게시판 구현 미션 제출합니다. #229

Open
wants to merge 12 commits into
base: 혁준,재윤,세연-mission
Choose a base branch
from

Conversation

Shin-Jae-Yoon
Copy link

👩‍💻 요구사항

공통

  • Spring Data JPA를 사용한다.
  • Datasource는 H2를 사용한다.
  • 엔티티는 회원과 게시글이 있다.
  • 회원과 게시글은 1:N 관계이다.
  • REST-DOCS를 이용해 문서화한다.

회원

  • Id - PK
  • name - 이름
  • age - 나이 혹은 생년월일
  • hobby - 취미
  • created_at - 생성일
  • modified_at - 수정일

게시판

  • Id - PK
  • title - 제목
  • content - 내용
  • member - FK
  • created_at - 생성일
  • modified_at - 수정일
  • created_by - 생성자
  • modified_by - 수정자

📚 API 명세

게시글

  • 게시글 단건 조회
    • HTTP Method : GET
    • URI : “/api/v1/posts/{id}"
    • Request : board_id
    • Response : title, content, created_at, modified_at, created_by, modified_by
  • 게시글 페이징 조회
    • HTTP Method : GET
    • URI : “/api/v1/posts"
    • Request : -
    • Response : List{title, created_at, created_by}
  • 게시글 작성
    • HTTP Method : POST
    • URI : “/api/v1/posts”
    • Request : title, content
      • 제목이 null일 수 없다.
      • 제목이 빈값일 수 없다.
    • Response : created_by
  • 게시글 수정
    • HTTP Method : PUT
    • URI : “/api/v1/posts/{id}”
    • Request : title, content
      • 제목이 null일 수 없다.
      • 제목이 빈값일 수 없다.
    • Response : created_by

✅ PR 포인트 및 궁금한 점

  1. 전체적으로 final을 명시하는 부분에 대해 어떻게 생각하시나요?
  • ex) 생성자 파라미터, 메서드 내의 지역변수 등등
  1. 이번 프로젝트에서 코틀린 컨벤션을 사용했습니다.
  • 생성자 파라미터가 2개 이상일 때
  1. 생성자 대신 정적 팩토리 메서드를 사용했습니다.
  • 이런 부분에서, 해당 private 생성자에서 @Builder 애노테이션을 붙이는 부분에 대하여 궁금합니다.

위 3가지 질문에 대한 예시 코드는 아래와 같습니다.

@Builder
    private Board(
            final String title,
            final String content,
            final Member member
    ) {
        super(member.getName(), null);
        this.title = title;
        this.content = content;
        this.member = member;
    }

  1. 단위 테스트를 할 수 있는 방법 중 가장 권장되는 방법이 구체적으로 궁금합니다.

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

Successfully merging this pull request may close these issues.

None yet

3 participants