{"action":"created","comment":{"url":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/comments/137721727","pull_request_review_id":61426012,"id":137721727,"diff_hunk":"@@ -1,16 +1,58 @@\n+import validator from 'validatorjs';\n import models from '../models';\n \n+\n const Votes = models.Votes,\n   Users = models.Users,\n   Recipes = models.Recipes;\n+const idRules = {\n+  recipeId: 'integer',\n+  userId: 'interger,'\n+}\n \n const VotingController = {\n-  upVote(req,res){\n-\n+  upVotes(req,res){\n+    const idValidator = new validator(req.params, idRules);\n+    if (idValidator.passes()){\n+      return Recipes.findOne({\n+        where: {\n+          id: req.params.recipeId,\n+        }\n+      }).then(recipe => {\n+        if (Object.getOwnPropertyNames(recipe).length === 0){\n+          return res.status(404).json({message: 'Recipe does not exist!'});\n+        }\n+        recipe.increment('upVotes');\n+        res.status(200).json({message: 'Recipe updated Successfully'})\n+      }).catch(err => {\n+        res.status(400).json({message: err});\n+      });\n+    }\n+    else {\n+      res.status(400).json({message: 'Error'})\n+    }\n   },\n \n   downVote(req, res){\n-\n+    const idValidator = new validator(req.params, idRules);\n+    if (idValidator.passes()){\n+      return Recipes.findOne({\n+        where: {\n+          id: req.params.recipeId,\n+        }","path":"server/controllers/votesContr.js","position":22,"original_position":45,"commit_id":"1043224f0ce4772108641ab0267f3e81b1390f9a","original_commit_id":"1043224f0ce4772108641ab0267f3e81b1390f9a","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Missing trailing comma                                                               comma-dangle","created_at":"2017-09-08T07:04:11Z","updated_at":"2017-09-08T07:04:12Z","html_url":"https://github.com/JaphethCA/More-recipe/pull/5#discussion_r137721727","pull_request_url":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/5","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/comments/137721727"},"html":{"href":"https://github.com/JaphethCA/More-recipe/pull/5#discussion_r137721727"},"pull_request":{"href":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/5","id":139968188,"html_url":"https://github.com/JaphethCA/More-recipe/pull/5","diff_url":"https://github.com/JaphethCA/More-recipe/pull/5.diff","patch_url":"https://github.com/JaphethCA/More-recipe/pull/5.patch","issue_url":"https://api.github.com/repos/JaphethCA/More-recipe/issues/5","number":5,"state":"open","locked":false,"title":"Feat user upvotes and downvotes endpoint 150574931","user":{"login":"JaphethCA","id":31279497,"avatar_url":"https://avatars0.githubusercontent.com/u/31279497?v=4","gravatar_id":"","url":"https://api.github.com/users/JaphethCA","html_url":"https://github.com/JaphethCA","followers_url":"https://api.github.com/users/JaphethCA/followers","following_url":"https://api.github.com/users/JaphethCA/following{/other_user}","gists_url":"https://api.github.com/users/JaphethCA/gists{/gist_id}","starred_url":"https://api.github.com/users/JaphethCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JaphethCA/subscriptions","organizations_url":"https://api.github.com/users/JaphethCA/orgs","repos_url":"https://api.github.com/users/JaphethCA/repos","events_url":"https://api.github.com/users/JaphethCA/events{/privacy}","received_events_url":"https://api.github.com/users/JaphethCA/received_events","type":"User","site_admin":false},"body":"#   What​ ​ does​ ​ this​ ​ PR​ ​ do​ ?\r\nAdded upvote and downvotes endpoints including the controller to handle the request. This endpoint will enable users to vote for a single recipe and user the votes endponts.\r\n## ​​ ​ Description​ ​ of​ ​ Task​ ​ to​ ​ be​ ​ completed?\r\nUser should be able to access the following end points\r\n` PUT /recipes/:recipeId/upvotes`\r\n`PUT /recipes/:recipeId/downvotes`\r\n\r\n##  ​ How​ ​ should​ ​ this​ ​ be​ ​ manually​ ​ tested?\r\nCan be tested using POSTMAN or \r\nby running `mocha --compilers js:babel-register`\r\n\r\n##  ​ Any​ ​ background​ ​ context​ ​ you​ ​ want​ ​ to​ ​ provide?\r\n\r\n## ​​ ​ What​ ​ are​ ​ the​ ​ relevant​ ​ pivotal​ ​ tracker​ ​ stories?\r\n150574931-users should be able to navigate API to access content\r\n\r\n###​​ ​ Screenshots​ ​ ( ​ if​​ ​ appropriate)\r\n\r\n####​​ ​ Questions:","created_at":"2017-09-08T07:03:53Z","updated_at":"2017-09-08T07:04:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"90c2403c952b45d0f85797c2a0ec710d4900bb66","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/5/commits","review_comments_url":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/5/comments","review_comment_url":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JaphethCA/More-recipe/issues/5/comments","statuses_url":"https://api.github.com/repos/JaphethCA/More-recipe/statuses/1043224f0ce4772108641ab0267f3e81b1390f9a","head":{"label":"JaphethCA:ft-user-upvotes-downvotes-endpoint-150574931","ref":"ft-user-upvotes-downvotes-endpoint-150574931","sha":"1043224f0ce4772108641ab0267f3e81b1390f9a","user":{"login":"JaphethCA","id":31279497,"avatar_url":"https://avatars0.githubusercontent.com/u/31279497?v=4","gravatar_id":"","url":"https://api.github.com/users/JaphethCA","html_url":"https://github.com/JaphethCA","followers_url":"https://api.github.com/users/JaphethCA/followers","following_url":"https://api.github.com/users/JaphethCA/following{/other_user}","gists_url":"https://api.github.com/users/JaphethCA/gists{/gist_id}","starred_url":"https://api.github.com/users/JaphethCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JaphethCA/subscriptions","organizations_url":"https://api.github.com/users/JaphethCA/orgs","repos_url":"https://api.github.com/users/JaphethCA/repos","events_url":"https://api.github.com/users/JaphethCA/events{/privacy}","received_events_url":"https://api.github.com/users/JaphethCA/received_events","type":"User","site_admin":false},"repo":{"id":101438985,"name":"More-recipe","full_name":"JaphethCA/More-recipe","owner":{"login":"JaphethCA","id":31279497,"avatar_url":"https://avatars0.githubusercontent.com/u/31279497?v=4","gravatar_id":"","url":"https://api.github.com/users/JaphethCA","html_url":"https://github.com/JaphethCA","followers_url":"https://api.github.com/users/JaphethCA/followers","following_url":"https://api.github.com/users/JaphethCA/following{/other_user}","gists_url":"https://api.github.com/users/JaphethCA/gists{/gist_id}","starred_url":"https://api.github.com/users/JaphethCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JaphethCA/subscriptions","organizations_url":"https://api.github.com/users/JaphethCA/orgs","repos_url":"https://api.github.com/users/JaphethCA/repos","events_url":"https://api.github.com/users/JaphethCA/events{/privacy}","received_events_url":"https://api.github.com/users/JaphethCA/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JaphethCA/More-recipe","description":"More-Recipes​ ​provides​ ​a​ ​platform​ ​for​ ​users​ ​to​ ​share​ ​the​ ​awesome​ ​and​ ​exciting​ ​​ ​recipe​ ​ideas​ ​they have​ ​invented​ ​or​ ​learnt.","fork":false,"url":"https://api.github.com/repos/JaphethCA/More-recipe","forks_url":"https://api.github.com/repos/JaphethCA/More-recipe/forks","keys_url":"https://api.github.com/repos/JaphethCA/More-recipe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JaphethCA/More-recipe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JaphethCA/More-recipe/teams","hooks_url":"https://api.github.com/repos/JaphethCA/More-recipe/hooks","issue_events_url":"https://api.github.com/repos/JaphethCA/More-recipe/issues/events{/number}","events_url":"https://api.github.com/repos/JaphethCA/More-recipe/events","assignees_url":"https://api.github.com/repos/JaphethCA/More-recipe/assignees{/user}","branches_url":"https://api.github.com/repos/JaphethCA/More-recipe/branches{/branch}","tags_url":"https://api.github.com/repos/JaphethCA/More-recipe/tags","blobs_url":"https://api.github.com/repos/JaphethCA/More-recipe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JaphethCA/More-recipe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JaphethCA/More-recipe/git/refs{/sha}","trees_url":"https://api.github.com/repos/JaphethCA/More-recipe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JaphethCA/More-recipe/statuses/{sha}","languages_url":"https://api.github.com/repos/JaphethCA/More-recipe/languages","stargazers_url":"https://api.github.com/repos/JaphethCA/More-recipe/stargazers","contributors_url":"https://api.github.com/repos/JaphethCA/More-recipe/contributors","subscribers_url":"https://api.github.com/repos/JaphethCA/More-recipe/subscribers","subscription_url":"https://api.github.com/repos/JaphethCA/More-recipe/subscription","commits_url":"https://api.github.com/repos/JaphethCA/More-recipe/commits{/sha}","git_commits_url":"https://api.github.com/repos/JaphethCA/More-recipe/git/commits{/sha}","comments_url":"https://api.github.com/repos/JaphethCA/More-recipe/comments{/number}","issue_comment_url":"https://api.github.com/repos/JaphethCA/More-recipe/issues/comments{/number}","contents_url":"https://api.github.com/repos/JaphethCA/More-recipe/contents/{+path}","compare_url":"https://api.github.com/repos/JaphethCA/More-recipe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JaphethCA/More-recipe/merges","archive_url":"https://api.github.com/repos/JaphethCA/More-recipe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JaphethCA/More-recipe/downloads","issues_url":"https://api.github.com/repos/JaphethCA/More-recipe/issues{/number}","pulls_url":"https://api.github.com/repos/JaphethCA/More-recipe/pulls{/number}","milestones_url":"https://api.github.com/repos/JaphethCA/More-recipe/milestones{/number}","notifications_url":"https://api.github.com/repos/JaphethCA/More-recipe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JaphethCA/More-recipe/labels{/name}","releases_url":"https://api.github.com/repos/JaphethCA/More-recipe/releases{/id}","deployments_url":"https://api.github.com/repos/JaphethCA/More-recipe/deployments","created_at":"2017-08-25T20:14:43Z","updated_at":"2017-09-06T22:48:31Z","pushed_at":"2017-09-08T07:03:54Z","git_url":"git://github.com/JaphethCA/More-recipe.git","ssh_url":"git@github.com:JaphethCA/More-recipe.git","clone_url":"https://github.com/JaphethCA/More-recipe.git","svn_url":"https://github.com/JaphethCA/More-recipe","homepage":null,"size":508,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"staging"}},"base":{"label":"JaphethCA:ft-user-rest-api-150574931","ref":"ft-user-rest-api-150574931","sha":"8b1d4f32789e4a0b0381748b412d1434ec37c13e","user":{"login":"JaphethCA","id":31279497,"avatar_url":"https://avatars0.githubusercontent.com/u/31279497?v=4","gravatar_id":"","url":"https://api.github.com/users/JaphethCA","html_url":"https://github.com/JaphethCA","followers_url":"https://api.github.com/users/JaphethCA/followers","following_url":"https://api.github.com/users/JaphethCA/following{/other_user}","gists_url":"https://api.github.com/users/JaphethCA/gists{/gist_id}","starred_url":"https://api.github.com/users/JaphethCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JaphethCA/subscriptions","organizations_url":"https://api.github.com/users/JaphethCA/orgs","repos_url":"https://api.github.com/users/JaphethCA/repos","events_url":"https://api.github.com/users/JaphethCA/events{/privacy}","received_events_url":"https://api.github.com/users/JaphethCA/received_events","type":"User","site_admin":false},"repo":{"id":101438985,"name":"More-recipe","full_name":"JaphethCA/More-recipe","owner":{"login":"JaphethCA","id":31279497,"avatar_url":"https://avatars0.githubusercontent.com/u/31279497?v=4","gravatar_id":"","url":"https://api.github.com/users/JaphethCA","html_url":"https://github.com/JaphethCA","followers_url":"https://api.github.com/users/JaphethCA/followers","following_url":"https://api.github.com/users/JaphethCA/following{/other_user}","gists_url":"https://api.github.com/users/JaphethCA/gists{/gist_id}","starred_url":"https://api.github.com/users/JaphethCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JaphethCA/subscriptions","organizations_url":"https://api.github.com/users/JaphethCA/orgs","repos_url":"https://api.github.com/users/JaphethCA/repos","events_url":"https://api.github.com/users/JaphethCA/events{/privacy}","received_events_url":"https://api.github.com/users/JaphethCA/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JaphethCA/More-recipe","description":"More-Recipes​ ​provides​ ​a​ ​platform​ ​for​ ​users​ ​to​ ​share​ ​the​ ​awesome​ ​and​ ​exciting​ ​​ ​recipe​ ​ideas​ ​they have​ ​invented​ ​or​ ​learnt.","fork":false,"url":"https://api.github.com/repos/JaphethCA/More-recipe","forks_url":"https://api.github.com/repos/JaphethCA/More-recipe/forks","keys_url":"https://api.github.com/repos/JaphethCA/More-recipe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JaphethCA/More-recipe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JaphethCA/More-recipe/teams","hooks_url":"https://api.github.com/repos/JaphethCA/More-recipe/hooks","issue_events_url":"https://api.github.com/repos/JaphethCA/More-recipe/issues/events{/number}","events_url":"https://api.github.com/repos/JaphethCA/More-recipe/events","assignees_url":"https://api.github.com/repos/JaphethCA/More-recipe/assignees{/user}","branches_url":"https://api.github.com/repos/JaphethCA/More-recipe/branches{/branch}","tags_url":"https://api.github.com/repos/JaphethCA/More-recipe/tags","blobs_url":"https://api.github.com/repos/JaphethCA/More-recipe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JaphethCA/More-recipe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JaphethCA/More-recipe/git/refs{/sha}","trees_url":"https://api.github.com/repos/JaphethCA/More-recipe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JaphethCA/More-recipe/statuses/{sha}","languages_url":"https://api.github.com/repos/JaphethCA/More-recipe/languages","stargazers_url":"https://api.github.com/repos/JaphethCA/More-recipe/stargazers","contributors_url":"https://api.github.com/repos/JaphethCA/More-recipe/contributors","subscribers_url":"https://api.github.com/repos/JaphethCA/More-recipe/subscribers","subscription_url":"https://api.github.com/repos/JaphethCA/More-recipe/subscription","commits_url":"https://api.github.com/repos/JaphethCA/More-recipe/commits{/sha}","git_commits_url":"https://api.github.com/repos/JaphethCA/More-recipe/git/commits{/sha}","comments_url":"https://api.github.com/repos/JaphethCA/More-recipe/comments{/number}","issue_comment_url":"https://api.github.com/repos/JaphethCA/More-recipe/issues/comments{/number}","contents_url":"https://api.github.com/repos/JaphethCA/More-recipe/contents/{+path}","compare_url":"https://api.github.com/repos/JaphethCA/More-recipe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JaphethCA/More-recipe/merges","archive_url":"https://api.github.com/repos/JaphethCA/More-recipe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JaphethCA/More-recipe/downloads","issues_url":"https://api.github.com/repos/JaphethCA/More-recipe/issues{/number}","pulls_url":"https://api.github.com/repos/JaphethCA/More-recipe/pulls{/number}","milestones_url":"https://api.github.com/repos/JaphethCA/More-recipe/milestones{/number}","notifications_url":"https://api.github.com/repos/JaphethCA/More-recipe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JaphethCA/More-recipe/labels{/name}","releases_url":"https://api.github.com/repos/JaphethCA/More-recipe/releases{/id}","deployments_url":"https://api.github.com/repos/JaphethCA/More-recipe/deployments","created_at":"2017-08-25T20:14:43Z","updated_at":"2017-09-06T22:48:31Z","pushed_at":"2017-09-08T07:03:54Z","git_url":"git://github.com/JaphethCA/More-recipe.git","ssh_url":"git@github.com:JaphethCA/More-recipe.git","clone_url":"https://github.com/JaphethCA/More-recipe.git","svn_url":"https://github.com/JaphethCA/More-recipe","homepage":null,"size":508,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/5"},"html":{"href":"https://github.com/JaphethCA/More-recipe/pull/5"},"issue":{"href":"https://api.github.com/repos/JaphethCA/More-recipe/issues/5"},"comments":{"href":"https://api.github.com/repos/JaphethCA/More-recipe/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JaphethCA/More-recipe/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/JaphethCA/More-recipe/statuses/1043224f0ce4772108641ab0267f3e81b1390f9a"}},"author_association":"OWNER"}}
{"actor":{"display_login":"houndci-bot"}}