Skip to content

Commit ccfcd53

Browse files
authored
πŸš€ 1단계 - λ ˆκ±°μ‹œ μ½”λ“œ λ¦¬νŒ©ν„°λ§ (#790)
* docs : κΈ°λŠ₯ μš”κ΅¬μ‚¬ν•­ λ¬Έμ„œ μž‘μ„± * docs : λ‚˜μ˜ ν•™μŠ΅ λͺ©ν‘œ, PRμ „ 확인해야할 λͺ©λ‘ μž‘μ„±(ν˜Έμ„±λ‹˜μ΄ μž‘μ„±ν•œ λ‚΄μš©μ— 감λͺ… λ°›μ•„ 저도 κ΄€λ¦¬ν•˜λ €κ³ ν•©λ‹ˆλ‹€.) * refactor : Question 객체에 질문 μ‚­μ œ κΆŒν•œ 체크 λ©”μ„œλ“œ 생성 및 ν…ŒμŠ€νŠΈ μ½”λ“œ μž‘μ„±, Answer 객체에 μ‚­μ œ κΆŒν•œ 체크 λ©”μ„œλ“œ 생성 및 ν…ŒμŠ€νŠΈ μ½”λ“œ μž‘μ„± * refactor : Question 객체의 μΈμŠ€ν„΄μŠ€ λ³€μˆ˜(answer) ν™œμš©ν•΄ 직접 Answer 객체의 validateAnswerOwner λ©”μ„œλ“œ 호좜 * refactor : 질문, λ‹΅λ³€ μ‚­μ œ 둜직 Question 객체둜 이동(Deleted 값을 λ³€κ²½ν•˜λŠ” 둜직이 ν¬ν•¨λ˜μ–΄ μžˆμ–΄μ„œ μ–΄λ–»κ²Œ μ²˜λ¦¬ν•˜λ©΄ 쒋을지 고민쀑) 및 ν…ŒμŠ€νŠΈ μ½”λ“œ μž‘μ„± * refactor : Question 클래슀의 List<Answer> λ³€μˆ˜ 포μž₯ * docs : ν—·κ°ˆλ¦¬λŠ” λ‚΄μš© Todo μΆ”κ°€ * refactor : κ³΅λ™μœΌλ‘œ μ‚¬μš©λ˜λŠ” createdDate, updatedDate, deltedλ₯Ό BaseModel둜 뢄리 * refactor : title, contents 객체 포μž₯ * refactor : delete() λ©”μ„œλ“œ νŒŒλΌλ―Έν„° 제거 및 ν…ŒμŠ€νŠΈ μ½”λ“œ μˆ˜μ • * refactor : κ²€μ¦ν•˜λŠ” 둜직과 μƒνƒœ λ³€κ²½ν•˜λŠ” λ‘œμ§μ„ ν•¨κ»˜ κ΅¬ν˜„, μƒνƒœλ₯Ό λ³€κ²½ν•˜λŠ” λ©”μ„œλ“œμ™€ μ‚­μ œ 내역을 λ‚¨κΈ°λŠ” historyλ₯Ό 뢄리 * feat : Answers ν…ŒμŠ€νŠΈ μ½”λ“œ 생성 refactor : answer ν…ŒμŠ€νŠΈ μ½”λ“œ μΆ”κ°€, Question ν…ŒμŠ€νŠΈ μ½”λ“œ λ‚΄λΆ€ μˆ˜μ • * refactor : updateDeleted() λ©”μ„œλ“œ private으둜 λ³€κ²½, ν˜ΈμΆœν•˜λŠ” μœ„μΉ˜ λ³€κ²½ 및 ν…ŒμŠ€νŠΈ μ½”λ“œ μˆ˜μ • * refactor : BaseModel 클래슀의 μΈμŠ€ν„΄μŠ€ λ³€μˆ˜ private둜 λ³€κ²½, ν•„μš”ν•œ λ©”μ„œλ“œ protected둜 μ„ μ–Έ νŒ¨ν‚€μ§€ λ‚΄μ—μ„œ μ‚¬μš© κ°€λŠ₯ν•˜λ„λ‘ 생성 * refactor : BaseModel 클래슀λͺ… λ³€κ²½ ## AI의 μΆ”μ²œμ„ λ°›μ•„ μ ν•©ν•œ 이름을 μ„ νƒν–ˆμŠ΅λ‹ˆλ‹€. ### μΆ”μ²œ 클래슀λͺ… 1. DeletableModel 2. SoftDeletableModel 3. AuditableModel ν•΄λ‹Ή ν΄λž˜μŠ€λŠ” soft delete 정책을 λ”°λ₯΄κΈ° λ•Œλ¬Έμ— 2번의 SoftDeletableModel둜 선택 * refactor : Title, Contents 클래슀 제거 ν›„ 곡용으둜 μ‚¬μš©ν•  QuestionBody 클래슀 생성
1 parent de587b9 commit ccfcd53

File tree

12 files changed

+251
-74
lines changed

12 files changed

+251
-74
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# ν•™μŠ΅ 관리 μ‹œμŠ€ν…œ(Learning Management System)
2+
3+
## 단계별 λ¬Έμ„œ
4+
- [πŸš€ 1단계 - λ ˆκ±°μ‹œ μ½”λ“œ λ¦¬νŒ©ν„°λ§](./docs/01-refactoring.md)
5+
26
## μ§„ν–‰ 방법
37
* ν•™μŠ΅ 관리 μ‹œμŠ€ν…œμ˜ μˆ˜κ°•μ‹ μ²­ μš”κ΅¬μ‚¬ν•­μ„ νŒŒμ•…ν•œλ‹€.
48
* μš”κ΅¬μ‚¬ν•­μ— λŒ€ν•œ κ΅¬ν˜„μ„ μ™„λ£Œν•œ ν›„ μžμ‹ μ˜ github 아이디에 ν•΄λ‹Ήν•˜λŠ” λΈŒλžœμΉ˜μ— Pull Request(μ΄ν•˜ PR)λ₯Ό 톡해 μ½”λ“œ 리뷰 μš”μ²­μ„ ν•œλ‹€.

β€Ždocs/01-refactoring.mdβ€Ž

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# πŸš€ 1단계 - λ ˆκ±°μ‹œ μ½”λ“œ λ¦¬νŒ©ν„°λ§
2+
***
3+
4+
## μ½”λ“œ 리뷰
5+
> PR 링크 : [#790](https://github.com/next-step/java-lms/pull/790)
6+
7+
## λ‚˜μ˜ ν•™μŠ΅ λͺ©ν‘œ
8+
9+
### 1. TDD 사이클을 μ˜μ‹ν•˜λ©° κΈ°λŠ₯을 κ΅¬ν˜„ν•œλ‹€.
10+
- `μ‹€νŒ¨ β†’ 성곡 β†’ λ¦¬νŒ©ν„°λ§` κ³Όμ •μœΌλ‘œ μž‘μ—…ν•œλ‹€.
11+
- μŠ΅κ΄€μ²˜λŸΌ 이 과정을 μ§€λ‚˜μΉ˜λ©΄, λ‹€μ‹œ λŒμ•„μ™€ 사이클을 λ°˜λ³΅ν•œλ‹€.
12+
- TDD 사이클 μŠ΅κ΄€μ„ λ§Œλ“€μž.
13+
14+
### 2. 도메인에 νŠΉν™”λœ 이름을 μ§“λŠ”λ‹€.
15+
- AIμ—κ²Œ μΆ”μ²œ λ°›λŠ” μŠ΅κ΄€μ„ λ§Œλ“€μž.
16+
17+
### 3. 반볡된 ν”Όλ“œλ°±μ€ ν”Όν•˜μž.
18+
- 같은 ν”Όλ“œλ°±μ„ λ°˜λ³΅ν•˜μ§€ μ•Šλ„λ‘, 체크리슀트λ₯Ό λ§Œλ“€μ–΄ μ κ²€ν•˜μž.
19+
20+
## 질문 μ‚­μ œν•˜κΈ° μš”κ΅¬μ‚¬ν•­
21+
22+
- [x] 질문 데이터λ₯Ό μ™„μ „νžˆ μ‚­μ œν•˜λŠ” 것이 μ•„λ‹ˆλΌ λ°μ΄ν„°μ˜ μƒνƒœλ₯Ό μ‚­μ œ μƒνƒœ(deleted - boolean type)둜 λ³€κ²½ν•œλ‹€.
23+
- [x] 둜그인 μ‚¬μš©μžμ™€ μ§ˆλ¬Έν•œ μ‚¬λžŒμ΄ 같은 경우 μ‚­μ œ κ°€λŠ₯ν•˜λ‹€.
24+
- [x] 닡변이 μ—†λŠ” 경우 μ‚­μ œκ°€ κ°€λŠ₯ν•˜λ‹€.
25+
- [x] μ§ˆλ¬Έμžμ™€ λ‹΅λ³€ κΈ€μ˜ λͺ¨λ“  λ‹΅λ³€μžκ°€ 같은 경우 μ‚­μ œκ°€ κ°€λŠ₯ν•˜λ‹€.
26+
- [x] μ§ˆλ¬Έμ„ μ‚­μ œν•  λ•Œ λ‹΅λ³€ λ˜ν•œ μ‚­μ œν•΄μ•Ό ν•˜λ©°, λ‹΅λ³€μ˜ μ‚­μ œ λ˜ν•œ μ‚­μ œ μƒνƒœ(deleted)λ₯Ό λ³€κ²½ν•œλ‹€.
27+
- [x] μ§ˆλ¬Έμžμ™€ λ‹΅λ³€μžκ°€ λ‹€λ₯Έ 경우 닡변을 μ‚­μ œν•  수 μ—†λ‹€.
28+
- [x] 질문과 λ‹΅λ³€ μ‚­μ œ 이λ ₯에 λŒ€ν•œ 정보λ₯Ό DeleteHistoryλ₯Ό ν™œμš©ν•΄ 남긴닀.
29+
30+
## λ¦¬νŒ©ν„°λ§ μš”κ΅¬μ‚¬ν•­
31+
32+
- [x] nextstep.qna.service.QnaService의 deleteQuestion()λŠ” μ•žμ˜ 질문 μ‚­μ œ κΈ°λŠ₯을 κ΅¬ν˜„ν•œ μ½”λ“œμ΄λ‹€.
33+
이 λ©”μ†Œλ“œλŠ” λ‹¨μœ„ ν…ŒμŠ€νŠΈν•˜κΈ° μ–΄λ €μš΄ μ½”λ“œμ™€ λ‹¨μœ„ ν…ŒμŠ€νŠΈ κ°€λŠ₯ν•œ μ½”λ“œκ°€ μ„žμ—¬ μžˆλ‹€.
34+
- [x] QnaService의 deleteQuestion() λ©”μ„œλ“œμ— λ‹¨μœ„ ν…ŒμŠ€νŠΈ κ°€λŠ₯ν•œ μ½”λ“œ(핡심 λΉ„μ§€λ‹ˆμŠ€ 둜직)λ₯Ό 도메인 λͺ¨λΈ 객체에 κ΅¬ν˜„ν•œλ‹€.
35+
- [x] QnaService의 λΉ„μ§€λ‹ˆμŠ€ λ‘œμ§μ„ 도메인 λͺ¨λΈλ‘œ μ΄λ™ν•˜λŠ” λ¦¬νŒ©ν„°λ§μ„ μ§„ν–‰ν•  λ•Œ TDD둜 κ΅¬ν˜„ν•œλ‹€.
36+
- [x] QnaService의 deleteQuestion() λ©”μ„œλ“œμ— λŒ€ν•œ λ‹¨μœ„ ν…ŒμŠ€νŠΈλŠ” src/test/java 폴더 nextstep.qna.service.QnaServiceTest이닀.
37+
도메인 λͺ¨λΈλ‘œ λ‘œμ§μ„ μ΄λ™ν•œ 후에도 QnaServiceTest의 λͺ¨λ“  ν…ŒμŠ€νŠΈλŠ” 톡과해야 ν•œλ‹€.

β€Ždocs/check-list.mdβ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# βœ”οΈ PR μ „ 확인해야될 λͺ©λ‘
2+
***
3+
4+
- 객체지ν–₯ μƒν™œμ²΄μ‘° 원칙을 μ€€μˆ˜ν•˜μ˜€λŠ”κ°€ ?
5+
- TDD μ‚¬μ΄ν΄λ‘œ κ΅¬ν˜„ν•˜μ˜€λŠ”κ°€ ?
6+
- TDD 사이클 λ‹¨μœ„λ‘œ μ»€λ°‹ν•˜μ˜€λŠ”κ°€ ?
7+
- κ°μ²΄μ—κ²Œ μƒνƒœλ₯Ό λ…ΈμΆœμ‹œν‚€μ§€ μ•Šκ³  μ±…μž„μ„ λ§‘κ²ΌλŠ”κ°€ ?
8+
- ν…ŒμŠ½μœΌλŠ” 객체의 μ±…μž„κ³Ό 결과만 κ²€μ¦ν–ˆλŠ”κ°€ ?
9+
- λΆˆλ³€μ„±μ„ μ΅œλŒ€ν•œ μœ μ§€ν–ˆλŠ”κ°€ ?
10+
- 도메인 μš©μ–΄λ‘œ 넀이밍 ν–ˆλŠ”κ°€ ?
11+
- ν˜‘λ ₯ ꡬ쑰가 μžμ—°μŠ€λŸ½κ²Œ μ½νžˆλŠ”κ°€ ?
12+
- 같은 ν”Όλ“œλ°±μ„ λ°˜λ³΅ν•˜μ§€λŠ” μ•Šμ•˜λŠ”κ°€ ?

β€Žsrc/main/java/nextstep/qna/domain/Answer.javaβ€Ž

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
11
package nextstep.qna.domain;
22

3+
import nextstep.qna.CannotDeleteException;
34
import nextstep.qna.NotFoundException;
45
import nextstep.qna.UnAuthorizedException;
56
import nextstep.users.domain.NsUser;
67

7-
import java.time.LocalDateTime;
8-
9-
public class Answer {
8+
public class Answer extends SoftDeletableModel {
109
private Long id;
1110

1211
private NsUser writer;
1312

1413
private Question question;
1514

16-
private String contents;
17-
18-
private boolean deleted = false;
19-
20-
private LocalDateTime createdDate = LocalDateTime.now();
21-
22-
private LocalDateTime updatedDate;
15+
private QuestionBody contents;
2316

2417
public Answer() {
2518
}
2619

2720
public Answer(NsUser writer, Question question, String contents) {
28-
this(null, writer, question, contents);
21+
this(null, writer, question, new QuestionBody(contents));
2922
}
3023

3124
public Answer(Long id, NsUser writer, Question question, String contents) {
25+
this(id, writer, question, new QuestionBody(contents));
26+
}
27+
28+
public Answer(Long id, NsUser writer, Question question, QuestionBody contents) {
3229
this.id = id;
33-
if(writer == null) {
30+
if (writer == null) {
3431
throw new UnAuthorizedException();
3532
}
3633

37-
if(question == null) {
34+
if (question == null) {
3835
throw new NotFoundException();
3936
}
4037

@@ -47,13 +44,12 @@ public Long getId() {
4744
return id;
4845
}
4946

50-
public Answer setDeleted(boolean deleted) {
51-
this.deleted = deleted;
52-
return this;
47+
private void updateDeleted() {
48+
deleted();
5349
}
5450

5551
public boolean isDeleted() {
56-
return deleted;
52+
return getDeleted();
5753
}
5854

5955
public boolean isOwner(NsUser writer) {
@@ -64,14 +60,18 @@ public NsUser getWriter() {
6460
return writer;
6561
}
6662

67-
public String getContents() {
68-
return contents;
69-
}
7063

7164
public void toQuestion(Question question) {
7265
this.question = question;
7366
}
7467

68+
public void validateAnswerOwner(NsUser loginUser) throws CannotDeleteException {
69+
if (!this.isOwner(loginUser)) {
70+
throw new CannotDeleteException("λ‹€λ₯Έ μ‚¬λžŒμ΄ μ“΄ 닡변이 μžˆμ–΄ μ‚­μ œν•  수 μ—†μŠ΅λ‹ˆλ‹€.");
71+
}
72+
updateDeleted();
73+
}
74+
7575
@Override
7676
public String toString() {
7777
return "Answer [id=" + getId() + ", writer=" + writer + ", contents=" + contents + "]";
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package nextstep.qna.domain;
2+
3+
import nextstep.qna.CannotDeleteException;
4+
import nextstep.users.domain.NsUser;
5+
6+
import java.time.LocalDateTime;
7+
import java.util.ArrayList;
8+
import java.util.List;
9+
10+
public class Answers {
11+
12+
private List<Answer> answers = new ArrayList<>();
13+
14+
public void add(Answer answer) {
15+
this.answers.add(answer);
16+
}
17+
18+
public List<Answer> getAnswers() {
19+
return answers;
20+
}
21+
22+
public void validateAnswerOwner(NsUser loginUser) throws CannotDeleteException {
23+
for (Answer answer : this.answers) {
24+
answer.validateAnswerOwner(loginUser);
25+
26+
}
27+
}
28+
29+
public List<DeleteHistory> addDeleteAnswerHistory() {
30+
List<DeleteHistory> deleteHistories = new ArrayList<>();
31+
for (Answer answer : this.answers) {
32+
deleteHistories.add(new DeleteHistory(ContentType.ANSWER, answer.getId(), answer.getWriter(), LocalDateTime.now()));
33+
}
34+
return deleteHistories;
35+
}
36+
}
Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
package nextstep.qna.domain;
22

3+
import nextstep.qna.CannotDeleteException;
34
import nextstep.users.domain.NsUser;
45

56
import java.time.LocalDateTime;
67
import java.util.ArrayList;
78
import java.util.List;
89

9-
public class Question {
10+
public class Question extends SoftDeletableModel {
1011
private Long id;
1112

12-
private String title;
13+
private QuestionBody title;
1314

14-
private String contents;
15+
private QuestionBody contents;
1516

1617
private NsUser writer;
1718

18-
private List<Answer> answers = new ArrayList<>();
19-
20-
private boolean deleted = false;
21-
22-
private LocalDateTime createdDate = LocalDateTime.now();
23-
24-
private LocalDateTime updatedDate;
19+
private Answers answers = new Answers();
2520

2621
public Question() {
2722
}
@@ -31,6 +26,10 @@ public Question(NsUser writer, String title, String contents) {
3126
}
3227

3328
public Question(Long id, NsUser writer, String title, String contents) {
29+
this(id, writer, new QuestionBody(title), new QuestionBody(contents));
30+
}
31+
32+
public Question(Long id, NsUser writer, QuestionBody title, QuestionBody contents) {
3433
this.id = id;
3534
this.writer = writer;
3635
this.title = title;
@@ -41,52 +40,56 @@ public Long getId() {
4140
return id;
4241
}
4342

44-
public String getTitle() {
45-
return title;
43+
public NsUser getWriter() {
44+
return writer;
4645
}
4746

48-
public Question setTitle(String title) {
49-
this.title = title;
50-
return this;
47+
public void addAnswer(Answer answer) {
48+
answer.toQuestion(this);
49+
this.answers.add(answer);
5150
}
5251

53-
public String getContents() {
54-
return contents;
52+
public boolean isOwner(NsUser loginUser) {
53+
return writer.equals(loginUser);
5554
}
5655

57-
public Question setContents(String contents) {
58-
this.contents = contents;
59-
return this;
56+
public boolean isDeleted() {
57+
return getDeleted();
6058
}
6159

62-
public NsUser getWriter() {
63-
return writer;
60+
private void validateOwner(NsUser loginUser) throws CannotDeleteException {
61+
if (!this.isOwner(loginUser)) {
62+
throw new CannotDeleteException("μ§ˆλ¬Έμ„ μ‚­μ œν•  κΆŒν•œμ΄ μ—†μŠ΅λ‹ˆλ‹€.");
63+
}
64+
updateDeleted();
6465
}
6566

66-
public void addAnswer(Answer answer) {
67-
answer.toQuestion(this);
68-
answers.add(answer);
67+
public void delete(NsUser loginUser) throws CannotDeleteException {
68+
validateOwner(loginUser);
69+
answers.validateAnswerOwner(loginUser);
6970
}
7071

71-
public boolean isOwner(NsUser loginUser) {
72-
return writer.equals(loginUser);
73-
}
72+
public List<DeleteHistory> toDeleteHistories(){
73+
List<DeleteHistory> deleteHistories = new ArrayList<>();
74+
deleteHistories.add(new DeleteHistory(ContentType.QUESTION, this.id, this.writer, LocalDateTime.now()));
7475

75-
public Question setDeleted(boolean deleted) {
76-
this.deleted = deleted;
77-
return this;
76+
List<DeleteHistory> answerDeleteHistories = addDeleteAnswerHistory();
77+
deleteHistories.addAll(answerDeleteHistories);
78+
79+
return deleteHistories;
7880
}
7981

80-
public boolean isDeleted() {
81-
return deleted;
82+
private List<DeleteHistory> addDeleteAnswerHistory() {
83+
return this.answers.addDeleteAnswerHistory();
8284
}
8385

84-
public List<Answer> getAnswers() {
85-
return answers;
86+
private void updateDeleted() {
87+
deleted();
8688
}
8789

8890
@Override
8991
public String toString() {
9092
return "Question [id=" + getId() + ", title=" + title + ", contents=" + contents + ", writer=" + writer + "]";
9193
}
94+
9295
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package nextstep.qna.domain;
2+
3+
public class QuestionBody {
4+
5+
private String value;
6+
7+
public QuestionBody(String value) {
8+
this.value = value;
9+
}
10+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package nextstep.qna.domain;
2+
3+
import java.time.LocalDateTime;
4+
5+
public abstract class SoftDeletableModel {
6+
7+
private LocalDateTime createdDate = LocalDateTime.now();
8+
9+
private LocalDateTime updatedDate;
10+
11+
private boolean deleted = false;
12+
13+
protected void deleted(){
14+
this.deleted = true;
15+
}
16+
17+
protected boolean getDeleted() {
18+
return deleted;
19+
}
20+
}

β€Žsrc/main/java/nextstep/qna/service/QnAService.javaβ€Ž

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import org.springframework.transaction.annotation.Transactional;
99

1010
import javax.annotation.Resource;
11-
import java.time.LocalDateTime;
12-
import java.util.ArrayList;
1311
import java.util.List;
1412

1513
@Service("qnaService")
@@ -26,24 +24,9 @@ public class QnAService {
2624
@Transactional
2725
public void deleteQuestion(NsUser loginUser, long questionId) throws CannotDeleteException {
2826
Question question = questionRepository.findById(questionId).orElseThrow(NotFoundException::new);
29-
if (!question.isOwner(loginUser)) {
30-
throw new CannotDeleteException("μ§ˆλ¬Έμ„ μ‚­μ œν•  κΆŒν•œμ΄ μ—†μŠ΅λ‹ˆλ‹€.");
31-
}
27+
question.delete(loginUser);
3228

33-
List<Answer> answers = question.getAnswers();
34-
for (Answer answer : answers) {
35-
if (!answer.isOwner(loginUser)) {
36-
throw new CannotDeleteException("λ‹€λ₯Έ μ‚¬λžŒμ΄ μ“΄ 닡변이 μžˆμ–΄ μ‚­μ œν•  수 μ—†μŠ΅λ‹ˆλ‹€.");
37-
}
38-
}
39-
40-
List<DeleteHistory> deleteHistories = new ArrayList<>();
41-
question.setDeleted(true);
42-
deleteHistories.add(new DeleteHistory(ContentType.QUESTION, questionId, question.getWriter(), LocalDateTime.now()));
43-
for (Answer answer : answers) {
44-
answer.setDeleted(true);
45-
deleteHistories.add(new DeleteHistory(ContentType.ANSWER, answer.getId(), answer.getWriter(), LocalDateTime.now()));
46-
}
29+
List<DeleteHistory> deleteHistories = question.toDeleteHistories();
4730
deleteHistoryService.saveAll(deleteHistories);
4831
}
4932
}

0 commit comments

Comments
Β (0)