Skip to content

131 add creator property to the response of the getsubscribedactivitieswithstreakbyname function#134

Merged
JonayKB merged 5 commits into
mainfrom
131-add-creator-property-to-the-response-of-the-getsubscribedactivitieswithstreakbyname-function
May 6, 2025
Merged

131 add creator property to the response of the getsubscribedactivitieswithstreakbyname function#134
JonayKB merged 5 commits into
mainfrom
131-add-creator-property-to-the-response-of-the-getsubscribedactivitieswithstreakbyname-function

Conversation

@JonayKB
Copy link
Copy Markdown
Owner

@JonayKB JonayKB commented May 6, 2025

No description provided.

@JonayKB JonayKB requested review from Copilot and rabgonzalez May 6, 2025 20:25
@JonayKB JonayKB merged commit fa82a3c into main May 6, 2025
3 checks passed
Copy link
Copy Markdown

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 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");
Copy link

Copilot AI May 6, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
"image");
"image");
// The 'false' parameter indicates the default value for 'isFollowing',
// meaning the user is not following anyone by default.

Copilot uses AI. Check for mistakes.
@@ -3,5 +3,5 @@
import java.time.LocalDateTime;

Copy link

Copilot AI May 6, 2025

Choose a reason for hiding this comment

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

[nitpick] Update the record's documentation or JavaDoc comment to mention the new 'isFollowing' field and its intended usage.

Suggested change
/**
* 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.
*/

Copilot uses AI. Check for mistakes.
JonayKB added a commit that referenced this pull request Jan 24, 2026
…response-of-the-getsubscribedactivitieswithstreakbyname-function

131 add creator property to the response of the getsubscribedactivitieswithstreakbyname function
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.

Add creator property to the response of the "getSubscribedActivitiesWithStreakByName" function

2 participants