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

[1단계 - 엔티티 매핑] 디투 미션 제출합니다 #61

Open
wants to merge 31 commits into
base: shb03323
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4cf81f7
feat: properties 설정
shb03323 Jul 6, 2023
75a7bad
feat: jpa config
shb03323 Jul 6, 2023
83ae245
feat: createdAt, updatedAt 객체 생성
shb03323 Jul 6, 2023
b120040
feat: 테이블 엔티티 생성
shb03323 Jul 6, 2023
dfdcc30
refactor: 레포지토리 패키지 분리
shb03323 Jul 6, 2023
22ae0f7
refactor: 설정파일을 yml로 변경
shb03323 Jul 6, 2023
becfbb7
test: User update 메서드 테스트 코드 작성
shb03323 Jul 7, 2023
e97691e
test: 질문과 답변에 대한 테스트 코드 작성
shb03323 Jul 7, 2023
6b9960a
refactor: 생성일자, 수정일자 entity 명 변경
shb03323 Jul 11, 2023
a5a37c3
refactor: equals and hashcode 재정의
shb03323 Jul 11, 2023
94b5d1d
refactor: 연관관계 매핑 수정
shb03323 Jul 11, 2023
e63ad95
refactor: application.properties 삭제
shb03323 Jul 11, 2023
e7b59be
test: 사용자 id 조회 테스트 작성
shb03323 Jul 11, 2023
c2322de
test: 삭제되지 않은 질문 조회 테스트 작성
shb03323 Jul 11, 2023
857df74
test: 삭제되지 않은 질문중에서 식별자로 조회 테스트 작성
shb03323 Jul 11, 2023
6aa5168
chore: 테스트 설정 파일에 sql 로깅 추가
shb03323 Jul 11, 2023
ea2793e
refactor: question 엔티티의 작성자를 변경하지 못하도록 설정
shb03323 Jul 11, 2023
112e461
refactor: 엔티티에 필요없는 세터 제거
shb03323 Jul 11, 2023
7f7ca56
test: repository fixture 파일 생성
shb03323 Jul 11, 2023
510c055
test: 삭제되지 않은 답변 중에서 질문을 식별자로 조회하는 테스트 작성
shb03323 Jul 11, 2023
a6f69f4
test: 질문 식별자로 삭제되지 않은 답변 조회 테스트 작성
shb03323 Jul 12, 2023
672844c
refactor: repository 테스트 패키지 구조 변경
shb03323 Jul 12, 2023
3ff066e
feat: Question equals & hashcode 재정의
shb03323 Jul 12, 2023
6a829f3
test: Question 테스트 변수명 수정
shb03323 Jul 12, 2023
fa203a4
test: Answer 엔티티 테스트 사용하지 않는 변수 제거
shb03323 Jul 12, 2023
099dda3
test: 답변의 식별자로 답변을 검색할 때, 삭제된 경우 검색 안되는 테스트 작성
shb03323 Jul 12, 2023
b5af277
test: 레포지터리 Fixture 작성
shb03323 Jul 12, 2023
19a9bea
test: Answer 레포지터리 테스트 Fixture 적용
shb03323 Jul 12, 2023
0b0de7d
refactor: 레포지토리 test 패키지 구조 변경
shb03323 Jul 12, 2023
9b8e2af
refactor: entity 외래키 제약 조건 이름 설정
shb03323 Jul 17, 2023
32ca40f
test: 모든 data jpa test를 RepositoryTestConfig 상속하도록 함
shb03323 Jul 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/qna/domain/Answer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
Expand All @@ -20,10 +21,10 @@ public class Answer extends BaseEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
@JoinColumn(name = "writer_id")
@JoinColumn(name = "writer_id", foreignKey = @ForeignKey(name = "fk_answer_writer"))
private User writer;
@ManyToOne
@JoinColumn(name = "question_id")
@JoinColumn(name = "question_id", foreignKey = @ForeignKey(name = "fk_answer_to_question"))

Choose a reason for hiding this comment

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

외래키 이름을 잘 적용해주셨네요 👍

private Question question;
@Lob
private String contents;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/qna/domain/DeleteHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
Expand All @@ -25,7 +26,7 @@ public class DeleteHistory {
@Column
private Long contentId;
@ManyToOne
@JoinColumn(name = "deleted_by_id")
@JoinColumn(name = "deleted_by_id", foreignKey = @ForeignKey(name = "fk_delete_history_to_user"))
private User deletedBy;
@CreatedDate
private LocalDateTime createDate = LocalDateTime.now();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/qna/domain/Question.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
Expand All @@ -24,7 +25,7 @@ public class Question extends BaseEntity {
@Lob
private String contents;
@ManyToOne
@JoinColumn(name = "writer_id", updatable = false)
@JoinColumn(name = "writer_id", updatable = false, foreignKey = @ForeignKey(name = "fk_question_writer"))
private User writer;
@Column(nullable = false)
private boolean deleted;
Expand Down