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: 과제 휴강 처리 API 추가 #542

Merged
merged 11 commits into from
Aug 2, 2024

Conversation

Sangwook02
Copy link
Member

@Sangwook02 Sangwook02 commented Aug 1, 2024

🌱 관련 이슈

📌 작업 내용 및 특이사항

  • 과제 휴강 처리 api를 구현했습니다.
  • FixtureHelper와 IntegrationTest에 Study관련 메서드들을 생성했습니다.

📝 참고사항

📚 기타

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • 새로운 스터디 할당 취소 기능 추가: 사용자가 특정 스터디의 할당을 취소할 수 있습니다.
    • 사용자 친화적인 오류 처리 개선: 할당을 찾을 수 없는 경우에 대한 구체적인 오류 코드 제공.
  • Bug Fixes

    • 할당 상태 업데이트 로직 개선: 할당 취소 시 상태가 올바르게 변경되도록 수정.
  • Tests

    • 새로운 단위 테스트 추가: 스터디 세부 정보의 할당 취소 유효성 검증.
    • 스터디 멘토 서비스의 할당 취소 기능을 검증하는 통합 테스트 도입.

@Sangwook02 Sangwook02 self-assigned this Aug 1, 2024
@Sangwook02 Sangwook02 requested a review from a team as a code owner August 1, 2024 01:45
@Sangwook02 Sangwook02 added the ✨ feature 새로운 기능 추가 및 수정 label Aug 1, 2024
Copy link

coderabbitai bot commented Aug 1, 2024

Walkthrough

이번 변경 사항은 스터디 과제 취소 API의 구현으로, 스터디 멘토 관리 기능을 크게 향상시킵니다. 새로운 PATCH 엔드포인트가 추가되어 과제 취소 요청을 처리하며, StudyMentorService에서 비즈니스 로직을 책임지고, 역할 기반 접근 제어를 강화하여 코드의 구조와 안정성을 개선했습니다.

Changes

파일 경로 변경 요약
src/main/java/com/.../StudyMentorController.java
src/main/java/com/.../StudyMentorService.java
StudyMentorService 클래스에서 /assignments/{studyDetailId}/cancel 엔드포인트를 추가하고 cancelStudyAssignment(Long studyDetailId) 메서드를 구현.
src/main/java/com/.../StudyDetailValidator.java StudyDetailValidator 클래스 추가 및 validateCancelStudyAssignment 메서드 구현.
src/main/java/com/.../ErrorCode.java STUDY_DETAIL_NOT_MODIFIABLE_INVALID_ROLE 에러 코드 추가.
src/test/java/com/.../StudyDetailTest.java
src/test/java/com/.../StudyDetailValidatorTest.java
StudyDetailStudyDetailValidator에 대한 테스트 파일 추가.
src/test/java/com/.../FixtureHelper.java createStudyDetail 메서드 추가, 테스트 유틸리티 확장.

Assessment against linked issues

