-
Notifications
You must be signed in to change notification settings - Fork 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
[BE] refactor: 서비스 리팩터링 #540
Changes from 4 commits
1e6204b
d62a842
de03539
2fc94e1
7561c72
d3842d2
3cfe514
daecbdc
9cc53a9
b60807f
ebc281c
e42293c
357e9ef
bb153e5
646d8b7
20d6ffc
bd4b455
fd2f730
14e1819
76a01c7
08e5707
7e15fa3
8726e0c
cfe4fd9
c351eb2
4ff1bb4
f494164
b0e20bc
0d63f18
d93f943
6363b82
0062fb4
1359b10
8caa2b0
b90aa47
1f18e77
0071013
7022bcb
c280809
d9b4519
caa0716
eca9491
591f8cb
d3a615c
610b785
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package reviewme.review.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import reviewme.review.domain.Review; | ||
import reviewme.review.repository.ReviewRepository; | ||
import reviewme.review.service.dto.request.CreateReviewRequest; | ||
import reviewme.review.service.module.CheckBoxAnswerValidator; | ||
import reviewme.review.service.module.ReviewMapper; | ||
import reviewme.review.service.module.ReviewValidator; | ||
import reviewme.review.service.module.TextAnswerValidator; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ReviewRegisterService { | ||
|
||
private final ReviewMapper reviewMapper; | ||
private final ReviewValidator reviewValidator; | ||
private final TextAnswerValidator textAnswerValidator; | ||
private final CheckBoxAnswerValidator checkBoxAnswerValidator; | ||
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.
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. mapper와 validator의 책임을 완전히 분리해야 된다고 생각합니다. 이 두 로직이 서비스 단에서 나눠져서 보인다면 깊게 접근하지 않아도 변경할 부분을 쉽게 찾을 수 있을 것 같아요😊 |
||
|
||
private final ReviewRepository reviewRepository; | ||
|
||
@Transactional | ||
public long registerReview(CreateReviewRequest request) { | ||
Review review = reviewMapper.mapToReview(request, textAnswerValidator, checkBoxAnswerValidator); | ||
reviewValidator.validate(review); | ||
Review registeredReview = reviewRepository.save(review); | ||
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. 위 코멘트와 같은 맥락으로, 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. 위 코멘트에서 함께 설명드렸습니다! |
||
return registeredReview.getId(); | ||
} | ||
} |
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.
제안)
getAnsweredQuestionIds
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.
반영 완료👍