-
Notifications
You must be signed in to change notification settings - Fork 6
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
#165273480 Add user like and or dislike article #18
#165273480 Add user like and or dislike article #18
Conversation
bf57fcc
to
82eaa46
Compare
82eaa46
to
5a04cc2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a job well done.
I think having two separate test methods with the same data one testing a status code and the other testing response message is lengthy. Testing both in the same method would do the job
I was able to like and dislike the same article, I think it should be only one of the two. |
@KabohaJeanMark Look into your logic to check when one likes an article and then dislikes it. The likes_count for the article doesn't decrease and ensure the like is removed and vice versa. |
@KabohaJeanMark The feedback should given for Likes should also be applied to the dislikes class. Go through your logic to confirm its working as expected. |
@KabohaJeanMark Fix the endpoints provided in the description. |
5a04cc2
to
c2a4064
Compare
c2a4064
to
c5ed665
Compare
c5ed665
to
35d59d5
Compare
caef875
to
ea2936b
Compare
ea2936b
to
8b2c5b1
Compare
8b2c5b1
to
f556969
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested it and it worked.
f556969
to
c4f6baf
Compare
c4f6baf
to
b336487
Compare
b336487
to
300296e
Compare
300296e
to
58540a9
Compare
58540a9
to
dcf4963
Compare
- Add user like article - Add count in article to increment when liked - Add validation for user not liking same article twice [Starts #165273480]
dcf4963
to
d2cfcaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KabohaJeanMark LGTM I am merging this.
What does this PR do?
It enables a user who has logged in to be able to like and or dislike their own or other people's articles
Tasks
How to test out this PR?
Log in a user and go to access the following endpoints while passing the token in the header for existing articles to either like or dislike them.
Endpoints
/api/article/<article_id>/like
Likes a specific article by its id/api/article/<article_id>/dislike
Dislikes specific article/api/article/<article_id>
To check the article @ fields likes_count, dislikes_countLike an article
There is no data in the request body.
The following is the expected response body.
The expected response if you try to like the same article twice
If the article is not found, this is the expected response body,
For disliking, the expected responses are similar. Simply expect dislike in the space of like
This then reduces the count in the article attribute likes_count
View article like count after like
![Screen Shot 2019-05-01 at 7 00 47 PM](https://user-images.githubusercontent.com/44635784/57026865-7c910c00-6c43-11e9-8e9f-d9f52f4547b1.png)
The image below is from when you search article by id. View likes_count field.
/api/article/<article_id>/
To view articleIf the user hits like endpoint then immediately hits dislike endpoint, the expected response is
[Starts #165273480]