Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new creator property (and related fields) to the response of the getSubscribedActivitiesWithStreakByName function while refactoring various tests and mapping methods to support updated DTOs and query outputs.
- Updated DTOs (UserOutputDTOV2 and ActivityOutputV2Streak) to include new fields (isFollowing, creator, and timesRemaining).
- Renamed controller query mappings and test methods from findById to findByEmail and updated error handling.
- Introduced a new TimeRatesDate utility to centralize and standardize time range calculations.
Reviewed Changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| API/src/test/java/es/iespuertodelacruz/routinefights/user/infrastructure/adapters/primary/v2/controllers/UserControllerV2Test.java | Updated tests to reflect changes in API method naming and updated DTO constructor with new isFollowing field. |
| API/src/test/java/es/iespuertodelacruz/routinefights/post/infrastructure/adapters/primary/mappers/PostOutputV2MapperTest.java | Updated expected DTO instantiation to include the new boolean parameter. |
| API/src/test/java/es/iespuertodelacruz/routinefights/activity/infrastructure/adapters/primary/v2/controllers/ActivityV2ControllerTest.java | Updated tests to include changes in ActivityOutputV2Streak constructor parameters. |
| API/src/main/java/es/iespuertodelacruz/routinefights/user/infrastructure/adapters/primary/v2/dtos/UserOutputDTOV2.java | Modified record definition to add the isFollowing field. |
| API/src/main/java/es/iespuertodelacruz/routinefights/shared/utils/TimeRatesDate.java | New utility class for calculating time iteration ranges, replacing duplicate date-calculation code. |
| API/src/main/java/es/iespuertodelacruz/routinefights/post/domain/services/PostService.java | Refactored calculateStreak() to use the new TimeRatesDate utility for improved consistency. |
| API/src/main/java/es/iespuertodelacruz/routinefights/activity/infrastructure/adapters/secondary/repositories/IActivityEntityRepository.java | Modified query to return additional nodes (creator and user) required for the new creator field in the activity responses. |
| API/src/main/java/es/iespuertodelacruz/routinefights/activity/infrastructure/adapters/primary/v2/dtos/ActivityOutputV2Streak.java | Updated record definition to accept new creator and timesRemaining parameters. |
| API/src/main/java/es/iespuertodelacruz/routinefights/activity/commons/ActivityCommons.java | Added transient annotation for timesRemaining to avoid persistence concerns. |
Files not reviewed (2)
- API/pom.xml: Language not supported
- API/src/main/resources/graphql/schema.graphqls: Language not supported
Comments suppressed due to low confidence (3)
API/src/test/java/es/iespuertodelacruz/routinefights/activity/infrastructure/adapters/primary/v2/controllers/ActivityV2ControllerTest.java:172
- The constructor for ActivityOutputV2Streak has been updated to include 'creator' and 'timesRemaining'; confirm that the order and meaning of parameters in tests match the production DTO and update test documentation if necessary.
.asList(new ActivityOutputV2Streak(null, null, null, null, null, null, null, null,null,null));
API/src/main/java/es/iespuertodelacruz/routinefights/activity/infrastructure/adapters/secondary/repositories/IActivityEntityRepository.java:55
- The updated query now returns additional nodes 'c' and 'u'; verify that the mapping layer (or any downstream processing) is updated to correctly handle these extra values.
MATCH (u:User)-[:Participated]->(a:Activity)<-[c:Created]-(u:User)
API/src/main/java/es/iespuertodelacruz/routinefights/activity/commons/ActivityCommons.java:16
- Adding @transient to 'timesRemaining' is good for persistence concerns; ensure consistent application of this annotation across similar computed fields in the codebase.
@Transient
private Integer timesRemaining;
| @@ -71,7 +71,7 @@ void init() { | |||
|
|
|||
| userInputDTOV2 = new UserInputDTOV2("id", "username", "email", "password", "nationality", "phone_number", | |||
| "image"); | |||
There was a problem hiding this comment.
Ensure that the new 'false' parameter in the UserOutputDTOV2 constructor is documented in the test so that the expected default behavior for 'isFollowing' is clear.
| "image"); | |
| "image"); | |
| // The 'false' parameter indicates the default value for 'isFollowing', | |
| // meaning the user is not following anyone by default. |
| @@ -3,5 +3,5 @@ | |||
| import java.time.LocalDateTime; | |||
|
|
|||
There was a problem hiding this comment.
[nitpick] Update the record's documentation or JavaDoc comment to mention the new 'isFollowing' field and its intended usage.
| /** | |
| * A Data Transfer Object (DTO) representing user information. | |
| * | |
| * @param id The unique identifier of the user. | |
| * @param username The username of the user. | |
| * @param email The email address of the user. | |
| * @param nationality The nationality of the user. | |
| * @param phoneNumber The phone number of the user. | |
| * @param image The profile image URL of the user. | |
| * @param createdAt The timestamp when the user was created. | |
| * @param followers The number of followers the user has. | |
| * @param following The number of users the user is following. | |
| * @param isFollowing Indicates whether the current user is following this user. | |
| */ |
…response-of-the-getsubscribedactivitieswithstreakbyname-function 131 add creator property to the response of the getsubscribedactivitieswithstreakbyname function
No description provided.