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 구현 #909

Merged
merged 4 commits into from
Feb 23, 2025

Conversation

Sangwook02
Copy link
Member

@Sangwook02 Sangwook02 commented Feb 19, 2025

🌱 관련 이슈

📌 작업 내용 및 특이사항

📝 참고사항

📚 기타

Summary by CodeRabbit

  • New Features
    • 멘토가 스터디 참여자 중 우수 학생을 지정하고 철회할 수 있는 새로운 기능이 도입되었습니다.
    • 중복 지정 방지를 위한 검증 로직이 추가되어, 보다 안정적인 운영이 지원됩니다.
    • 관련 데이터 관리와 조회 기능이 개선되어 효율성이 향상되었습니다.

@Sangwook02 Sangwook02 added the ✨ feature 새로운 기능 추가 및 수정 label Feb 19, 2025
@Sangwook02 Sangwook02 self-assigned this Feb 19, 2025
@Sangwook02 Sangwook02 requested a review from a team as a code owner February 19, 2025 12:59
Copy link

coderabbitai bot commented Feb 19, 2025

📝 Walkthrough

Walkthrough

이번 PR은 멘토의 우수 학생 성과 관리를 위한 새로운 기능을 도입합니다. 새로 추가된 REST 컨트롤러와 서비스 클래스는 우수 학생 지정 및 철회 기능을 제공하며, 관련 데이터 처리를 위한 커스텀 레포지토리와 검증 로직이 구현되었습니다. 또한, StudyAchievement 및 StudyHistory 관련 DAO 인터페이스와 구현체가 추가되어 데이터베이스 쿼리 처리 로직이 정리되었습니다.

Changes

파일 변경사항
src/main/.../api/MentorStudyAchievementControllerV2.java POST와 DELETE 엔드포인트를 제공하는 멘토 우수 학생 성과 관련 REST 컨트롤러 추가
src/main/.../application/MentorStudyAchievementServiceV2.java 우수 학생 지정 및 철회 로직을 처리하는 서비스 클래스 추가
src/main/.../dao/StudyAchievementV2CustomRepository*.java,
src/main/.../dao/StudyAchievementV2Repository.java,
src/main/.../dao/StudyHistoryV2CustomRepository*.java
맞춤형 쿼리 메서드 (삭제, 카운트 등) 추가 및 구현, 기존 쿼리 로직 개선
src/main/.../domain/StudyAchievementValidatorV2.java 우수 학생 성과 중복 지정을 방지하는 도메인 검증 로직 추가

Sequence Diagram(s)

sequenceDiagram
  participant C as Client
  participant Ctrl as MentorStudyAchievementControllerV2
  participant Srv as MentorStudyAchievementServiceV2
  participant Repo as Repository Layer

  %% Designate Outstanding Student Flow
  C->>Ctrl: HTTP POST /v2/mentor/study-achievements<br>(studyId, OutstandingStudentRequest)
  Ctrl->>Srv: designateOutstandingStudent(studyId, request)
  Srv->>Repo: 학생 존재 및 중복 여부 검증<br>데이터 조회/저장
  Repo-->>Srv: 결과 반환
  Srv-->>Ctrl: 성공 응답
  Ctrl-->>C: HTTP 200 OK

  %% Withdraw Outstanding Student Flow
  C->>Ctrl: HTTP DELETE /v2/mentor/study-achievements<br>(studyId, OutstandingStudentRequest)
  Ctrl->>Srv: withdrawOutstandingStudent(studyId, request)
  Srv->>Repo: 학생 존재 검증 및 성과 삭제<br>쿼리 실행
  Repo-->>Srv: 삭제 결과 반환
  Srv-->>Ctrl: 성공 응답
  Ctrl-->>C: HTTP 200 OK
Loading

Possibly related PRs

Poem

귀여운 토끼가 전하는 노래, 🐰
새로운 코드가 한 줄씩 춤을 추네.
컨트롤러와 서비스가 만나
데이터베이스와 리듬을 타며
우리 프로젝트에 빛을 더하네.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4ba9041 and 5529c56.

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

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. (Beta)
  • @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

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 (8)
src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyHistoryV2CustomRepository.java (2)

