Skip to content

Comment Likes and Views count #93

@bryanwong8

Description

@bryanwong8

Is your feature request related to a problem? Please describe.
We need to build a feature to like a comment. We also need a way to keep track of the number of times an article is viewed.

Models

Article

  • Add a views column. It should be an integer with the default of 0.

Comment

  • Add a liking system to comments. It should be very similar to Article likes.
  • Should be creating a many to many association with Comments and Profiles

Schemas

  • Edit the Comment schema to include the likes
  • Edit the Article schema to include the views

API Routes

Endpoints | HTTP Method | Description | Tested
/api/articles/{{slug}} | Get | The view count should increase each time this is called |
/api/comments/{{commentId}}/favorite | POST | Add the user to the comment's favorites relationship |

Create/Edit Functions

get_article

  • Each time function is called, add 1 to the view count.

favorite_a_comment

  • Should query for the comment and profile. If they both exist then add the profile to the comment's favorite

Additional context

  • Adjust the article tests in the backend/tests/test_articles.py file. Some of them don't currently pass. So adjust the routes or tests accordingly to make sure that they work.

Metadata

Metadata

Assignees

Labels

backendThis is a backend issuestagingIssue merged into staging

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions