Skip to content

Comments

feat: Add comment, review, and like functionalities#4

Open
hungpv-3077 wants to merge 3 commits intoawesome-academy:masterfrom
hungpv-3077:feat/review_comment_likes
Open

feat: Add comment, review, and like functionalities#4
hungpv-3077 wants to merge 3 commits intoawesome-academy:masterfrom
hungpv-3077:feat/review_comment_likes

Conversation

@hungpv-3077
Copy link
Contributor

@hungpv-3077 hungpv-3077 commented Feb 2, 2026

  • 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.
image image image image image

- 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.
@hungpv-3077 hungpv-3077 marked this pull request as draft February 3, 2026 02:16
@hungpv-3077 hungpv-3077 marked this pull request as ready for review February 3, 2026 02:16

@Operation(summary = "Get comments by review", description = "Get all comments for a specific review")
@CommonApiResponses.NotFound
@GetMapping("/review/{reviewId}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

@CommonApiResponses.Forbidden cho endpoint “delete your own comment”

request.getPage(),
request.getSize(),
Sort.by(direction, request.getSortBy())
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

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.

2 participants