Skip to content

VER-181: [Backend] Add like_count and dislike_count to API responses for get_snippets and get_snippet #150

@nhphong

Description

@nhphong

As a developer, I want the get_snippets and get_snippet API endpoints to include like_count and dislike_count for each snippet, so that the frontend can display the number of likes and dislikes for each snippet to the users.

Acceptance Criteria:

  1. Update the get_snippets API endpoint to include like_count and dislike_count in the response for each snippet.
  2. Update the get_snippet API endpoint to include like_count and dislike_count in the response for the specific snippet.
  3. Ensure that the like_count accurately reflects the total number of likes each snippet has received.
  4. Ensure that the dislike_count accurately reflects the total number of dislikes each snippet has received.
  5. The API documentation is updated to reflect the changes in the response structure.
  6. Existing tests are updated to accommodate the new fields, and new tests are added to verify the correctness of like_count and dislike_count.
  7. Verify that the frontend displays the like_count and dislike_count correctly for each snippet using mock API responses.

Notes:

  • Consider potential performance impacts of adding these counts and optimize queries if necessary.
  • Coordinate with the frontend team to ensure they are aware of the changes and update any relevant UI components.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions