-
Notifications
You must be signed in to change notification settings - Fork 0
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/LS-20: 회고 템플릿 조회 API #32
Conversation
…into feat/LS-20
…into feat/LS-20
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.
고생하셨씁니다 ~ !! Q클래스 관련 카톡으로 질문남겼습니다 !!
public interface TemplateQuestionRepository extends JpaRepository<TemplateQuestion, Long> { | ||
List<TemplateQuestion> findByTemplateId(Long templateId); | ||
} |
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.
기능적으로는 문제 없지만 findAllBy~
로 하는건 어떠신가요??
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.
반영했습니다!
Template template = templateRepository.findById(templateId).orElseThrow(() -> new TemplateException(TemplateExceptionType.TEMPLATE_NOT_FOUND)); | ||
return TemplateSimpleInfoResponse.toResponse(template); |
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.
repo 쪽에 findByIdOrThrow 라는 default 메서드 만들어서 구현하는건 어떻게 생각하시나요?!
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.
또한 단건 조회가 아닌경우 findAll~ 로 하는건 어떠신가요??
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.
첫번째 리뷰에 말씀해주신 방식을 잘 몰라서 찾아봤는데, 이런식의 코드를 의미하시는게 맞으실까요??
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
public interface CustomJpaRepository<T, ID> extends JpaRepository<T, ID> {
default T findByIdOrThrow(ID id) {
return findById(id).orElseThrow(() -> new EntityNotFoundException("Entity with ID " + id + " not found"));
}
}
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.
findByIdOrThrow
로 변경하여 커밋했습니다!
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.
LGTM
📝 PR 타입
📢 변경 사항
아래 4가지 api를 작성했습니다.
❗️To Reviewer
⚙️ 테스트 결과
캡처 사진 순서는 "변경 사항" 부분과 일치합니다!
👉 반영 브랜치