-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat-be: 평가 테이블에 평가자 이름 필드 추가 및 API 변경 #958
Open
github-actions
wants to merge
3
commits into
be/develop
Choose a base branch
from
957-be-EVAL_NAME_01
base: be/develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
public record EvaluationResponse( | ||
long evaluationId, | ||
|
||
String evaluator, | ||
|
||
int score, | ||
|
||
String content, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ public class Evaluation extends BaseEntity implements SecureResource { | |
@Column(name = "evaluation_id") | ||
private Long id; | ||
|
||
private String evaluator; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. toString 재정의가 필요해보입니다! |
||
|
||
private Integer score; | ||
|
||
private String content; | ||
|
@@ -45,8 +47,9 @@ public class Evaluation extends BaseEntity implements SecureResource { | |
@JoinColumn(name = "applicant_id") | ||
private Applicant applicant; | ||
|
||
public Evaluation(int score, String content, Process process, Applicant applicant) { | ||
public Evaluation(String evaluator, int score, String content, Process process, Applicant applicant) { | ||
validateScore(score); | ||
this.evaluator = evaluator; | ||
this.score = score; | ||
this.content = content; | ||
this.process = process; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -26,7 +26,13 @@ public Evaluation findById(Long evaluationId) { | |||||||||
|
||||||||||
@Transactional | ||||||||||
public void create(EvaluationCreateRequest request, Process process, Applicant applicant) { | ||||||||||
evaluationRepository.save(new Evaluation(request.score(), request.content(), process, applicant)); | ||||||||||
evaluationRepository.save(new Evaluation( | ||||||||||
request.evaluator(), | ||||||||||
request.score(), | ||||||||||
request.content(), | ||||||||||
process, | ||||||||||
applicant | ||||||||||
)); | ||||||||||
} | ||||||||||
|
||||||||||
public List<Evaluation> findAllByProcessAndApplicant(Process process, Applicant applicant) { | ||||||||||
|
@@ -39,6 +45,7 @@ public void update(EvaluationUpdateRequest request, Evaluation evaluation) { | |||||||||
evaluationRepository.save( | ||||||||||
new Evaluation( | ||||||||||
evaluation.getId(), | ||||||||||
request.evaluator(), | ||||||||||
request.score(), | ||||||||||
request.content(), | ||||||||||
evaluation.getProcess(), | ||||||||||
|
@@ -49,7 +56,11 @@ public void update(EvaluationUpdateRequest request, Evaluation evaluation) { | |||||||||
} | ||||||||||
|
||||||||||
private boolean changeExists(EvaluationUpdateRequest request, Evaluation evaluation) { | ||||||||||
return !(evaluation.getContent().equals(request.content()) && evaluation.getScore().equals(request.score())); | ||||||||||
return !( | ||||||||||
evaluation.getContent().equals(request.content()) | ||||||||||
&& evaluation.getScore().equals(request.score()) | ||||||||||
&& evaluation.getEvaluator().equals(request.evaluator()) | ||||||||||
Comment on lines
+60
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 도메인 검증 로직으로 빼는건 어떤가요?
Suggested change
|
||||||||||
); | ||||||||||
} | ||||||||||
|
||||||||||
@Transactional | ||||||||||
|
2 changes: 2 additions & 0 deletions
2
backend/src/main/resources/db/migration/V2_2__add_evaluation_evaluator.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE evaluation | ||
ADD evaluator VARCHAR(255); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
매번 개행 때문에 변경되서 거슬리는군요. 다음에 이를 static 파일로 뺄 궁리를 해봐야겠네요.