Objective Addressed Explanation
과제 휴강처리 API 구현 (#537)

🐰 새로운 API에 기쁨을 담아,
스터디 멘토와 함께 뛰어다녀요!
과제 취소, 손쉽게 해결,
코드의 변화, 모두가 행복해!
🥕✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

github-actions bot commented Aug 1, 2024

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 98241bc and 27409b0.

Files selected for processing (10)
  • src/main/java/com/gdschongik/gdsc/domain/study/api/StudyMentorController.java (2 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/study/domain/vo/Assignment.java (2 hunks)
  • src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java (1 hunks)
  • src/test/java/com/gdschongik/gdsc/domain/study/application/StudyMentorServiceTest.java (1 hunks)
  • src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailTest.java (1 hunks)
  • src/test/java/com/gdschongik/gdsc/global/common/constant/StudyConstant.java (1 hunks)
  • src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java (2 hunks)
  • src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java (4 hunks)
Additional comments not posted (17)
src/test/java/com/gdschongik/gdsc/global/common/constant/StudyConstant.java (1)

18-18: LGTM! 새로운 상수 추가

ATTENDANCE_NUMBER 상수 추가는 문제 없습니다.

src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (1)

1-31: LGTM! 예외 처리 및 로깅 확인

cancelStudyAssignment 메서드는 예외 처리가 잘 되어 있으며, 로깅도 적절하게 구현되었습니다.

그러나 예외 처리가 제대로 동작하는지 확인하는 것이 좋습니다.

Verification successful

예외 처리가 적절하게 구현되었습니다.

cancelStudyAssignment 메서드에서 orElseThrow를 사용하여 CustomException을 던지는 부분이 확인되었습니다. 예외 처리가 잘 되어 있으며, 로깅도 적절하게 구현되었습니다.

  • StudyMentorService.java 파일의 cancelStudyAssignment 메서드에서 orElseThrow를 통해 CustomException을 던짐
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify exception handling in `cancelStudyAssignment` method.

# Test: Search for the exception handling. Expect: Proper handling of `CustomException`.
rg --type java 'throw new CustomException' -A 5

Length of output: 42037


Script:

#!/bin/bash
# Description: Verify exception handling in `cancelStudyAssignment` method specifically within StudyMentorService.java.

# Test: Search for the exception handling. Expect: Proper handling of `CustomException`.
rg --type java 'throw new CustomException' -A 5 src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java

Length of output: 132


Script:

#!/bin/bash
# Description: Verify exception handling in `cancelStudyAssignment` method specifically within StudyMentorService.java.

# Test: Search for the usage of `orElseThrow` to confirm exception handling.
rg --type java 'orElseThrow' -A 5 src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java

Length of output: 333

src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailTest.java (1)

1-38: LGTM! 테스트 구현 확인

과제_상태가_휴강이_된다 테스트 메서드는 과제 상태가 CANCELLED로 설정되는 것을 확인합니다. 테스트 구현이 잘 되어 있습니다.

src/main/java/com/gdschongik/gdsc/domain/study/api/StudyMentorController.java (3)

3-3: 필요한 import 문 추가

StudyMentorService를 사용하기 위해 필요한 import 문이 추가되었습니다.


18-18: 필요한 서비스 필드 추가

StudyMentorService 필드가 추가되었습니다. 이는 서비스 로직을 사용하기 위해 필요합니다.


27-32: 스터디 과제 휴강 처리 엔드포인트 추가

스터디 과제를 휴강 처리하는 새로운 PATCH 엔드포인트가 추가되었습니다. 서비스 메서드를 호출하고 204 No Content 응답을 반환합니다.

서비스 메서드 호출이 올바르게 이루어졌는지 확인하십시오.

Verification successful

스터디 과제 휴강 처리 엔드포인트 추가

스터디 과제를 휴강 처리하는 새로운 PATCH 엔드포인트가 추가되었습니다. 서비스 메서드를 호출하고 204 No Content 응답을 반환합니다.

  • StudyMentorService 클래스의 cancelStudyAssignment 메서드가 올바르게 구현되었습니다.
  • StudyDetail 클래스의 cancelAssignment 메서드가 올바르게 구현되었습니다.
  • Assignment 클래스의 cancelAssignment 메서드가 올바르게 구현되었습니다.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the service method `cancelStudyAssignment`.

# Test: Search for the method implementation. Expect: Proper implementation of `cancelStudyAssignment`.
rg --type java -A 5 $'public void cancelStudyAssignment'

Length of output: 832


Script:

#!/bin/bash
# Description: Verify the implementation of the `cancelAssignment` method in the `StudyDetail` class.

# Test: Search for the method implementation. Expect: Proper implementation of `cancelAssignment`.
rg --type java -A 5 $'public void cancelAssignment'

Length of output: 433


Script:

#!/bin/bash
# Description: Verify the implementation of the `cancelAssignment` method in the `Assignment` class.

# Test: Search for the method implementation. Expect: Proper implementation of `cancelAssignment`.
rg --type java -A 5 $'public static Assignment cancelAssignment'

Length of output: 478

src/test/java/com/gdschongik/gdsc/domain/study/application/StudyMentorServiceTest.java (3)

14-14: 통합 테스트 클래스 설정

IntegrationTest를 확장하고 필요한 의존성을 자동 주입하여 통합 테스트 클래스를 올바르게 설정했습니다.


22-22: 중첩 클래스 설정

관련 테스트 케이스를 조직하기 위해 중첩 클래스를 올바르게 설정했습니다.


25-38: 스터디 과제 휴강 처리 테스트 케이스

스터디 과제 휴강 처리가 성공적으로 이루어지는지 확인하는 테스트 케이스입니다. given-when-then 구조와 적절한 단언문이 사용되었습니다.

src/main/java/com/gdschongik/gdsc/domain/study/domain/vo/Assignment.java (3)

3-3: 정적 import 문 추가

StudyStatus 상수를 사용하기 위해 정적 import 문이 추가되었습니다. 이는 코드의 가독성을 높입니다.


51-52: 빈 과제 생성 메서드 업데이트

정적 import를 사용하여 상태가 NONE인 빈 과제를 생성하는 메서드가 업데이트되었습니다.


54-55: 과제 취소 메서드 추가

상태가 CANCELLED인 과제를 생성하는 새로운 메서드가 추가되었습니다.

src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java (1)

73-75: cancelAssignment 메서드의 구현을 검토하세요.

cancelAssignment 메서드는 assignment 속성을 변경합니다. Assignment.cancelAssignment() 메서드가 올바르게 구현되었는지 확인하세요.

Verification successful

cancelAssignment 메서드의 구현을 검토하세요.

Assignment.cancelAssignment() 메서드는 Assignment 객체를 CANCELLED 상태로 설정하여 반환합니다. 이 구현은 올바르게 보이며, cancelAssignment 메서드의 기대 동작과 일치합니다.

  • Assignment.cancelAssignment() 메서드의 구현이 적절합니다.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of the Assignment.cancelAssignment() method.

# Test: Search for the method implementation. Expect: Proper implementation of the method.
rg --type java -A 5 $'public static Assignment cancelAssignment()'

Length of output: 480

src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java (1)

84-89: createStudyDetail 메서드의 구현을 검토하세요.

createStudyDetail 메서드는 제공된 매개변수를 사용하여 StudyDetail 객체를 생성합니다. 매개변수가 올바르게 사용되고 StudyDetail 객체가 제대로 인스턴스화되었는지 확인하세요.

Verification successful

createStudyDetail 메서드의 구현을 검토하세요.

createStudyDetail 메서드는 제공된 매개변수를 사용하여 StudyDetail 객체를 생성합니다. 매개변수가 올바르게 사용되고 StudyDetail 객체가 제대로 인스턴스화되었는지 확인하세요.

  • StudyDetail.createStudyDetail 메서드가 StudyDetail 객체를 빌더 패턴을 사용하여 올바르게 인스턴스화하는지 확인했습니다.
  • FixtureHelper.java에서 StudyDetail.createStudyDetail 메서드에 전달되는 매개변수가 예상되는 매개변수와 일치하는지 확인했습니다.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correct instantiation of the StudyDetail object.

# Test: Search for the method usage. Expect: Proper instantiation of the StudyDetail object.
rg --type java -A 5 $'StudyDetail.createStudyDetail'

Length of output: 3046

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

140-140: ASSIGNMENT_NOT_FOUND 상수의 사용을 검토하세요.

ASSIGNMENT_NOT_FOUND 상수는 ErrorCode 열거형에 추가되었습니다. 코드베이스에서 적절하게 사용되고 있는지 확인하세요.

Verification successful

ASSIGNMENT_NOT_FOUND 상수가 적절하게 사용되고 있습니다.

ASSIGNMENT_NOT_FOUND 상수는 StudyMentorService.java 파일에서 CustomException을 던지는 데 사용되고 있습니다. 이는 상수가 올바르게 사용되고 있음을 나타냅니다.

  • src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java 파일에서 확인됨.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the ASSIGNMENT_NOT_FOUND constant.

# Test: Search for the constant usage. Expect: Proper usage of the constant in the codebase.
rg --type java $'ErrorCode.ASSIGNMENT_NOT_FOUND'

Length of output: 47


Script:

#!/bin/bash
# Description: Reverify the usage of the ASSIGNMENT_NOT_FOUND constant.

# Test: Search for the constant usage. Expect: Proper usage of the constant in the codebase.
rg --type java 'ASSIGNMENT_NOT_FOUND'

Length of output: 331

src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java (2)

191-202: 코드 변경 사항이 올바릅니다.

createStudyDetail 함수는 올바르게 작성되었습니다.

하지만 함수의 모든 매개변수가 올바르게 사용되는지 확인해야 합니다.

Verification successful

코드 변경 사항이 올바릅니다.

createStudyDetail 함수는 여러 파일에서 올바르게 사용되고 있습니다. 모든 매개변수가 적절하게 사용되고 있으며, 함수 호출이 예상된 유형과 값을 일치합니다.

  • src/main/java/com/gdschongik/gdsc/domain/study/factory/StudyDomainFactory.java
  • src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java
  • src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java
  • src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java
  • src/test/java/com/gdschongik/gdsc/domain/study/application/StudyMentorServiceTest.java
  • src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailTest.java
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `createStudyDetail` to ensure all parameters are used correctly.

# Test: Search for the function usage. Expect: All occurrences of the function usage with correct parameters.
rg --type java -A 5 $'createStudyDetail'

Length of output: 4510


175-189: 코드 변경 사항이 올바릅니다.

createStudy 함수는 올바르게 작성되었습니다.

하지만 함수의 모든 매개변수가 올바르게 사용되는지 확인해야 합니다.

Verification successful

코드 변경 사항이 올바릅니다.

createStudy 함수는 올바르게 작성되었으며, 코드베이스에서 모든 매개변수가 올바르게 사용되고 있습니다.

  • src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java
  • src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java
  • src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailTest.java
  • src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyHistoryValidatorTest.java
  • src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyTest.java
  • src/main/java/com/gdschongik/gdsc/domain/study/factory/StudyDomainFactory.java
  • src/main/java/com/gdschongik/gdsc/domain/study/application/AdminStudyService.java
  • src/main/java/com/gdschongik/gdsc/domain/study/api/AdminStudyController.java
  • src/test/java/com/gdschongik/gdsc/domain/study/application/StudyMentorServiceTest.java
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `createStudy` to ensure all parameters are used correctly.

# Test: Search for the function usage. Expect: All occurrences of the function usage with correct parameters.
rg --type java -A 5 $'createStudy'

Length of output: 16585

Copy link

github-actions bot commented Aug 1, 2024

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 27409b0 and c85fc4c.

Files selected for processing (3)
  • src/main/java/com/gdschongik/gdsc/domain/study/api/StudyMentorController.java (2 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • src/main/java/com/gdschongik/gdsc/domain/study/api/StudyMentorController.java
  • src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java
  • src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java

Copy link
Member

@AlmondBreez3 AlmondBreez3 left a comment

Choose a reason for hiding this comment

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

lgtm
상욱님! 보니까 과제 생성이나 그런것들 테스트용으로 다 만드셨던데
이거 머지 되면 가져와서 스터디 과제 생성 테스트 코드 수정하겠습니다~!

Comment on lines 21 to 30
@Transactional
public void cancelStudyAssignment(Long studyDetailId) {
StudyDetail studyDetail = studyDetailRepository
.findById(studyDetailId)
.orElseThrow(() -> new CustomException(STUDY_DETAIL_NOT_FOUND));

studyDetail.cancelAssignment();

log.info("[StudyMentorService] 과제 휴강 처리: studyDetailId={}", studyDetail.getId());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

이 스터디가 현재 로그인한 유저(멘토)가 만든 스터디인지 검증하는 로직도 필요할거같아요!!
아예 StudyMentorService에서 전부 다 쓸거같으니 스터디가 멘토임을 검증하는 로직을 함수로 하나 만들어두면 유용할것같습니다!

@Sangwook02 Sangwook02 changed the title feat: 스터디 휴강 처리 API 추가 feat: 과제 휴강 처리 API 추가 Aug 2, 2024
@@ -79,4 +80,11 @@ public Study createStudy(Member mentor, Period period, Period applicationPeriod)
STUDY_START_TIME,
STUDY_END_TIME);
}

public StudyDetail createStudyDetail(
Copy link
Member

Choose a reason for hiding this comment

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

스터디는 외부에서 받는게 좋아보입니다

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c85fc4c and bac85e6.

Files selected for processing (6)
  • src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailValidator.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java (1 hunks)
  • src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailTest.java (1 hunks)
  • src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailValidatorTest.java (1 hunks)
  • src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java (2 hunks)
Files skipped from review as they are similar to previous changes (3)
  • src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java
  • src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailTest.java
  • src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java
Additional comments not posted (3)
src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailValidator.java (1)

1-16: 코드가 잘 작성되었습니다!

클래스와 메서드 구현이 올바르게 작성되었습니다.

src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (1)

1-39: 코드가 잘 작성되었습니다!

클래스와 메서드 구현이 올바르게 작성되었습니다.

src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailValidatorTest.java (1)

1-38: 테스트 코드가 잘 작성되었습니다!

클래스와 테스트 메서드 구현이 올바르게 작성되었습니다.

Copy link

github-actions bot commented Aug 2, 2024

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bac85e6 and ff7411c.

Files selected for processing (3)
  • src/main/java/com/gdschongik/gdsc/domain/study/api/StudyMentorController.java (2 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (3 hunks)
  • src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • src/main/java/com/gdschongik/gdsc/domain/study/api/StudyMentorController.java
  • src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java
  • src/main/java/com/gdschongik/gdsc/global/exception/ErrorCode.java

Copy link

github-actions bot commented Aug 2, 2024

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

github-actions bot commented Aug 2, 2024

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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ff7411c and 166edd4.

Files selected for processing (2)
  • src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (3 hunks)
  • src/test/java/com/gdschongik/gdsc/domain/study/application/StudyMentorServiceTest.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/test/java/com/gdschongik/gdsc/domain/study/application/StudyMentorServiceTest.java
Additional comments not posted (2)
src/main/java/com/gdschongik/gdsc/domain/study/application/StudyMentorService.java (2)

5-11: LGTM! 새로운 import가 적절하게 추가되었습니다.

추가된 MemberUtil, StudyDetailValidator, 및 CustomException import는 새로운 기능에 필요하며 올바르게 사용되고 있습니다.


23-25: LGTM! 새로운 필드가 적절하게 추가되었습니다.

추가된 memberUtilstudyDetailValidator 필드는 새로운 메서드 cancelStudyAssignment에 필요하며 올바르게 선언되고 초기화되었습니다.

Copy link
Member

@AlmondBreez3 AlmondBreez3 left a comment

Choose a reason for hiding this comment

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

확인부탁드려용


public void validateCancelStudyAssignment(Member currentMember, StudyDetail studyDetail) {
// 멘토가 아니라면 과제를 휴강처리 할 수 없다.
if (!currentMember.equals(studyDetail.getStudy().getMentor())) {
Copy link
Member

Choose a reason for hiding this comment

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

상욱님 이거 보고 구현하다가 생각난건데
저희 이 권한 처리는 로그인과정에서 처리한다고 하지 않았나요?

Copy link
Member Author

Choose a reason for hiding this comment

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

수많은 멘토 중 해당 스터디의 멘토만 수정 가능해야 한다는 맥락에서 이런 검증을 넣었습니다

Copy link
Member

Choose a reason for hiding this comment

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

그리고 그냥 든 생각인데
validateCancel
validatePublish
이렇게 여러개 생성하지 말고 그냥 공통으로 쓸 수 있게 구현하는게 좋지 않을까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

StudyDetail 관련된 모든 수정시 수많은 멘토 중 해당 스터디의 멘토만 수정 가능해야 한다라는 검증을 해야할텐데,
그렇다면 제가 지금 구현해둔걸 나중에 private으로 메서드로 추출해서 각 validate 메서드에서 호출하면 될 것 같습니다.
항상 검증할게 이것만 있는건 아니니까요!

Copy link
Member

Choose a reason for hiding this comment

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

아아~ 알겠습니다 그럼 저도 그냥 validatePublish~~이런 메소드 저기다가 생성해서 과제 생성 api pr에 올리겠습니다~

Copy link
Member Author

Choose a reason for hiding this comment

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

제가 메서드 추출해뒀어요.
pull 받아서 활용하시면 될 것 같아요

Copy link
Member

Choose a reason for hiding this comment

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

그럼 머지 되면 언급만 해주세용~

Copy link

github-actions bot commented Aug 2, 2024

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 166edd4 and 23603ce.

Files selected for processing (1)
  • src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailValidator.java (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailValidator.java

Copy link

github-actions bot commented Aug 2, 2024

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

@uwoobeat uwoobeat left a comment

Choose a reason for hiding this comment

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

lgtm

@Sangwook02 Sangwook02 merged commit 6acc16c into develop Aug 2, 2024
1 check passed
@Sangwook02 Sangwook02 deleted the feature/537-cancel-assignment branch August 2, 2024 13:13
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 23603ce and 151cf82.

Files selected for processing (2)
  • src/test/java/com/gdschongik/gdsc/domain/study/application/StudyMentorServiceTest.java (1 hunks)
  • src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/test/java/com/gdschongik/gdsc/domain/study/application/StudyMentorServiceTest.java
  • src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java

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.

✨ 과제 휴강처리 API 구현
4 participants