123 like a post#127
Merged
Merged
Conversation
Closed
There was a problem hiding this comment.
Pull Request Overview
This PR adds new functionality to support liking and unliking posts throughout the user-related modules. Key changes include:
- New service methods and repository queries for likePost and unLikePost.
- Additional tests covering both successful and exceptional cases.
- New endpoints in the UserControllerV2 to expose the like/unlike features.
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| API/src/test/java/es/iespuertodelacruz/routinefights/user/infrastructure/adapters/secondary/services/UserEntityServiceTest.java | Added tests for like and unlike post, including exception scenarios. |
| API/src/test/java/es/iespuertodelacruz/routinefights/user/infrastructure/adapters/primary/v2/controllers/UserControllerV2Test.java | Added tests for new controller endpoints covering like/unlike operations and exception handling. |
| API/src/test/java/es/iespuertodelacruz/routinefights/user/domain/services/UserServiceTest.java | Added tests to verify service layer support for like/unlike operations. |
| API/src/main/java/es/iespuertodelacruz/routinefights/user/infrastructure/adapters/secondary/services/UserEntityService.java | Implemented likePost and unLikePost with exception handling. |
| API/src/main/java/es/iespuertodelacruz/routinefights/user/infrastructure/adapters/secondary/repositories/IUserEntityRepository.java | Added repository queries for likePost and unLikePost. |
| API/src/main/java/es/iespuertodelacruz/routinefights/user/infrastructure/adapters/primary/v2/controllers/UserControllerV2.java | Introduced endpoints for like and unlike post with security constraints. |
| API/src/main/java/es/iespuertodelacruz/routinefights/user/domain/services/UserService.java | Added service methods delegating to repository for like/unlike functionality. |
| API/src/main/java/es/iespuertodelacruz/routinefights/user/common/IUserCommon.java | Updated common interface to include like/unlike operations. |
Files not reviewed (1)
- API/src/main/resources/graphql/schema.graphqls: Language not supported
Comments suppressed due to low confidence (2)
API/src/main/java/es/iespuertodelacruz/routinefights/user/infrastructure/adapters/secondary/services/UserEntityService.java:389
- [nitpick] Consider using consistent camelCase naming (e.g. 'unlikePost' instead of 'unLikePost') across the codebase to improve readability.
public Boolean unLikePost(String userId, String postId) {
API/src/main/java/es/iespuertodelacruz/routinefights/user/infrastructure/adapters/secondary/repositories/IUserEntityRepository.java:49
- [nitpick] Consider aligning parameter naming with lowerCamelCase (e.g. 'userId' and 'postId') to maintain consistency with the service layer.
@Query("MATCH (u: User) MATCH (p: Post) WHERE elementId(p) = $postID AND elementId(u) = $userID MERGE (u)-[:Liked]->(p) RETURN exists((u)-[:Liked]->(p))")
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.
No description provided.