-
Notifications
You must be signed in to change notification settings - Fork 1
prod #386
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
prod #386
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @chominju02, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 사용자가 시험 시간표를 PDF 파일로 조회하고 다운로드할 수 있는 새로운 기능을 도입합니다. 핵심적으로 백엔드 서비스, Apache PDFBox를 활용한 PDF 생성 로직, 그리고 관련 시험 및 사용자 정보를 가져오기 위한 새로운 데이터베이스 쿼리가 포함됩니다. 또한, 특정 과목명의 표시 방식을 개선하고 기존 크론 잡의 실행 스케줄을 조정했습니다. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
이 PR은 시간표를 PDF 파일로 생성하는 새로운 기능을 도입합니다. 구현에는 새로운 서비스, 컨트롤러, PDF 생성 프로세서가 포함되어 있습니다. 전반적으로 변경 사항은 좋아 보이지만, 주로 코드 중복, JPQL 쿼리 명확성, 예외 처리와 관련하여 몇 가지 개선할 점이 있습니다. 이러한 점에 대해 구체적인 의견을 남겼습니다.
| List<String> subjects = examSubjectJpaRepository.findByExamApplicationId(examApplicationId) | ||
| .stream() | ||
| .map(ExamSubjectJpaEntity::getSubject) | ||
| .sorted(Comparator.comparingInt(Subject::ordinal)) | ||
| .map(Subject::getSubjectName) | ||
| .map(subject -> { | ||
| if (subject == Subject.SOCIETY_AND_CULTURE) { | ||
| return "사회·문화"; | ||
| } | ||
| return subject.getSubjectName(); | ||
| }) | ||
| .toList(); |
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.
| List<String> subjects = examSubjectJpaRepository.findByExamApplicationId(examApplicationId) | ||
| .stream() | ||
| .map(ExamSubjectJpaEntity::getSubject) | ||
| .sorted(Comparator.comparingInt(Subject::ordinal)) | ||
| .map(Subject::getSubjectName) | ||
| .map(subject -> { | ||
| if (subject == Subject.SOCIETY_AND_CULTURE) { | ||
| return "사회·문화"; | ||
| } | ||
| return subject.getSubjectName(); | ||
| }) | ||
| .toList(); |
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.
| private List<String> getSubjects(Long examApplicationId) { | ||
| return examSubjectJpaRepository.findByExamApplicationId(examApplicationId) | ||
| .stream() | ||
| .map(ExamSubjectJpaEntity::getSubject) | ||
| .sorted(Comparator.comparingInt(Subject::ordinal)) | ||
| .map(subject -> { | ||
| if (subject == Subject.SOCIETY_AND_CULTURE) { | ||
| return "사회·문화"; | ||
| } | ||
| return subject.getSubjectName(); | ||
| }) | ||
| .toList(); | ||
| } |
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.
| } catch (Exception e) { | ||
| throw new RuntimeException("Generate time-table PDF failed", e); | ||
| } |
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.
catch (Exception e)를 사용하여 모든 예외를 잡는 것은 잠재적인 버그를 숨길 수 있습니다. PDFBox 작업에서 주로 발생하는 IOException과 같이 더 구체적인 예외를 처리하는 것이 좋습니다. 이렇게 하면 코드의 안정성이 향상되고 오류의 원인을 더 쉽게 파악할 수 있습니다.
| } catch (Exception e) { | |
| throw new RuntimeException("Generate time-table PDF failed", e); | |
| } | |
| } catch (java.io.IOException e) { | |
| throw new RuntimeException("Generate time-table PDF failed", e); | |
| } |
| } catch (Exception e) { | ||
| throw new RuntimeException("Resource not found: " + classpath, e); | ||
| } |
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.
readAll 메서드에서도 catch (Exception e)를 사용하고 있습니다. 리소스 로딩 시에는 IOException이 발생할 가능성이 높으므로, 이를 명시적으로 처리하는 것이 좋습니다. 예외를 RuntimeException으로 다시 던지더라도, 더 구체적인 예외를 잡는 것이 코드의 의도를 명확하게 합니다.
| } catch (Exception e) { | |
| throw new RuntimeException("Resource not found: " + classpath, e); | |
| } | |
| } catch (java.io.IOException e) { | |
| throw new RuntimeException("Resource not found: " + classpath, e); | |
| } |
| } catch (Exception e) { | ||
| throw new RuntimeException("Failed to draw text", e); | ||
| } |
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.
drawText 메서드에서도 광범위한 Exception을 잡고 있습니다. PDPageContentStream의 텍스트 관련 작업은 IOException을 던질 수 있으므로, 이를 구체적으로 처리하는 것이 좋습니다. 이는 예외 처리의 정밀도를 높여줍니다.
| } catch (Exception e) { | |
| throw new RuntimeException("Failed to draw text", e); | |
| } | |
| } catch (java.io.IOException e) { | |
| throw new RuntimeException("Failed to draw text", e); | |
| } |
| LEFT JOIN PaymentJpaEntity p on p.examApplicationId = ea.id | ||
| LEFT JOIN ExamJpaEntity e on ea.examId = e.id | ||
| LEFT JOIN UserJpaEntity u on ea.userId = u.id | ||
| LEFT JOIN ProfileJpaEntity pr on pr.userId = u.id |
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.
PaymentJpaEntity와 ExamJpaEntity에 대해 LEFT JOIN을 사용하고 있지만, WHERE 절의 p.paymentStatus = 'DONE'과 e.examDate = :examDate 조건 때문에 사실상 INNER JOIN처럼 동작합니다. JOIN으로 명시적으로 변경하면 쿼리의 의도가 더 명확해지고, 데이터베이스 옵티마이저가 더 효율적인 실행 계획을 세우는 데 도움이 될 수 있습니다.
| LEFT JOIN PaymentJpaEntity p on p.examApplicationId = ea.id | |
| LEFT JOIN ExamJpaEntity e on ea.examId = e.id | |
| LEFT JOIN UserJpaEntity u on ea.userId = u.id | |
| LEFT JOIN ProfileJpaEntity pr on pr.userId = u.id | |
| JOIN PaymentJpaEntity p on p.examApplicationId = ea.id | |
| JOIN ExamJpaEntity e on ea.examId = e.id | |
| LEFT JOIN UserJpaEntity u on ea.userId = u.id | |
| LEFT JOIN ProfileJpaEntity pr on pr.userId = u.id |
| public static TimeTableInfoResponse of( | ||
| String examNumber, | ||
| String userName, | ||
| List<String> subjects, | ||
| String schoolName | ||
| ) { | ||
| return new TimeTableInfoResponse( | ||
| examNumber, | ||
| userName, | ||
| subjects, | ||
| schoolName | ||
| ); | ||
| } |
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.
✨ 구현한 기능
📢 논의하고 싶은 내용
🎸 기타