Skip to content

[Feat/validate reward request]#7

Merged
ekgns33 merged 11 commits intomainfrom
feat/validate-reward-request
Mar 27, 2025
Merged

[Feat/validate reward request]#7
ekgns33 merged 11 commits intomainfrom
feat/validate-reward-request

Conversation

@ekgns33
Copy link
Contributor

@ekgns33 ekgns33 commented Mar 27, 2025

작업내역

  • 알 지급 validate 로직 작성

    • 주간 첫번째 달리기인지 확인
    • 이미 지급한 기록인지 확인
    • 자신의 기록인지 확인
  • 테스트코드 작성

    • Service 레이어 테스트
    • 인수테스트

@ekgns33 ekgns33 requested a review from Copilot March 27, 2025 07:17
@ekgns33 ekgns33 self-assigned this Mar 27, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements reward validation logic for running records, ensuring that users receive an egg reward only for their first run of the week while updating related tests and documentation.

  • Added a new enum for HTTP responses and updated reward response handling.
  • Created acceptance and unit tests for reward claiming and updated record creation contracts.
  • Enhanced repository and service methods to correctly validate reward eligibility and incorporate the "isRewarded" flag.

Reviewed Changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/main/java/org/runimo/runimo/records/enums/RecordHttpResponse.java Introduces HTTP response codes for record operations.
src/test/java/org/runimo/runimo/rewards/api/RewardAcceptanceTest.java Adds acceptance tests for reward claiming scenarios.
src/main/java/org/runimo/runimo/rewards/README.md Updates documentation for reward conditions and expected behavior.
src/test/java/org/runimo/runimo/rewards/service/RewardServiceTest.java Implements unit tests for the reward service logic.
src/main/java/org/runimo/runimo/records/repository/RecordRepository.java Adds a custom query to retrieve the first run of the week.
src/main/java/org/runimo/runimo/records/service/RecordFinder.java Adds a new method to determine a user's first run of the current week using paging.
src/main/java/org/runimo/runimo/rewards/service/RewardService.java Updates reward claim logic with validation before granting an egg reward.
src/main/java/org/runimo/runimo/common/GlobalConsts.java Defines a new constant used for creating an "empty" egg instance.
src/test/java/org/runimo/runimo/user/UserFixtures.java Introduces method to create a user instance with a set id for testing.
src/main/java/org/runimo/runimo/item/domain/Egg.java Provides a static EMPTY instance used to represent no reward.
src/main/java/org/runimo/runimo/records/service/usecases/RecordCreateUsecaseImpl.java Adapts record creation to use the user's id instead of a public identifier.
src/main/java/org/runimo/runimo/records/controller/RecordController.java Wraps responses with a SuccessResponse and uses updated record creation contracts.
src/main/java/org/runimo/runimo/records/domain/RunningRecord.java Adds the "isRewarded" flag and reward methods to the running record entity.
src/main/java/org/runimo/runimo/records/service/RecordCommandService.java Updates mapping logic for record creation to include the reward flag.
src/test/java/org/runimo/runimo/CleanUpUtil.java Expands test cleanup to include running records.
src/main/java/org/runimo/runimo/records/service/usecases/dtos/RecordCreateCommand.java Updates the DTO to take a user id rather than a public id.
src/main/java/org/runimo/runimo/records/controller/requests/RecordSaveRequest.java Removes the userPublicId field in favor of user id usage.
src/test/java/org/runimo/runimo/rewards/RewardTest.java Aligns reward tests with changes in user identification.
Files not reviewed (2)
  • src/main/resources/sql/schema.sql: Language not supported
  • src/test/resources/sql/schema.sql: Language not supported

@ekgns33 ekgns33 merged commit 407ba18 into main Mar 27, 2025
1 check passed
@ekgns33 ekgns33 deleted the feat/validate-reward-request branch April 16, 2025 07:44
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.

2 participants