Skip to content

챌린지 인증 기능 추가#230

Merged
jihwankim128 merged 7 commits intomainfrom
feat/challenge-cert
Aug 12, 2025
Merged

챌린지 인증 기능 추가#230
jihwankim128 merged 7 commits intomainfrom
feat/challenge-cert

Conversation

@jihwankim128
Copy link
Collaborator

@jihwankim128 jihwankim128 commented Aug 12, 2025

#️⃣ 연관된 이슈

ex) close #Issue number

📝 작업 내용

이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)

📷 스크린샷

이미지

💬 리뷰 요구사항(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 명칭

📌 PR 진행 시 참고사항

  • 리뷰어는 좋은 코드 방향을 제시하되, 수정을 강요하지 않습니다.
  • 좋은 코드를 발견하면 칭찬과 격려를 아끼지 않습니다.
  • 리뷰는 Reviewer로 지정된 시점 기준으로 3일 이내에 진행해 주세요.
  • Comment 작성 시 아래 Prefix를 사용해 주세요:
    • P1: 꼭 반영해 주세요 (Request Changes) – 이슈나 취약점 관련
    • P2: 반영을 고려해 주세요 (Comment) – 개선 의견
    • P3: 단순 제안 (Chore)

Summary by CodeRabbit

  • New Features
    • Submit challenge certifications for personal and team challenges via new endpoints.
  • Changes
    • Challenge start/end fields now use date-only (LocalDate) across APIs.
    • User-facing messages updated for certification actions.
  • Refactor
    • Legacy certification APIs (including admin endpoints) removed; use the new certification endpoints.
  • Documentation
    • OpenAPI schemas updated (date examples, descriptions, tags cleanup).
  • Chores
    • Authentication annotations consolidated at controller level (no behavior change).

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Introduces a new certification module (entity, service, DTOs, queries, controller) while removing the legacy challengecert module. Refactors challenge dates from LocalDateTime to LocalDate across entities, DTOs, queries, and repos. Adds global ChallengeClient with an adapter. Consolidates controller authentication at class level. Adds a fake auth tool.

Changes

Cohort / File(s) Summary
New certification application/service
src/.../certification/application/ChallengeCertificationService.java
New transactional service to issue personal/team certifications using queries, repository, and client helper; performs duplicate checks and side effects.
Certification commands (DTO->Domain)
src/.../certification/application/command/PersonalChallengeCertificateCommand.java, src/.../certification/application/command/TeamChallengeCertificateCommand.java
New command records with factory methods and toEntity converters.
Certification domain model
src/.../certification/domain/ChallengeCertification.java, .../CertificationStatus.java, .../ChallengeSnapshot.java, .../MemberSnapshot.java
New JPA entity and value objects for certification and snapshots; enum with @jsonvalue descriptions.
Certification queries and repo
src/.../certification/domain/ChallengeCertificationQuery.java, .../ChallengeCertificationRepository.java, src/.../certification/infra/ChallengeCertificationQueryImpl.java
New query interface/impl with duplicate checks; repository with JPQL existence queries for personal/team.
Certification exceptions
src/.../certification/exception/CertificationException.java, .../CertificationExceptionMessage.java
New domain exception and messages.
Certification client helper
src/.../certification/util/CertificationClientHelper.java
Helper to fetch challenge/group/member snapshots and confirm image usage.
Certification UI (controller + responses + DTOs)
src/.../certification/ui/ChallengeCertificationController.java, .../ui/docs/ChallengeCertificationControllerDocs.java, .../ui/dto/PersonalChallengeCertificateDto.java, .../ui/dto/TeamChallengeCertificateDto.java, .../ui/CertificationResponseMessage.java
New endpoints for personal/team certification, OpenAPI docs, DTOs, and response message enum.
Controller auth consolidation
src/.../challenge/controller/command/ChallengeGroupCommandController.java, .../PersonalChallengeCommandController.java, .../TeamChallengeCommandController.java, src/.../challenge/controller/query/PersonalChallengeQueryController.java, .../TeamChallengeQueryController.java, .../query/ChallengeGroupQueryController.java, .../command/docs/ChallengeGroupCommandControllerDocs.java
Move @AuthenticatedApi to class level; remove per-method tags/annotations; minor message key change; adjust query method call signature.
Challenge date refactor to LocalDate
src/.../challenge/entity/challenge/BaseChallenge.java, .../PersonalChallenge.java, .../TeamChallenge.java
Replace begin/end LocalDateTime with LocalDate; update constructors, isActive, updateBasicInfo, validations, and participation checks.
Participation/table mapping simplifications
src/.../challenge/entity/challenge/PersonalChallengeParticipation.java, .../TeamChallengeParticipation.java, src/.../challenge/entity/group/ChallengeGroup.java, .../ChallengeGroupParticipation.java
Simplify @table mappings (remove indexes/unique constraints); adjust error messages and participant helpers in group entity.
Group period logic
src/.../challenge/entity/group/GroupPeriod.java
Change canParticipate condition to compare against beginDateTime.
Challenge admin/query DTOs updated to dates
src/.../challenge/controller/query/dto/challenge/AdminChallengeDetailDto.java, .../AdminPersonalChallengesDto.java, .../AdminTeamChallengesDto.java, .../ChallengeDetailDto.java, .../ChallengeDto.java
Replace LocalDateTime fields with LocalDate and update mappers/formatters.
Challenge services and admin DTO helpers
src/.../challenge/controller/command/dto/AdminChallengeCreateDto.java, .../AdminChallengeUpdateDto.java, src/.../challenge/service/PersonalChallengeService.java, .../TeamChallengeService.java
Add DTO->entity converters and date extractors; services use new helpers and LocalDate methods.
Challenge queries/repositories
src/.../challenge/infra/querydsl/TeamChallengeQueryImpl.java, .../PersonalChallengeQueryImpl.java, .../ChallengeGroupQueryImpl.java, src/.../challenge/repository/query/TeamChallengeQuery.java, .../PersonalChallengeQuery.java, .../ChallengeGroupQuery.java, src/.../challenge/repository/TeamChallengeRepository.java, .../PersonalChallengeRepository.java, .../infra/querydsl/predicates/PersonalChallengePredicates.java, .../projections/*Challenge*Projections.java
Update signatures to LocalDate, remove status param from cursor query, add member/date retrieval, add membership checks, visibility filters, and group-period validation changes.
Global client and adapter
src/.../global/client/ChallengeClient.java, src/.../global/client/dto/ChallengeDto.java, .../dto/ChallengeGroupDto.java, src/.../domain/challenge/infra/ChallengeAdapter.java
New client interface and DTOs; adapter maps domain queries to client DTOs.
Legacy challengecert module removal
src/.../domain/challengecert/... (controllers, docs, messages, DTOs, repositories, exceptions, entities: BaseChallengeCertification, PersonalChallengeCertification, TeamChallengeCertification, etc.)
Entire legacy certification layer removed, including REST APIs, DTOs, repositories, exceptions, and entities.
Challenge exceptions updated
src/.../challenge/exception/ChallengeExceptionMessage.java
Replace/rename constants; add INVALID_CHALLENGE_PERIOD.
Example tools
src/.../domain/example/tools/FakeAuthTools.java
New controller to mint test tokens (user/admin) and set refresh-token cookie.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant Controller as ChallengeCertificationController
  participant Service as ChallengeCertificationService
  participant Helper as CertificationClientHelper
  participant Query as ChallengeCertificationQuery
  participant Repo as ChallengeCertificationRepository
  participant File as FileManager

  User->>Controller: POST /personal/{challengeId}
  Controller->>Service: certificatePersonalChallenge(cmd)
  Service->>Query: checkAlreadyPersonalCert(...)
  Service->>Helper: getPersonalSnapshot(challengeId, memberId, date)
  Service->>Helper: getMemberSnapshot(memberId)
  Service->>Repo: save(ChallengeCertification)
  Service->>Helper: processCertSideEffect(imageUrl)
  Service-->>Controller: void
  Controller-->>User: 204 NoContent

  User->>Controller: POST /team/{groupId}
  Controller->>Service: certificateTeamChallenge(cmd)
  Service->>Helper: getChallengeGroupDto(groupId, memberId)
  Service->>Query: checkAlreadyTeamCert(challengeId, date, memberId)
  Service->>Helper: getTeamSnapshot(challengeId, groupCode)
  Service->>Helper: getMemberSnapshot(memberId)
  Service->>Repo: save(ChallengeCertification)
  Service->>Helper: processCertSideEffect(imageUrl)
  Service-->>Controller: void
  Controller-->>User: 204 NoContent
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

dev:feature

Poem

A carrot-stamp of certs today,
New dates now dawn in pure array.
Old burrows sealed, new tunnels bright,
Snapshots hop into the light.
With tokens minted, off we race—
Approvals pending, set the pace! 🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/challenge-cert

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.

❤️ 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@jihwankim128 jihwankim128 merged commit a8fe826 into main Aug 12, 2025
1 of 2 checks passed
@github-actions
Copy link

Unit Test Coverage Report

Total Project Coverage 51.92%
File Coverage [1.21%]
CertificationStatus.java 100% 🍏
ChallengeCertificationService.java 4.26%
MemberSnapshot.java 0%
ChallengeCertification.java 0%
ChallengeSnapshot.java 0%
TeamChallengeCommandController.java 0%
PersonalChallengeCommandController.java 0%
ChallengeGroupCommandController.java 0%
ChallengeGroupQueryController.java 0%
PersonalChallengeQueryController.java 0%
TeamChallengeQueryController.java 0%
ChallengeExceptionMessage.java 0%
ChallengeCertificationController.java 0%
CertificationResponseMessage.java 0%
ChallengeGroup.java 0%
GroupPeriod.java 0%
ChallengeGroupParticipation.java 0%
CertificationClientHelper.java 0%
AdminTeamChallengesDto.java 0%
AdminPersonalChallengesDto.java 0%
ChallengeDto.java 0%
AdminChallengeDetailDto.java 0%
ChallengeDetailDto.java 0%
AdminChallengeUpdateDto.java 0%
AdminChallengeCreateDto.java 0%
ChallengeGroupCreateDto.java 0%
TeamChallengeCertificateCommand.java 0%
PersonalChallengeCertificateCommand.java 0%
BaseChallenge.java 0%
PersonalChallengeParticipation.java 0%
PersonalChallenge.java 0%
TeamChallenge.java 0%
TeamChallengeParticipation.java 0%
TeamChallengeService.java 0%
ChallengeGroupService.java 0%
PersonalChallengeService.java 0%
TeamChallengeCertificateDto.java 0%
PersonalChallengeCertificateDto.java 0%
CertificationExceptionMessage.java 0%
CertificationException.java 0%
ChallengeDto.java 0%
ChallengeGroupDto.java 0%

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.

1 participant