8-8: 메서드 문서화 및 매개변수 유효성 검사 추가 필요

메서드의 목적과 매개변수에 대한 명확한 이해를 위해 다음 사항들을 고려해주세요:

  1. JavaDoc을 추가하여 메서드의 목적, 매개변수, 반환값을 문서화
  2. @NonNull 어노테이션을 사용하여 null 허용 여부를 명시
  3. studentIds 리스트 처리 방법 명시

다음과 같이 개선해보세요:

+    /**
+     * 특정 스터디의 학생들에 대한 스터디 이력 수를 조회합니다.
+     *
+     * @param studyId 조회할 스터디 ID
+     * @param studentIds 조회할 학생 ID 목록
+     * @return 스터디 이력 수
+     * @throws IllegalArgumentException studentIds가 비어있는 경우
+     */
+    @NonNull
     long countByStudyIdAndStudentIds(
+        @NonNull Long studyId,
+        @NonNull List<Long> studentIds
     );

10-10: 기존 메서드와의 일관성 유지 필요

findAllByStudyIdAndStudentIds 메서드도 동일한 패턴으로 문서화와 유효성 검사를 적용하면 좋겠습니다.

다음과 같이 개선해보세요:

+    /**
+     * 특정 스터디의 학생들에 대한 스터디 이력 목록을 조회합니다.
+     *
+     * @param studyId 조회할 스터디 ID
+     * @param studentIds 조회할 학생 ID 목록
+     * @return 스터디 이력 목록
+     * @throws IllegalArgumentException studentIds가 비어있는 경우
+     */
+    @NonNull
     List<StudyHistoryV2> findAllByStudyIdAndStudentIds(
+        @NonNull Long studyId,
+        @NonNull List<Long> studentIds
     );
src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyHistoryV2CustomRepositoryImpl.java (1)

17-24: count 쿼리 결과의 null 처리 방식을 개선하면 좋겠습니다.

현재 구현은 count 쿼리의 결과가 null인 경우 NullPointerException을 발생시킵니다. count 쿼리의 결과는 일반적으로 null이 아닌 0을 반환해야 합니다.

다음과 같이 개선하는 것을 제안드립니다:

-        return Objects.requireNonNull(queryFactory
+        return queryFactory
                 .select(studyHistoryV2.count())
                 .from(studyHistoryV2)
                 .where(eqStudyId(studyId), studyHistoryV2.student.id.in(studentIds))
-                .fetchOne());
+                .fetchOne() != null ? queryFactory
+                .select(studyHistoryV2.count())
+                .from(studyHistoryV2)
+                .where(eqStudyId(studyId), studyHistoryV2.student.id.in(studentIds))
+                .fetchOne() : 0L;
src/main/java/com/gdschongik/gdsc/domain/studyv2/application/MentorStudyAchievementServiceV2.java (1)

65-83: 중복 코드 최소화를 고려해 보세요.
withdrawOutstandingStudent 메서드에서도 studyValidatorstudyHistoryValidator 호출 로직이 designateOutstandingStudent와 유사하게 반복됩니다. 공통되는 로직을 별도의 유틸 메서드로 추출하면 가독성과 유지보수성이 향상될 수 있습니다.

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

11-16: 검증 로직 개선 제안

검증 메서드가 단순히 카운트만 확인하고 있습니다. 다음과 같은 추가 검증을 고려해보세요:

  • 입력값 유효성 검사 (음수 카운트 체크)
  • 구체적인 에러 메시지 포함
 public void validateDesignateOutstandingStudent(long countStudyAchievementsAlreadyExist) {
+    if (countStudyAchievementsAlreadyExist < 0) {
+        throw new CustomException(INVALID_STUDY_ACHIEVEMENT_COUNT);
+    }
     // 이미 우수 스터디원으로 지정된 스터디원이 있는 경우
     if (countStudyAchievementsAlreadyExist > 0) {
-        throw new CustomException(STUDY_ACHIEVEMENT_ALREADY_EXISTS);
+        throw new CustomException(STUDY_ACHIEVEMENT_ALREADY_EXISTS,
+            String.format("이미 %d명의 우수 스터디원이 지정되어 있습니다.", countStudyAchievementsAlreadyExist));
     }
 }
src/main/java/com/gdschongik/gdsc/domain/studyv2/api/MentorStudyAchievementControllerV2.java (1)

34-38: 삭제 API 응답 개선 필요

삭제 작업의 결과를 명확하게 전달하기 위해 응답 본문을 포함하는 것이 좋습니다.

 @DeleteMapping
 public ResponseEntity<Void> withdrawOutstandingStudent(
-        @RequestParam(name = "studyId") Long studyId, @RequestBody OutstandingStudentRequest request) {
+        @RequestParam(name = "studyId") Long studyId, @Valid @RequestBody OutstandingStudentRequest request) {
     mentorStudyAchievementService.withdrawOutstandingStudent(studyId, request);
-    return ResponseEntity.ok().build();
+    return ResponseEntity.ok()
+        .body(new ApiResponse<>("우수 스터디원 지정이 철회되었습니다."));
 }
src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyAchievementV2CustomRepositoryImpl.java (2)

26-34: 카운트 쿼리 성능 최적화 필요

카운트 쿼리의 성능을 개선하고 null 체크를 보완할 필요가 있습니다.

 @Override
 public long countByStudyIdAndAchievementTypeAndStudentIds(
         Long studyId, AchievementType achievementType, List<Long> studentIds) {
+    if (studentIds == null || studentIds.isEmpty()) {
+        return 0L;
+    }
-    return Objects.requireNonNull(queryFactory
+    Long count = queryFactory
             .select(studyAchievementV2.count())
             .from(studyAchievementV2)
             .where(eqStudyId(studyId), eqAchievementType(achievementType), containsStudentId(studentIds))
-            .fetchOne());
+            .fetchOne();
+    return count != null ? count : 0L;
 }

44-46: 리스트 검증 로직 개선 필요

