{"action":"created","comment":{"url":"https://api.github.com/repos/andela/thor-ah/pulls/comments/216591290","pull_request_review_id":154105230,"id":216591290,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNjU5MTI5MA==","diff_hunk":"@@ -0,0 +1,167 @@\n+import db from '../models';\n+\n+const { Article, LikesDislikes } = db;\n+\n+/**\n+ * @class likeDislike\n+ */\n+class likesDislikesController {\n+  /**\n+   * @desc Like an article\n+   * @param {obj} req request body\n+   * @param {obj} res response body\n+   * @param {obj} next next action\n+   * @return {obj} returns an object\n+   */\n+  static likeOrDislike(req, res, next) {\n+    const { articleSlug } = req.params;\n+    const { userId } = req;\n+    const { reaction } = req.body;\n+\n+    if (!articleSlug || articleSlug.trim().length < 1) {\n+      return res.status(400).json({\n+        status: 'error',\n+        message: 'Please provide a valid article slug.',\n+      });\n+    }\n+\n+    if (!reaction || reaction.trim().length < 1) {\n+      return res.status(400).json({\n+        status: 'error',\n+        message: 'Please provide a valid reaction .',","path":"server/controllers/likeDislike.js","position":31,"original_position":31,"commit_id":"fdbc184a4efcccc0cdd01ba7e852ff8e524078cf","original_commit_id":"fdbc184a4efcccc0cdd01ba7e852ff8e524078cf","user":{"login":"aknwosu","id":24938070,"node_id":"MDQ6VXNlcjI0OTM4MDcw","avatar_url":"https://avatars3.githubusercontent.com/u/24938070?v=4","gravatar_id":"","url":"https://api.github.com/users/aknwosu","html_url":"https://github.com/aknwosu","followers_url":"https://api.github.com/users/aknwosu/followers","following_url":"https://api.github.com/users/aknwosu/following{/other_user}","gists_url":"https://api.github.com/users/aknwosu/gists{/gist_id}","starred_url":"https://api.github.com/users/aknwosu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aknwosu/subscriptions","organizations_url":"https://api.github.com/users/aknwosu/orgs","repos_url":"https://api.github.com/users/aknwosu/repos","events_url":"https://api.github.com/users/aknwosu/events{/privacy}","received_events_url":"https://api.github.com/users/aknwosu/received_events","type":"User","site_admin":false},"body":"        message: 'No reaction provided.',\r\n","created_at":"2018-09-11T08:48:54Z","updated_at":"2018-09-11T08:48:55Z","html_url":"https://github.com/andela/thor-ah/pull/39#discussion_r216591290","pull_request_url":"https://api.github.com/repos/andela/thor-ah/pulls/39","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/comments/216591290"},"html":{"href":"https://github.com/andela/thor-ah/pull/39#discussion_r216591290"},"pull_request":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/andela/thor-ah/pulls/39","id":214381101,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0MzgxMTAx","html_url":"https://github.com/andela/thor-ah/pull/39","diff_url":"https://github.com/andela/thor-ah/pull/39.diff","patch_url":"https://github.com/andela/thor-ah/pull/39.patch","issue_url":"https://api.github.com/repos/andela/thor-ah/issues/39","number":39,"state":"open","locked":false,"title":"#159987708 Like and dislike functionality","user":{"login":"iamuchejude","id":38435631,"node_id":"MDQ6VXNlcjM4NDM1NjMx","avatar_url":"https://avatars2.githubusercontent.com/u/38435631?v=4","gravatar_id":"","url":"https://api.github.com/users/iamuchejude","html_url":"https://github.com/iamuchejude","followers_url":"https://api.github.com/users/iamuchejude/followers","following_url":"https://api.github.com/users/iamuchejude/following{/other_user}","gists_url":"https://api.github.com/users/iamuchejude/gists{/gist_id}","starred_url":"https://api.github.com/users/iamuchejude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iamuchejude/subscriptions","organizations_url":"https://api.github.com/users/iamuchejude/orgs","repos_url":"https://api.github.com/users/iamuchejude/repos","events_url":"https://api.github.com/users/iamuchejude/events{/privacy}","received_events_url":"https://api.github.com/users/iamuchejude/received_events","type":"User","site_admin":false},"body":"### What does this PR do?\r\nAdd like and dislike feature for articles\r\n\r\n### Description of the task?\r\n* Create endpoints for like and dislike functionality\r\n* Create endpoint to get rating/reactions for an article\r\n* Write relevant test for like and dislike feature\r\n\r\n### How to manually test\r\n* Clone the repository\r\n* cd to `thor-ah`\r\n* Setup postgres database\r\n* Create `.env` using the format in `.env.sample`\r\n* Run `npm install`\r\n* Run `npm run start:dev`\r\n* Test the following endpoints using postman or any other available alternative software\r\n**POST**  /api/articles/:article_slug/reactions\r\n**GET** /api/articles/:article_slug/reactions \r\n\r\n### What are the relevant Pivotal Tracker Story?\r\n[#159987708](https://www.pivotaltracker.com/story/show/159987708)","created_at":"2018-09-10T17:01:06Z","updated_at":"2018-09-11T08:48:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"445053fb1a5dfd257e038b496921dbca18454aa9","assignee":null,"assignees":[],"requested_reviewers":[{"login":"ozezzy","id":40201026,"node_id":"MDQ6VXNlcjQwMjAxMDI2","avatar_url":"https://avatars3.githubusercontent.com/u/40201026?v=4","gravatar_id":"","url":"https://api.github.com/users/ozezzy","html_url":"https://github.com/ozezzy","followers_url":"https://api.github.com/users/ozezzy/followers","following_url":"https://api.github.com/users/ozezzy/following{/other_user}","gists_url":"https://api.github.com/users/ozezzy/gists{/gist_id}","starred_url":"https://api.github.com/users/ozezzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ozezzy/subscriptions","organizations_url":"https://api.github.com/users/ozezzy/orgs","repos_url":"https://api.github.com/users/ozezzy/repos","events_url":"https://api.github.com/users/ozezzy/events{/privacy}","received_events_url":"https://api.github.com/users/ozezzy/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/andela/thor-ah/pulls/39/commits","review_comments_url":"https://api.github.com/repos/andela/thor-ah/pulls/39/comments","review_comment_url":"https://api.github.com/repos/andela/thor-ah/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela/thor-ah/issues/39/comments","statuses_url":"https://api.github.com/repos/andela/thor-ah/statuses/fdbc184a4efcccc0cdd01ba7e852ff8e524078cf","head":{"label":"andela:ft-article-like-and-dislike-159987708","ref":"ft-article-like-and-dislike-159987708","sha":"fdbc184a4efcccc0cdd01ba7e852ff8e524078cf","user":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":145831905,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU4MzE5MDU=","name":"thor-ah","full_name":"andela/thor-ah","owner":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/thor-ah","description":"Staging Link for Author's Haven ","fork":false,"url":"https://api.github.com/repos/andela/thor-ah","forks_url":"https://api.github.com/repos/andela/thor-ah/forks","keys_url":"https://api.github.com/repos/andela/thor-ah/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/thor-ah/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/thor-ah/teams","hooks_url":"https://api.github.com/repos/andela/thor-ah/hooks","issue_events_url":"https://api.github.com/repos/andela/thor-ah/issues/events{/number}","events_url":"https://api.github.com/repos/andela/thor-ah/events","assignees_url":"https://api.github.com/repos/andela/thor-ah/assignees{/user}","branches_url":"https://api.github.com/repos/andela/thor-ah/branches{/branch}","tags_url":"https://api.github.com/repos/andela/thor-ah/tags","blobs_url":"https://api.github.com/repos/andela/thor-ah/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/thor-ah/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/thor-ah/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/thor-ah/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/thor-ah/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/thor-ah/languages","stargazers_url":"https://api.github.com/repos/andela/thor-ah/stargazers","contributors_url":"https://api.github.com/repos/andela/thor-ah/contributors","subscribers_url":"https://api.github.com/repos/andela/thor-ah/subscribers","subscription_url":"https://api.github.com/repos/andela/thor-ah/subscription","commits_url":"https://api.github.com/repos/andela/thor-ah/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/thor-ah/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/thor-ah/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/thor-ah/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/thor-ah/contents/{+path}","compare_url":"https://api.github.com/repos/andela/thor-ah/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/thor-ah/merges","archive_url":"https://api.github.com/repos/andela/thor-ah/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/thor-ah/downloads","issues_url":"https://api.github.com/repos/andela/thor-ah/issues{/number}","pulls_url":"https://api.github.com/repos/andela/thor-ah/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/thor-ah/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/thor-ah/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/thor-ah/labels{/name}","releases_url":"https://api.github.com/repos/andela/thor-ah/releases{/id}","deployments_url":"https://api.github.com/repos/andela/thor-ah/deployments","created_at":"2018-08-23T09:31:23Z","updated_at":"2018-09-10T18:17:43Z","pushed_at":"2018-09-11T08:44:10Z","git_url":"git://github.com/andela/thor-ah.git","ssh_url":"git@github.com:andela/thor-ah.git","clone_url":"https://github.com/andela/thor-ah.git","svn_url":"https://github.com/andela/thor-ah","homepage":"https://thor-ah-staging.herokuapp.com/","size":273,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":1,"open_issues":3,"watchers":5,"default_branch":"develop"}},"base":{"label":"andela:develop","ref":"develop","sha":"8d2c5c61caa04295299af035b9d6e34e087ae47e","user":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":145831905,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU4MzE5MDU=","name":"thor-ah","full_name":"andela/thor-ah","owner":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/thor-ah","description":"Staging Link for Author's Haven ","fork":false,"url":"https://api.github.com/repos/andela/thor-ah","forks_url":"https://api.github.com/repos/andela/thor-ah/forks","keys_url":"https://api.github.com/repos/andela/thor-ah/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/thor-ah/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/thor-ah/teams","hooks_url":"https://api.github.com/repos/andela/thor-ah/hooks","issue_events_url":"https://api.github.com/repos/andela/thor-ah/issues/events{/number}","events_url":"https://api.github.com/repos/andela/thor-ah/events","assignees_url":"https://api.github.com/repos/andela/thor-ah/assignees{/user}","branches_url":"https://api.github.com/repos/andela/thor-ah/branches{/branch}","tags_url":"https://api.github.com/repos/andela/thor-ah/tags","blobs_url":"https://api.github.com/repos/andela/thor-ah/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/thor-ah/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/thor-ah/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/thor-ah/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/thor-ah/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/thor-ah/languages","stargazers_url":"https://api.github.com/repos/andela/thor-ah/stargazers","contributors_url":"https://api.github.com/repos/andela/thor-ah/contributors","subscribers_url":"https://api.github.com/repos/andela/thor-ah/subscribers","subscription_url":"https://api.github.com/repos/andela/thor-ah/subscription","commits_url":"https://api.github.com/repos/andela/thor-ah/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/thor-ah/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/thor-ah/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/thor-ah/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/thor-ah/contents/{+path}","compare_url":"https://api.github.com/repos/andela/thor-ah/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/thor-ah/merges","archive_url":"https://api.github.com/repos/andela/thor-ah/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/thor-ah/downloads","issues_url":"https://api.github.com/repos/andela/thor-ah/issues{/number}","pulls_url":"https://api.github.com/repos/andela/thor-ah/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/thor-ah/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/thor-ah/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/thor-ah/labels{/name}","releases_url":"https://api.github.com/repos/andela/thor-ah/releases{/id}","deployments_url":"https://api.github.com/repos/andela/thor-ah/deployments","created_at":"2018-08-23T09:31:23Z","updated_at":"2018-09-10T18:17:43Z","pushed_at":"2018-09-11T08:44:10Z","git_url":"git://github.com/andela/thor-ah.git","ssh_url":"git@github.com:andela/thor-ah.git","clone_url":"https://github.com/andela/thor-ah.git","svn_url":"https://github.com/andela/thor-ah","homepage":"https://thor-ah-staging.herokuapp.com/","size":273,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":1,"open_issues":3,"watchers":5,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/39"},"html":{"href":"https://github.com/andela/thor-ah/pull/39"},"issue":{"href":"https://api.github.com/repos/andela/thor-ah/issues/39"},"comments":{"href":"https://api.github.com/repos/andela/thor-ah/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/andela/thor-ah/statuses/fdbc184a4efcccc0cdd01ba7e852ff8e524078cf"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"aknwosu"}}