feat: Add comment, review, and like functionalities#4
Open
hungpv-3077 wants to merge 3 commits intoawesome-academy:masterfrom
Open
feat: Add comment, review, and like functionalities#4hungpv-3077 wants to merge 3 commits intoawesome-academy:masterfrom
hungpv-3077 wants to merge 3 commits intoawesome-academy:masterfrom
Conversation
- Implemented CommentResponse and CreateCommentRequest DTOs for handling comments. - Created LikeResponse DTO to manage like status and counts. - Developed CreateReviewRequest and ReviewResponse DTOs for review creation and response. - Added ReviewPageRequest DTO for pagination of reviews. - Introduced UserBasicResponse DTO for basic user information. - Updated Comment entity to associate with Review. - Modified Like entity to support likes on both Tours and Reviews. - Enhanced Review entity to manage comments and likes. - Added UnauthorizedException for handling unauthorized access. - Created CommentRepository for comment-related database operations. - Developed LikeRepository for managing likes on tours and reviews. - Implemented ReviewRepository for review-related queries. - Created CommentService to handle comment creation, deletion, and retrieval. - Developed LikeService for toggling likes on tours and reviews. - Implemented ReviewService for creating, updating, deleting, and retrieving reviews.
chienpv-3590
reviewed
Feb 3, 2026
|
|
||
| @Operation(summary = "Get comments by review", description = "Get all comments for a specific review") | ||
| @CommonApiResponses.NotFound | ||
| @GetMapping("/review/{reviewId}") |
Collaborator
There was a problem hiding this comment.
Một kiểu REST phổ biến hơn:
/api/v1/reviews/{reviewId}/comments
Tuy không bắt buộc, nhưng route theo resource cha thường dễ hiểu hơn.
|
|
||
| @Operation(summary = "Delete a comment", description = "Delete your own comment. Requires authentication.") | ||
| @CommonApiResponses.Unauthorized | ||
| @CommonApiResponses.NotFound |
Collaborator
There was a problem hiding this comment.
@CommonApiResponses.Forbidden cho endpoint “delete your own comment”
| request.getPage(), | ||
| request.getSize(), | ||
| Sort.by(direction, request.getSortBy()) | ||
| ); |
Collaborator
There was a problem hiding this comment.
PageRequest.of(page, size, Sort.by(direction, sortBy))
Gợi ý refactor:
Tạo helper private method trong controller (hoặc đưa vào ReviewPageRequest#toPageable()), tránh duplication và tránh lỗi sau này.
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.
Uh oh!
There was an error while loading. Please reload this page.