-
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] feat: 리뷰 폼 응답 재구현 #295
Changes from 1 commit
2ea69e6
c424c06
5abbf92
8d10101
d532c2b
8cdaabe
9039ec8
d6f708f
9c50413
fa0ae42
1811deb
f2edd17
2c93220
bb2245c
040cbea
274d8d3
31999b1
de0c64d
f6c309c
f7b1ec3
207eccc
fef29f6
bc28681
d26b268
3092be1
892c73b
be6b8d5
d5c3b3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package reviewme.template.domain.exception; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import reviewme.global.exception.NotFoundException; | ||
|
||
@Slf4j | ||
public class NoRegisteredTemplatesException extends NotFoundException { | ||
|
||
public NoRegisteredTemplatesException() { | ||
super("서버 내부에서 문제가 발생했어요. 서버에 문의해주세요."); | ||
log.warn("NoRegisteredTemplatesException is occurred"); | ||
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. 템플릿 아이디와 같은 문맥이 필요해요. 로그를 적을 때에는 달랑 이 메시지만 보고 어디에서 발생하는지에 대한 정보가 풍부하면 좋겠습니다 |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package reviewme.template.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import reviewme.review.domain.exception.ReviewGroupNotFoundByRequestReviewCodeException; | ||
import reviewme.reviewgroup.domain.ReviewGroup; | ||
import reviewme.reviewgroup.repository.ReviewGroupRepository; | ||
import reviewme.template.domain.Template; | ||
import reviewme.template.domain.exception.NoRegisteredTemplatesException; | ||
import reviewme.template.dto.response.TemplateResponse; | ||
import reviewme.template.repository.TemplateRepository; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class TemplateService { | ||
|
||
private final ReviewGroupRepository reviewGroupRepository; | ||
private final TemplateRepository templateRepository; | ||
private final TemplateMapper templateMapper; | ||
|
||
@Transactional | ||
public TemplateResponse findDefaultTemplate(String reviewRequestCode) { | ||
ReviewGroup reviewGroup = reviewGroupRepository.findByReviewRequestCode(reviewRequestCode) | ||
.orElseThrow(() -> new ReviewGroupNotFoundByRequestReviewCodeException(reviewRequestCode)); | ||
|
||
Template defaultTemplate = templateRepository.findTopByOrderByIdDesc() | ||
.orElseThrow(NoRegisteredTemplatesException::new); | ||
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. ReviewGroup에 templateId 필드를 두고, 거기로부터 templateId 를 가져와서 조회하는게 좋을 것 같아요! (지금은 templateId 가 review에 있는데 개인적으로 ReviewGroup에 옮겨야 한다고 생각합니다) |
||
|
||
return templateMapper.mapToTemplateResponse(reviewGroup, defaultTemplate); | ||
} | ||
} |
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.
기존 컨트롤러 지우면 프론트엔드가 간극이 있을 수 있으니 버전 업 하는 게 좋을 듯해요.
v2
prefix를 들고가보는 건 어떨까요 /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.
(이미 반영되었네요)