Skip to content
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

Merged
merged 18 commits into from
Jul 14, 2024
Merged

feat/LS-20: 회고 템플릿 조회 API #32

merged 18 commits into from
Jul 14, 2024

Conversation

clean2001
Copy link
Collaborator

📝 PR 타입

  • 기능 추가
  • 기능 수정
  • 기능 삭제
  • 리팩토링
  • docs 작업, swagger 작업
  • 의존성, 환경 변수, 빌드 관련 코드 업데이트

📢 변경 사항

아래 4가지 api를 작성했습니다.

  • 템플릿 간단 정보 단건 조회
image
  • 템플릿 상세 정보 단건 조회
image
  • 템플릿 [간단 정보 + 모든 질문] 단건 조회 => 해당 템플릿을 베이스로 선택했을 때 필요
  • 모든 템플릿 간단 정보 조회
image

❗️To Reviewer

⚙️ 테스트 결과

캡처 사진 순서는 "변경 사항" 부분과 일치합니다!

image image image image

👉 반영 브랜치

@clean2001 clean2001 self-assigned this Jul 14, 2024
@clean2001 clean2001 added the 🚀 feature 새로운 기능 개발 label Jul 14, 2024
Copy link
Collaborator

@mikekks mikekks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨씁니다 ~ !! Q클래스 관련 카톡으로 질문남겼습니다 !!

Comment on lines 11 to 13
public interface TemplateQuestionRepository extends JpaRepository<TemplateQuestion, Long> {
List<TemplateQuestion> findByTemplateId(Long templateId);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기능적으로는 문제 없지만 findAllBy~로 하는건 어떠신가요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반영했습니다!

Comment on lines 27 to 28
Template template = templateRepository.findById(templateId).orElseThrow(() -> new TemplateException(TemplateExceptionType.TEMPLATE_NOT_FOUND));
return TemplateSimpleInfoResponse.toResponse(template);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repo 쪽에 findByIdOrThrow 라는 default 메서드 만들어서 구현하는건 어떻게 생각하시나요?!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

또한 단건 조회가 아닌경우 findAll~ 로 하는건 어떠신가요??

Copy link
Collaborator Author

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"));
    }
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findByIdOrThrow로 변경하여 커밋했습니다!

Copy link
Collaborator

@raymondanythings raymondanythings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clean2001 clean2001 merged commit f9a29a4 into develop Jul 14, 2024
@mikekks mikekks deleted the feat/LS-20 branch July 14, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 feature 새로운 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants