[BE] PR 3/3: GET Endpoint for User Points History (#217)#1116
[BE] PR 3/3: GET Endpoint for User Points History (#217)#1116
Conversation
a01284c to
21b48e3
Compare
3bfd607 to
5c381f4
Compare
21b48e3 to
084f044
Compare
5c381f4 to
5de6a97
Compare
There was a problem hiding this comment.
Align with #1118: In PR #1118 the gamification API was aligned to UserScoreService (renamed from PointsService per Iván's suggestion). For consistency across the module, this controller should inject UserScoreService instead of PointsService.
Change the import to com.itachallenge.gamification.service.UserScoreService
Replace the field and constructor parameter with UserScoreService userScoreService
Call userScoreService.getUserPointsHistory(userId) in the handler
| } | ||
|
|
||
| @Test | ||
| void getUserPointsHistory_WhenNoTokenProvided_Returns400BadRequest() { |
There was a problem hiding this comment.
The AC state "Returns 401 Unauthorized if the token is missing or invalid". This test currently expects 400 Bad Request. Consider renaming the test to e.g. getUserPointsHistory_WhenNoTokenProvided_Returns401Unauthorized and asserting .expectStatus().isUnauthorized() so the behaviour and test name match the criteria.
fce0295 to
ced6d51
Compare
# Conflicts: # itachallenge-challenge/src/main/java/com/itachallenge/gamification/service/UserScoreServiceImpl.java
5de6a97 to
c9f69e8
Compare
|





Feature: GET endpoint for authenticated student progress
closes sub-issue IT-Academy-BCN/ita-challenges#217
📝Description
Exposes the final REST endpoint GET
/itachallenge/api/v1/gamification/users/{userId}/history. This PR implements the endpoint to query a user's points history, using a reactive architecture and persistence in MongoDB, which allows efficient retrieval of activity breakdowns and total points balances.✅ Acceptance Criteria
🔧 Technical Details
UserScoreHistoryControllerinjectsUserScoreService.common.exception.GlobalExceptionHandler.[ ]with aOk response (since this is the expected situation for a new student).
💰 Value Provided
🔓 Unlocks
Unblocks QA Testing and Frontend Integration.
🔗 Dependencies
Chained to #1118
🧪 Test Implementations
🔄 Acceptance Criteria (DoD)
👨💻 Technical Debts
Filters: Filtering by date range or transaction type is not implemented.
Username: Currently, the username is retrieved from the history. If the history is empty, the field returns an empty string.
Pagination: The history returns all records. For users with high long-term activity, pagination or date filtering should be implemented.
Audit Logs: Point source differentiation is currently not exposed in the API, although the data model supports it via challengeId.
Debt Log: Implementation of 404 errors have been formally documented in the backlog board.