memberIds 리스트의 유효성을 더 엄격하게 검증할 필요가 있습니다.

 private BooleanExpression containsStudentId(List<Long> memberIds) {
-    return memberIds != null ? studyAchievementV2.student.id.in(memberIds) : null;
+    return (memberIds != null && !memberIds.isEmpty()) ? 
+        studyAchievementV2.student.id.in(memberIds.stream()
+            .filter(Objects::nonNull)
+            .collect(Collectors.toList())) : 
+        null;
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3ef4a20 and da502c8.

📒 Files selected for processing (8)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/api/MentorStudyAchievementControllerV2.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/application/MentorStudyAchievementServiceV2.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyAchievementV2CustomRepository.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyAchievementV2CustomRepositoryImpl.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyAchievementV2Repository.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyHistoryV2CustomRepository.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyHistoryV2CustomRepositoryImpl.java (1 hunks)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/StudyAchievementValidatorV2.java (1 hunks)
🔇 Additional comments (6)
src/main/java/com/gdschongik/gdsc/domain/studyv2/dao/StudyHistoryV2CustomRepositoryImpl.java (3)

6-6: 새로운 임포트가 적절히 추가되었습니다!

BooleanExpression과 Objects 클래스의 추가는 새로운 기능 구현에 필요한 적절한 변경사항입니다.

Also applies to: 9-9


26-32: 조건식 추출이 잘 이루어졌습니다!

studyId 비교 로직을 별도의 메서드로 추출하여 코드의 재사용성과 가독성이 향상되었습니다.


34-36: 도메인 로직이 잘 캡슐화되었습니다!

eqStudyId 메서드는 간단하지만 도메인 로직을 잘 캡슐화하고 있으며, 메서드 이름이 그 목적을 명확하게 전달합니다.

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

29-37: 필드 주입 체계가 명확합니다.
필요한 의존성을 명확히 주입하고 있어 가독성이 높습니다. 다만, 향후 확장성을 고려하여 너무 많은 필드를 주입하게 되면 서비스 역할이 비대해질 우려가 있으니 모듈화를 고려하셔도 좋겠습니다.

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

1-8: 커스텀 리포지토리와 함께 JpaRepository를 사용해 확장성이 높습니다.
StudyAchievementV2CustomRepository의 메서드들과 표준 JpaRepository 함수가 결합되므로, 구현 유연성이 좋아 보입니다. 추후 복잡한 쿼리를 더 많이 추가해야 할 때도 확장하기에 용이한 구조입니다.

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

6-13: 메서드 시그니처가 명확해 이해하기 쉽습니다.
deleteByStudyAndAchievementTypeAndMemberIdscountByStudyIdAndAchievementTypeAndStudentIds 모두 파라미터의 의미가 직관적이라 코드 사용 시 혼동이 적을 것으로 보입니다. 대규모 쿼리 실행 시 성능 검증만 병행한다면 문제없이 활용 가능할 것으로 판단됩니다.

Comment on lines 38 to 63
@Transactional
public void designateOutstandingStudent(Long studyId, OutstandingStudentRequest request) {
Member currentMember = memberUtil.getCurrentMember();
StudyV2 study = studyRepository.findById(studyId).orElseThrow(() -> new CustomException(STUDY_NOT_FOUND));
long countByStudyIdAndStudentIds =
studyHistoryRepository.countByStudyIdAndStudentIds(studyId, request.studentIds());
long studyAchievementsAlreadyExistCount =
studyAchievementRepository.countByStudyIdAndAchievementTypeAndStudentIds(
studyId, request.achievementType(), request.studentIds());

studyValidator.validateStudyMentor(currentMember, study);
studyHistoryValidator.validateAppliedToStudy(
countByStudyIdAndStudentIds, request.studentIds().size());
studyAchievementValidator.validateDesignateOutstandingStudent(studyAchievementsAlreadyExistCount);

List<Member> outstandingStudents = memberRepository.findAllById(request.studentIds());
List<StudyAchievementV2> studyAchievements = outstandingStudents.stream()
.map(member -> StudyAchievementV2.create(request.achievementType(), member, study))
.toList();
studyAchievementRepository.saveAll(studyAchievements);

log.info(
"[MentorStudyAchievementServiceV2] 우수 스터디원 지정: studyId={}, studentIds={}",
studyId,
request.studentIds());
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

메서드의 예외 처리 및 유효성 검증이 체계적으로 잘 구성되었습니다.
studyValidator, studyHistoryValidator, studyAchievementValidator를 통해 역할별 검증이 철저히 이루어지고 있습니다. 다만, memberRepository.findAllById(request.studentIds()) 중 일부 ID가 실제로 존재하지 않는 경우도 고려하여 누락된 Member가 있을 시 추가적인 예외 처리를 추가하면 데이터 무결성 확보에 도움이 될 것으로 보입니다.

Comment on lines +26 to +30
public ResponseEntity<Void> designateOutstandingStudent(
@RequestParam(name = "studyId") Long studyId, @RequestBody OutstandingStudentRequest request) {
mentorStudyAchievementService.designateOutstandingStudent(studyId, request);
return ResponseEntity.ok().build();
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

API 응답 및 유효성 검사 개선 필요

다음 개선사항을 고려해보세요:

  1. 입력값 유효성 검사 (@Valid 어노테이션 추가)
  2. 성공 시 201 Created 상태 코드 사용
  3. 작업 결과를 포함하는 응답 본문 추가
 @PostMapping
 public ResponseEntity<Void> designateOutstandingStudent(
-        @RequestParam(name = "studyId") Long studyId, @RequestBody OutstandingStudentRequest request) {
+        @RequestParam(name = "studyId") Long studyId, @Valid @RequestBody OutstandingStudentRequest request) {
     mentorStudyAchievementService.designateOutstandingStudent(studyId, request);
-    return ResponseEntity.ok().build();
+    return ResponseEntity.status(HttpStatus.CREATED)
+        .body(new ApiResponse<>("우수 스터디원 지정이 완료되었습니다."));
 }

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +17 to +24
@Override
public void deleteByStudyAndAchievementTypeAndMemberIds(
Long studyId, AchievementType achievementType, List<Long> memberIds) {
queryFactory
.delete(studyAchievementV2)
.where(eqStudyId(studyId), eqAchievementType(achievementType), containsStudentId(memberIds))
.execute();
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

벌크 삭제 작업 트랜잭션 관리 필요

벌크 삭제 작업은 트랜잭션 내에서 수행되어야 하며, 영속성 컨텍스트와의 동기화가 필요합니다.

+@Transactional
 @Override
 public void deleteByStudyAndAchievementTypeAndMemberIds(
         Long studyId, AchievementType achievementType, List<Long> memberIds) {
+    if (memberIds == null || memberIds.isEmpty()) {
+        return;
+    }
     queryFactory
             .delete(studyAchievementV2)
             .where(eqStudyId(studyId), eqAchievementType(achievementType), containsStudentId(memberIds))
             .execute();
+    // 영속성 컨텍스트 초기화
+    entityManager.flush();
+    entityManager.clear();
 }
📝 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
@Override
public void deleteByStudyAndAchievementTypeAndMemberIds(
Long studyId, AchievementType achievementType, List<Long> memberIds) {
queryFactory
.delete(studyAchievementV2)
.where(eqStudyId(studyId), eqAchievementType(achievementType), containsStudentId(memberIds))
.execute();
}
@Transactional
@Override
public void deleteByStudyAndAchievementTypeAndMemberIds(
Long studyId, AchievementType achievementType, List<Long> memberIds) {
if (memberIds == null || memberIds.isEmpty()) {
return;
}
queryFactory
.delete(studyAchievementV2)
.where(eqStudyId(studyId), eqAchievementType(achievementType), containsStudentId(memberIds))
.execute();
// 영속성 컨텍스트 초기화
entityManager.flush();
entityManager.clear();
}

public void designateOutstandingStudent(Long studyId, OutstandingStudentRequest request) {
Member currentMember = memberUtil.getCurrentMember();
StudyV2 study = studyRepository.findById(studyId).orElseThrow(() -> new CustomException(STUDY_NOT_FOUND));
long countByStudyIdAndStudentIds =
Copy link
Member

Choose a reason for hiding this comment

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

count가 suffix가 되어야 할 것 같네요. 아래는 그렇게 되어있고요

Copy link
Member

Choose a reason for hiding this comment

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

간단한 로직이라면 상단에서 전부 조회하고 -> 도메인 로직을 호출해도 되겠지만...
수행하는 로직들이 많기 때문에 필요한 로직에 맞게 조회 호출 위치를 조정해야 할 것 같네요

  • studyValidator + studyHistoryValidator 호출할 때는 현재 멤버, 스터디만 필요하니 여기까지만 조회하고 검증 로직 호출
  • studyAchievementValidator 호출하기 전에 studyAchievementAlreadyExistCount 조회해오기
  • 그리고 지정 대상으로 학생들 조회해오고 + 우수내역 만들고 + 저장

이렇게 세 단으로 나눠서 조회 + 로직 수행을 구분하면 좋을듯요

Copy link
Member Author

@Sangwook02 Sangwook02 Feb 21, 2025

Choose a reason for hiding this comment

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

count가 suffix가 되어야 할 것 같네요. 아래는 그렇게 되어있고요

ByStudyIdAndStudentIds는 메서드명으로도 알 수 있으니 studyHistoryCount로 수정했습니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

  • vementVali

리뷰 내용대로 전반적인 메서드 호출 순서를 조정했어요.
아래에 있는 철회 메서드도 같이 수정했습니다~

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

@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

@DomainService
public class StudyAchievementValidatorV2 {

public void validateDesignateOutstandingStudent(long countStudyAchievementsAlreadyExist) {
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

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

@Sangwook02 Sangwook02 merged commit 15612fe into develop Feb 23, 2025
2 checks passed
@Sangwook02 Sangwook02 deleted the feature/893-outstanding-student-api branch February 23, 2025 05:04
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.

✨ 스터디 우수 처리 및 철회 V2 API 구현
3 participants