You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
Schemas
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
Additional context
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.The text was updated successfully, but these errors were encountered: