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: 스터디 과제 제출하기 V2 API 구현 #938

Merged
merged 10 commits into from
Feb 27, 2025

Conversation

uwoobeat
Copy link
Member

@uwoobeat uwoobeat commented Feb 26, 2025

🌱 관련 이슈

📌 작업 내용 및 특이사항

  • 채점 로직은 기존과 동일합니다. / 제출 가능 검증 로직이 살짝 바뀌었습니다.
  • Assignment VO가 제거되고, deadline 대신 명시적인 assignmentPeriod가 추가되었습니다. 도메인 서비스 -> 스터디주차 -> 과제 VO 순서로 검증 로직이 drilling 되는 문제를 약간 개선했습니다. 이제는 도메인 서비스 -> 스터디회차까지만 들어갑니다.
  • 또 CANCELED 상태(휴강 개념 제거)가 없어지면서 이에 대한 예외 검증도 없어졌습니다.
  • 서비스 코드의 가독성을 약간 개선했습니다. 직접 비교해보면 꽤 차이가 많이 나는 걸 보실 수 있습니다.

📝 참고사항

📚 기타

Summary by CodeRabbit

  • New Features
    • 학생 과제 제출 기능이 추가되어, 새로운 API 엔드포인트를 통해 과제 제출을 할 수 있습니다.
    • 제출된 과제는 자동 검증 및 채점 과정을 거치며, 제출 기준(최소 내용 길이 등)을 만족하는지 확인합니다.
    • 스터디 회차 조회 및 제출 가능 시간 검증이 강화되어, 보다 명확한 오류 메시지와 안정적인 처리 결과를 제공합니다.

@uwoobeat uwoobeat requested a review from a team as a code owner February 26, 2025 14:10
Copy link

coderabbitai bot commented Feb 26, 2025

Warning

Rate limit exceeded

@uwoobeat has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 58 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f339f85 and 8ed9f0d.

📒 Files selected for processing (2)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/api/StudentAssignmentHistoryControllerV2.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/application/StudentAssignmentHistoryServiceV2.java (1 hunks)
📝 Walkthrough

Walkthrough

이번 PR은 학생 과제 제출 이력을 관리하기 위한 새로운 기능을 추가합니다. 주요 변경사항으로는 HTTP POST를 처리하는 StudentAssginmentHistoryControllerV2 컨트롤러와, 과제 제출 처리 로직을 구현한 StudentAssignmentHistoryServiceV2 서비스가 포함됩니다. 또한, 과제 이력 정보 저장 및 조회를 위한 DAO, 도메인 서비스(과제 평가 및 제출 검증)와 스터디 세션 관련 유효성 검사 로직, 그리고 새로운 오류 코드를 추가하여 전체적인 과제 제출 처리 흐름의 신뢰성을 높였습니다.

Changes

파일(들) 변경 요약
src/main/java/.../studyv2/api/StudentAssginmentHistoryControllerV2.java 새 컨트롤러 추가: /v2/assignment-histories/submit POST 엔드포인트를 통해 과제 제출 요청 처리
src/main/java/.../studyv2/application/StudentAssignmentHistoryServiceV2.java 새 서비스 추가: 과제 제출 로직 처리, 스터디와 멤버 조회, 유효성 검사 및 평가 수행, 제출 이력 저장
src/main/java/.../studyv2/dao/AssignmentHistoryV2Repository.java
src/main/java/.../studyv2/dao/StudyV2CustomRepository.java
src/main/java/.../studyv2/dao/StudyV2RepositoryImpl.java
DAO 및 커스텀 리포지토리 추가/수정: 과제 이력 조회 및 스터디 세션에 따른 조회 기능 구현
src/main/java/.../studyv2/domain/AssignmentHistoryGraderV2.java
src/main/java/.../studyv2/domain/AssignmentHistoryValidatorV2.java
src/main/java/.../studyv2/domain/StudySessionV2.java
src/main/java/.../studyv2/domain/StudyV2.java
도메인 계층 추가: 과제 평가, 제출 가능 여부 검증, 스터디 세션 조회 및 업데이트 관련 메서드 추가
src/main/java/.../global/exception/ErrorCode.java 새로운 오류 코드 추가: STUDY_SESSION_NOT_FOUND (존재하지 않는 스터디 회차 처리)

