Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Implement Product Review and Star Rating Feature #1284

Open
Jhaemis-hack opened this issue Feb 28, 2025 · 0 comments
Open

[FEAT] Implement Product Review and Star Rating Feature #1284

Jhaemis-hack opened this issue Feb 28, 2025 · 0 comments
Assignees
Labels
feature In-progress This issue is being worked on

Comments

@Jhaemis-hack
Copy link
Contributor

Jhaemis-hack commented Feb 28, 2025

Description

The ProductsController currently lacks support for product reviews, star ratings, and comments. This limits user engagement and prevents customers from leaving valuable feedback directly on products.

This feature will allow authenticated users to:

  • Submit or update a review with a star rating (1-5) and review text.
  • Post comments on a product for open-ended discussion.
  • View existing reviews, average rating, and recent comments when retrieving product details.

This will enhance user experience, increase transparency, and provide organizations with actionable feedback to improve their products.

Acceptance Criteria

  • Add new POST endpoints for:
    • Submitting or updating a review (rating + review text).
    • Posting a comment on a product.
  • Add a DELETE endpoint for removing a user’s review.
  • Enhance the existing GET product details endpoint to include:
    • average_rating
    • total_reviews
    • Recent comments and reviews.
  • Apply authentication rules: only the review owner can modify or delete a review.
  • Document all new endpoints in Swagger, including request/response examples.
  • Update the response structure to follow standard API format (status, message, data).

Purpose

This enhancement serves to:

  • Enable customers to leave meaningful feedback on products.
  • Display real user reviews and ratings, increasing product credibility.
  • Foster open discussions through product comments.
  • Collect structured feedback for product improvement.
  • Align with best practices for modern product catalog APIs.

Requirements

Controller Enhancements

Method Endpoint Purpose
POST /organisations/{orgId}/products/{productId}/reviews Submit or update a review
DELETE /organisations/{orgId}/products/{productId}/reviews Delete a user’s review
POST /organisations/{orgId}/products/{productId}/comments Post a comment
GET /organisations/{orgId}/products/{productId}/reviews Fetch all reviews for a product
GET /organisations/{orgId}/products/{productId} Retrieve product details (now with reviews & comments)

⚙️ Expected Outcomes

Example Response - Review Creation

{
    "status": "success",
    "status_code": 200,
    "message": "Product details retrieved successfully",
    "data": {
        "product": {
            "id": "product-789",
            "name": "Smartphone X",
            "description": "The latest smartphone with cutting-edge features.",
            "average_rating": 4.5,
            "total_reviews": 120,
            "recent_reviews": [
                {
                    "rating": 5,
                    "review": "Fantastic product!",
                    "created_by": "user-123",
                    "created_at": "2025-02-24T15:30:00Z"
                },
                {
                    "rating": 3,
                    "review": "Good but could be improved.",
                    "created_by": "user-456",
                    "created_at": "2025-02-23T11:15:00Z"
                }
            ],
            "recent_comments": [
                {
                    "comment": "Does this come with a warranty?",
                    "created_by": "user-789",
                    "created_at": "2025-02-24T17:00:00Z"
                }
            ]
        }
    }
}

## Additional Considerations
Optional: Notify product owners/admins when a new review or comment is added.
Optional: Add review helpfulness voting to further improve feedback quality.
Optional: Add reporting of inappropriate reviews/comments for moderation.
@Jhaemis-hack Jhaemis-hack changed the title [FEAT] Implement Product Review, Star Rating, and Comment Feature [FEAT] Implement Product Review and Star Rating Feature Feb 28, 2025
@github-project-automation github-project-automation bot moved this to Backlogs in Boilerplate-TS Feb 28, 2025
@AdeGneus AdeGneus moved this from Backlogs to Mentors Approved in Boilerplate-TS Feb 28, 2025
@AdeGneus AdeGneus added the In-progress This issue is being worked on label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature In-progress This issue is being worked on
Projects
Status: Mentors Approved
Development

No branches or pull requests

2 participants