Conversation
There was a problem hiding this comment.
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
src/main/java/org/runimo/runimo/records/service/RecordFinder.java
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
작업내역
알 지급 validate 로직 작성
테스트코드 작성