Sequence Diagram(s)

sequenceDiagram
    participant U as 사용자
    participant C as StudentAssginmentHistoryControllerV2
    participant S as StudentAssignmentHistoryServiceV2
    participant V as AssignmentHistoryValidatorV2
    participant G as AssignmentHistoryGraderV2
    participant R as AssignmentHistoryV2Repository
    participant Repo as StudyV2RepositoryImpl
    participant Util as MemberUtil
    participant GH as GitHubClient

    U->>C: POST /v2/assignment-histories/submit\n(studySessionId)
    C->>S: submitAssignment(studySessionId)
    S->>Util: 현재 사용자 조회
    S->>Repo: findFetchBySessionId(studySessionId)
    S->>V: validateSubmitAvailable(...)
    V-->>S: 유효성 검증 결과
    S->>GH: 과제 제출 데이터 조회
    S->>G: judge(과제 제출 데이터, assignmentHistory)
    G-->>S: 평가 결과 반영
    S->>R: AssignmentHistoryV2 저장
    S->>C: ResponseEntity 반환
    C->>U: HTTP 응답 전송
Loading

Possibly related PRs

Suggested labels

✨ feature

Poem

안녕, 나는 작은 토끼!
코드 숲에 새 꽃이 피었네,
새로운 엔드포인트 뛰어노네,
서비스와 검증이 춤추듯 협력해,
데이터의 길을 따라 즐겁게 달려요 🐰
바람 같은 업데이트, 모두 축복받길!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @uwoobeat, 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!

Summary of Changes

This pull request implements the V2 API for submitting study assignments. It includes a new controller, service, and repository interfaces to handle the submission process. The changes also involve validating the submission, fetching assignment data from GitHub, and grading the submission.

Highlights

  • API Implementation: Implements the /v2/assignment-histories/submit endpoint for submitting study assignments.
  • Service Logic: Adds StudentAssignmentHistoryServiceV2 to handle assignment submission logic, including validation, data fetching, and grading.
  • Data Access: Introduces AssignmentHistoryV2Repository and updates StudyV2Repository to support assignment submission.
  • Validation and Grading: Adds AssignmentHistoryValidatorV2 for submission validation and AssignmentHistoryGraderV2 for grading assignments.

Changelog

Click here to see the changelog
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/api/StudentAssginmentHistoryControllerV2.java
    • Created a new controller StudentAssginmentHistoryControllerV2 to handle the assignment submission endpoint.
    • Added a PostMapping to /submit that takes studySessionId as a request parameter.
    • The endpoint calls studentAssigmentHistoryServiceV2.submitAssignment to process the submission.
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/application/StudentAssignmentHistoryServiceV2.java
    • Created a new service StudentAssignmentHistoryServiceV2 to manage assignment submission logic.
    • The submitAssignment method retrieves the current member, study, and study session.
    • It validates if the student has applied to the study and if the submission is within the allowed time frame.
    • Fetches assignment submission from GitHub using GithubClient.
    • Grades the assignment using AssignmentHistoryGraderV2 and saves the assignment history.
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/AssignmentHistoryV2Repository.java
    • Created a new repository interface AssignmentHistoryV2Repository to manage AssignmentHistoryV2 entities.
    • Added a method findByMemberAndStudySession to find assignment history by member and study session.
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyV2CustomRepository.java
    • Added findFetchBySessionId method to fetch a StudyV2 object by study session ID.
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyV2RepositoryImpl.java
    • Implemented findFetchBySessionId to fetch StudyV2 by session ID using a query that joins StudyV2 and StudySessionV2.
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AssignmentHistoryGraderV2.java
    • Created a new domain service AssignmentHistoryGraderV2 to grade assignment submissions.
    • The judge method fetches the assignment submission and calls judgeAssignmentSubmission.
    • If any exception occurs during fetching, it translates the exception to a SubmissionFailureType and marks the assignment as failed.
    • The judgeAssignmentSubmission method checks if the content length is sufficient and marks the assignment as success or failure accordingly.
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AssignmentHistoryValidatorV2.java
    • Created a new domain service AssignmentHistoryValidatorV2 to validate assignment submissions.
    • The validateSubmitAvailable method checks if the student has applied to the study and if the submission is within the allowed time frame.
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/StudySessionV2.java
    • Added validateAssignmentSubmittable method to validate if the assignment can be submitted based on the current time and assignment period.
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/StudyV2.java
    • Added getOptionalStudySession and getStudySession methods to retrieve study sessions by ID.
    • Modified getStudySession to throw an exception if the study session is not found.
    • Added getStudySessionForUpdate to retrieve study sessions for update operations.
  • src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java
    • Added STUDY_SESSION_NOT_FOUND error code.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and 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 to provide feedback.

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.


Did you know?

The term 'API' was first used in the context of computing in the 1960s, referring to the interfaces between different software components.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request implements the API for submitting study assignments. Overall, the code is well-structured and addresses the intended functionality. However, there are a few areas that could be improved for better clarity and maintainability. I've provided specific feedback in the review comments below.

Summary of Findings

  • Naming Convention: Consider renaming StudentAssginmentHistoryControllerV2 to StudentAssignmentHistoryControllerV2 to correct the typo and improve readability.
  • Exception Handling: Ensure that all potential exceptions are properly handled and logged to provide better insights into application behavior.
  • Code Clarity: Improve code clarity by adding comments to explain complex logic or non-obvious operations.

Assessment

The code introduces a new API endpoint for submitting study assignments, which is a valuable addition to the application. The implementation is generally sound, but I've identified a few areas for improvement, particularly around naming conventions, exception handling, and code clarity. Addressing these comments will enhance the overall quality and maintainability of the code. I recommend that the author address these comments and have others review and approve this code before merging.

Comment on lines +229 to 232
private StudySessionV2 getStudySessionForUpdate(Long studySessionId) {
return getOptionalStudySession(studySessionId)
.orElseThrow(() -> new CustomException(STUDY_NOT_UPDATABLE_SESSION_NOT_FOUND));
}

Choose a reason for hiding this comment

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

medium

The exception message STUDY_NOT_UPDATABLE_SESSION_NOT_FOUND seems more appropriate for a scenario where the session cannot be updated. Consider using STUDY_SESSION_NOT_FOUND for consistency with other parts of the code.

.orElseThrow(() -> new CustomException(STUDY_SESSION_NOT_FOUND));

Copy link

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (5)
src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/AssignmentHistoryV2Repository.java (1)

1-11: Repository 인터페이스가 잘 설계되었습니다.

AssignmentHistoryV2Repository 인터페이스가 Spring Data JPA 규칙을 잘 따르고 있습니다. 회원과 스터디 세션으로 과제 이력을 조회하는 메서드가 명확하게 정의되어 있습니다.

한 가지 고려사항: 향후 확장성을 위해 특정 회원의 모든 과제 이력을 조회하는 메서드나, 특정 스터디 세션의 모든 과제 이력을 조회하는 메서드도 추가하는 것이 좋을 수 있습니다.

src/main/java/com/gdschongik/gdsc/domain/studyv2/application/StudentAssignmentHistoryServiceV2.java (1)

39-44: @Transactional 범위 확인
submitAssignment 메서드 전체가 트랜잭션으로 보호되므로, 조회 및 저장 로직이 보장됩니다. 다만, 매우 긴 로직이나 외부 API를 다루는 경우라면 트랜잭션 범위를 축소하는 방안을 고려해 볼 수도 있습니다.

src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AssignmentHistoryGraderV2.java (3)

20-28: judge 메서드의 예외 처리 범위
CustomException만 처리하고 있어, 예상치 못한 예외가 발생할 경우 로깅 외 조치가 누락될 수 있습니다. 필요하다면 범용 예외 처리도 고려해보세요.


30-42: 과제 내용 길이 최소 기준
과제 검증 로직에서 MINIMUM_ASSIGNMENT_CONTENT_LENGTH(300자)를 사용하고 있는데, 필요 시 향후 요구사항에 따라 설정값으로 분리하여 동적으로 관리해도 좋겠습니다.


44-54: translateException 메서드의 예외 매핑 범위
GITHUB_CONTENT_NOT_FOUND에 국한된 매핑 로직은 명확합니다. 향후 더 많은 예외가 발생할 가능성이 있다면, 해당 예외 코드들을 추가적으로 매핑할 수 있도록 확장성을 고려해보세요.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbf9b5f and f339f85.

📒 Files selected for processing (10)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/api/StudentAssginmentHistoryControllerV2.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/application/StudentAssignmentHistoryServiceV2.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/AssignmentHistoryV2Repository.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyV2CustomRepository.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyV2RepositoryImpl.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AssignmentHistoryGraderV2.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AssignmentHistoryValidatorV2.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/StudySessionV2.java (2 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/StudyV2.java (3 hunks)
  • src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Check Style and Test to Develop
src/main/java/com/gdschongik/gdsc/domain/studyv2/api/StudentAssginmentHistoryControllerV2.java

[error] 25-25: missing return statement

🔇 Additional comments (11)
src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyV2CustomRepository.java (1)

10-10: 이 구현은 좋아 보입니다!

세션 ID로 스터디를 조회하는 메서드가 추가되었습니다. 기존의 findFetchById 메서드와 동일한 패턴을 따르고 있어 일관성이 유지되었습니다.

src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java (1)

108-108: ErrorCode 추가가 적절합니다.

스터디 회차를 찾을 수 없는 경우에 대한 오류 코드가 논리적인 위치에 추가되었습니다. 메시지가 명확하고 기존 오류 코드 스타일과 일치합니다.

src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyV2RepositoryImpl.java (1)

26-34: 구현이 깔끔합니다.

세션 ID로 StudyV2를 조회하는 메서드가 잘 구현되었습니다. fetchJoin을 사용하여 N+1 쿼리 문제를 방지하고 있으며, any() 메서드를 통해 컬렉션 내의
세션 ID를 효과적으로 필터링하고 있습니다.

src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/StudySessionV2.java (1)

113-125: 과제 제출 가능 여부 검증 로직이 잘 구현되었습니다.

validateAssignmentSubmittable 메서드가 과제 제출 기간 관련 검증을 적절하게 수행하고 있습니다. 과제 기간이 설정되어 있는지, 현재 시간이 과제 제출 시작일 이전인지, 그리고 마감일을 지났는지 확인하는 로직이 각각의 에러 코드와 함께 올바르게 구현되었습니다.

src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/StudyV2.java (2)

202-210: 스터디 세션 조회 메서드가 적절히 개선되었습니다.

Optional을 활용한 getOptionalStudySession 메서드와 예외 처리가 포함된 getStudySession 메서드가 추가되어 스터디 세션 조회 로직이 더 명확해졌습니다. 이 방식은 클라이언트 코드에서 다양한 상황에 맞게 활용할 수 있는 유연성을 제공합니다.


229-232: 메서드 이름 변경으로 목적이 명확해졌습니다.

기존 getStudySession 메서드를 getStudySessionForUpdate로 이름을 변경하고 목적에 맞는 예외 메시지를 사용하도록 수정한 것이 좋습니다. 이렇게 하면 업데이트 목적으로 세션을 조회할 때와 일반 조회 시의 차이가 명확해집니다.

src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AssignmentHistoryValidatorV2.java (1)

9-22: 과제 제출 가능 여부에 대한 검증 도메인 서비스가 잘 설계되었습니다.

과제를 제출하기 전 필요한 두 가지 검증(스터디 신청 여부, 과제 제출 기간)을 잘 캡슐화하여 구현했습니다. 도메인 서비스로 분리함으로써 단일 책임 원칙을 잘 준수하고 있습니다.

src/main/java/com/gdschongik/gdsc/domain/studyv2/application/StudentAssignmentHistoryServiceV2.java (4)

31-38: 필드 주입 대신 생성자 주입이 잘 적용되었습니다.
스프링 DI를 위해 @RequiredArgsConstructor를 사용하는 것은 유지보수성과 테스트 용이성 측면에서 적절합니다.


49-52: study.getStudySession 호출 시 세션 미존재 시나리오 명시
studySessionId에 해당하는 세션이 없을 경우 예외가 발생하거나 null이 반환될 가능성에 대한 에러 핸들링을 별도로 두는 것이 안전해 보입니다.


54-57: repositoryLinknull일 때 처리 로직 권장
optionalStudyHistory가 존재하지 않아 repositoryLinknull인 상태로 githubClient.getLatestAssignmentSubmissionFetcher를 호출할 경우 예외가 발생할 여지는 없는지 확인이 필요합니다. 필요하다면 예외 처리를 명시적으로 추가해주세요.


72-76: findOrCreate 메서드 구현
없는 경우에 새 엔티티를 생성하는 방식으로 잘 설계되어 있습니다. 엔티티 생성 시점이 명확하여 도메인 로직의 일관성을 보장합니다.

@RequiredArgsConstructor
public class StudentAssginmentHistoryControllerV2 {

private final StudentAssignmentHistoryServiceV2 studentAssigmentHistoryServiceV2;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

필드 이름 오타를 수정해주세요.

'studentAssigmentHistoryServiceV2'에 오타가 있습니다. 'Assigment'를 'Assignment'로 수정해야 합니다.

-    private final StudentAssignmentHistoryServiceV2 studentAssigmentHistoryServiceV2;
+    private final StudentAssignmentHistoryServiceV2 studentAssignmentHistoryServiceV2;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private final StudentAssignmentHistoryServiceV2 studentAssigmentHistoryServiceV2;
private final StudentAssignmentHistoryServiceV2 studentAssignmentHistoryServiceV2;

@RestController
@RequestMapping("/v2/assignment-histories")
@RequiredArgsConstructor
public class StudentAssginmentHistoryControllerV2 {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

클래스 이름 오타를 수정해주세요.

'StudentAssginmentHistoryControllerV2'에 오타가 있습니다. 'Assginment'를 'Assignment'로 수정해야 합니다.

-public class StudentAssginmentHistoryControllerV2 {
+public class StudentAssignmentHistoryControllerV2 {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public class StudentAssginmentHistoryControllerV2 {
public class StudentAssignmentHistoryControllerV2 {

Comment on lines 23 to 25
public ResponseEntity<Void> submitMyAssignment(@RequestParam(name = "studySessionId") Long studySessionId) {
studentAssigmentHistoryServiceV2.submitAssignment(studySessionId);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

반환값이 누락되었습니다.

submitMyAssignment 메서드는 ResponseEntity를 반환하도록 선언되었지만, 실제 반환 문이 없습니다. 파이프라인 오류의 원인이 되고 있습니다.

    public ResponseEntity<Void> submitMyAssignment(@RequestParam(name = "studySessionId") Long studySessionId) {
        studentAssigmentHistoryServiceV2.submitAssignment(studySessionId);
+        return ResponseEntity.ok().build();
    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public ResponseEntity<Void> submitMyAssignment(@RequestParam(name = "studySessionId") Long studySessionId) {
studentAssigmentHistoryServiceV2.submitAssignment(studySessionId);
}
public ResponseEntity<Void> submitMyAssignment(@RequestParam(name = "studySessionId") Long studySessionId) {
studentAssigmentHistoryServiceV2.submitAssignment(studySessionId);
return ResponseEntity.ok().build();
}
🧰 Tools
🪛 GitHub Actions: Check Style and Test to Develop

[error] 25-25: missing return statement

Copy link

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

Copy link

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

Copy link

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

Copy link
Member

@kckc0608 kckc0608 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@Sangwook02 Sangwook02 left a comment

Choose a reason for hiding this comment

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

lgtm

@uwoobeat uwoobeat merged commit 3c5c595 into develop Feb 27, 2025
2 checks passed
@uwoobeat uwoobeat deleted the feature/912-submit-assignment-v2 branch February 27, 2025 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ 스터디 과제 제출하기 V2 API 구현
3 participants