{"action":"created","comment":{"url":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/comments/196202721","pull_request_review_id":129707092,"id":196202721,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjIwMjcyMQ==","diff_hunk":"@@ -34,3 +38,38 @@ exports.newUser = (req, res, next) => {\n       });\n   }\n };\n+\n+exports.signIn = (req, res, next) => {\n+  const credentials = req.body\n+    ? {\n+        password: req.body.password,\n+        email: req.body.email\n+      }\n+    : {};\n+\n+  const errMsg = validation.validateSignIn(credentials);\n+  if (errMsg.length > 0) {\n+    next(errors.invalidUser(errMsg));\n+  } else {\n+    return User.getOneWhere(['email', 'password'], { email: credentials.email })\n+      .then(user => {\n+        if (user) {\n+          return bcrypt.compare(credentials.password, user.password).then(bool => {\n+            if (bool) {","path":"app/controllers/user.js","position":51,"original_position":51,"commit_id":"d133bb2265917760a4e487b069878c4e4feca51e","original_commit_id":"d133bb2265917760a4e487b069878c4e4feca51e","user":{"login":"mpicollo-wolox","id":36853148,"node_id":"MDQ6VXNlcjM2ODUzMTQ4","avatar_url":"https://avatars0.githubusercontent.com/u/36853148?v=4","gravatar_id":"","url":"https://api.github.com/users/mpicollo-wolox","html_url":"https://github.com/mpicollo-wolox","followers_url":"https://api.github.com/users/mpicollo-wolox/followers","following_url":"https://api.github.com/users/mpicollo-wolox/following{/other_user}","gists_url":"https://api.github.com/users/mpicollo-wolox/gists{/gist_id}","starred_url":"https://api.github.com/users/mpicollo-wolox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpicollo-wolox/subscriptions","organizations_url":"https://api.github.com/users/mpicollo-wolox/orgs","repos_url":"https://api.github.com/users/mpicollo-wolox/repos","events_url":"https://api.github.com/users/mpicollo-wolox/events{/privacy}","received_events_url":"https://api.github.com/users/mpicollo-wolox/received_events","type":"User","site_admin":false},"body":"Add some declaritivity to variable names ","created_at":"2018-06-18T19:50:01Z","updated_at":"2018-06-18T19:56:59Z","html_url":"https://github.com/wolox-training/fj-express-js/pull/7#discussion_r196202721","pull_request_url":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/7","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/comments/196202721"},"html":{"href":"https://github.com/wolox-training/fj-express-js/pull/7#discussion_r196202721"},"pull_request":{"href":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/7","id":195618422,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1NjE4NDIy","html_url":"https://github.com/wolox-training/fj-express-js/pull/7","diff_url":"https://github.com/wolox-training/fj-express-js/pull/7.diff","patch_url":"https://github.com/wolox-training/fj-express-js/pull/7.patch","issue_url":"https://api.github.com/repos/wolox-training/fj-express-js/issues/7","number":7,"state":"open","locked":false,"title":"User Sign in with token validation","user":{"login":"Frankiesc","id":22779400,"node_id":"MDQ6VXNlcjIyNzc5NDAw","avatar_url":"https://avatars2.githubusercontent.com/u/22779400?v=4","gravatar_id":"","url":"https://api.github.com/users/Frankiesc","html_url":"https://github.com/Frankiesc","followers_url":"https://api.github.com/users/Frankiesc/followers","following_url":"https://api.github.com/users/Frankiesc/following{/other_user}","gists_url":"https://api.github.com/users/Frankiesc/gists{/gist_id}","starred_url":"https://api.github.com/users/Frankiesc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Frankiesc/subscriptions","organizations_url":"https://api.github.com/users/Frankiesc/orgs","repos_url":"https://api.github.com/users/Frankiesc/repos","events_url":"https://api.github.com/users/Frankiesc/events{/privacy}","received_events_url":"https://api.github.com/users/Frankiesc/received_events","type":"User","site_admin":false},"body":"## Summary\r\nAdded /users/sessions endpoint functionality, where an email/password pair is validated against the db and if successful, a token is produced and sent in the response header. Also added the necessary tests.\r\n\r\n## Known Issues\r\nNone\r\n\r\n## Trello Card\r\nhttps://trello.com/c/y1pKxp8u/3-sign-in\r\n","created_at":"2018-06-18T19:02:24Z","updated_at":"2018-06-18T19:56:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be9ee96075c74a23d3af01cb421f4c9dd35d409a","assignee":{"login":"Frankiesc","id":22779400,"node_id":"MDQ6VXNlcjIyNzc5NDAw","avatar_url":"https://avatars2.githubusercontent.com/u/22779400?v=4","gravatar_id":"","url":"https://api.github.com/users/Frankiesc","html_url":"https://github.com/Frankiesc","followers_url":"https://api.github.com/users/Frankiesc/followers","following_url":"https://api.github.com/users/Frankiesc/following{/other_user}","gists_url":"https://api.github.com/users/Frankiesc/gists{/gist_id}","starred_url":"https://api.github.com/users/Frankiesc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Frankiesc/subscriptions","organizations_url":"https://api.github.com/users/Frankiesc/orgs","repos_url":"https://api.github.com/users/Frankiesc/repos","events_url":"https://api.github.com/users/Frankiesc/events{/privacy}","received_events_url":"https://api.github.com/users/Frankiesc/received_events","type":"User","site_admin":false},"assignees":[{"login":"Frankiesc","id":22779400,"node_id":"MDQ6VXNlcjIyNzc5NDAw","avatar_url":"https://avatars2.githubusercontent.com/u/22779400?v=4","gravatar_id":"","url":"https://api.github.com/users/Frankiesc","html_url":"https://github.com/Frankiesc","followers_url":"https://api.github.com/users/Frankiesc/followers","following_url":"https://api.github.com/users/Frankiesc/following{/other_user}","gists_url":"https://api.github.com/users/Frankiesc/gists{/gist_id}","starred_url":"https://api.github.com/users/Frankiesc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Frankiesc/subscriptions","organizations_url":"https://api.github.com/users/Frankiesc/orgs","repos_url":"https://api.github.com/users/Frankiesc/repos","events_url":"https://api.github.com/users/Frankiesc/events{/privacy}","received_events_url":"https://api.github.com/users/Frankiesc/received_events","type":"User","site_admin":false},{"login":"mpicollo-wolox","id":36853148,"node_id":"MDQ6VXNlcjM2ODUzMTQ4","avatar_url":"https://avatars0.githubusercontent.com/u/36853148?v=4","gravatar_id":"","url":"https://api.github.com/users/mpicollo-wolox","html_url":"https://github.com/mpicollo-wolox","followers_url":"https://api.github.com/users/mpicollo-wolox/followers","following_url":"https://api.github.com/users/mpicollo-wolox/following{/other_user}","gists_url":"https://api.github.com/users/mpicollo-wolox/gists{/gist_id}","starred_url":"https://api.github.com/users/mpicollo-wolox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpicollo-wolox/subscriptions","organizations_url":"https://api.github.com/users/mpicollo-wolox/orgs","repos_url":"https://api.github.com/users/mpicollo-wolox/repos","events_url":"https://api.github.com/users/mpicollo-wolox/events{/privacy}","received_events_url":"https://api.github.com/users/mpicollo-wolox/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/7/commits","review_comments_url":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/7/comments","review_comment_url":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wolox-training/fj-express-js/issues/7/comments","statuses_url":"https://api.github.com/repos/wolox-training/fj-express-js/statuses/d133bb2265917760a4e487b069878c4e4feca51e","head":{"label":"wolox-training:token-session","ref":"token-session","sha":"d133bb2265917760a4e487b069878c4e4feca51e","user":{"login":"wolox-training","id":14113351,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTEzMzUx","avatar_url":"https://avatars1.githubusercontent.com/u/14113351?v=4","gravatar_id":"","url":"https://api.github.com/users/wolox-training","html_url":"https://github.com/wolox-training","followers_url":"https://api.github.com/users/wolox-training/followers","following_url":"https://api.github.com/users/wolox-training/following{/other_user}","gists_url":"https://api.github.com/users/wolox-training/gists{/gist_id}","starred_url":"https://api.github.com/users/wolox-training/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolox-training/subscriptions","organizations_url":"https://api.github.com/users/wolox-training/orgs","repos_url":"https://api.github.com/users/wolox-training/repos","events_url":"https://api.github.com/users/wolox-training/events{/privacy}","received_events_url":"https://api.github.com/users/wolox-training/received_events","type":"Organization","site_admin":false},"repo":{"id":133713421,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM3MTM0MjE=","name":"fj-express-js","full_name":"wolox-training/fj-express-js","owner":{"login":"wolox-training","id":14113351,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTEzMzUx","avatar_url":"https://avatars1.githubusercontent.com/u/14113351?v=4","gravatar_id":"","url":"https://api.github.com/users/wolox-training","html_url":"https://github.com/wolox-training","followers_url":"https://api.github.com/users/wolox-training/followers","following_url":"https://api.github.com/users/wolox-training/following{/other_user}","gists_url":"https://api.github.com/users/wolox-training/gists{/gist_id}","starred_url":"https://api.github.com/users/wolox-training/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolox-training/subscriptions","organizations_url":"https://api.github.com/users/wolox-training/orgs","repos_url":"https://api.github.com/users/wolox-training/repos","events_url":"https://api.github.com/users/wolox-training/events{/privacy}","received_events_url":"https://api.github.com/users/wolox-training/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wolox-training/fj-express-js","description":null,"fork":false,"url":"https://api.github.com/repos/wolox-training/fj-express-js","forks_url":"https://api.github.com/repos/wolox-training/fj-express-js/forks","keys_url":"https://api.github.com/repos/wolox-training/fj-express-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wolox-training/fj-express-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wolox-training/fj-express-js/teams","hooks_url":"https://api.github.com/repos/wolox-training/fj-express-js/hooks","issue_events_url":"https://api.github.com/repos/wolox-training/fj-express-js/issues/events{/number}","events_url":"https://api.github.com/repos/wolox-training/fj-express-js/events","assignees_url":"https://api.github.com/repos/wolox-training/fj-express-js/assignees{/user}","branches_url":"https://api.github.com/repos/wolox-training/fj-express-js/branches{/branch}","tags_url":"https://api.github.com/repos/wolox-training/fj-express-js/tags","blobs_url":"https://api.github.com/repos/wolox-training/fj-express-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wolox-training/fj-express-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wolox-training/fj-express-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/wolox-training/fj-express-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wolox-training/fj-express-js/statuses/{sha}","languages_url":"https://api.github.com/repos/wolox-training/fj-express-js/languages","stargazers_url":"https://api.github.com/repos/wolox-training/fj-express-js/stargazers","contributors_url":"https://api.github.com/repos/wolox-training/fj-express-js/contributors","subscribers_url":"https://api.github.com/repos/wolox-training/fj-express-js/subscribers","subscription_url":"https://api.github.com/repos/wolox-training/fj-express-js/subscription","commits_url":"https://api.github.com/repos/wolox-training/fj-express-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/wolox-training/fj-express-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/wolox-training/fj-express-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/wolox-training/fj-express-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/wolox-training/fj-express-js/contents/{+path}","compare_url":"https://api.github.com/repos/wolox-training/fj-express-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wolox-training/fj-express-js/merges","archive_url":"https://api.github.com/repos/wolox-training/fj-express-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wolox-training/fj-express-js/downloads","issues_url":"https://api.github.com/repos/wolox-training/fj-express-js/issues{/number}","pulls_url":"https://api.github.com/repos/wolox-training/fj-express-js/pulls{/number}","milestones_url":"https://api.github.com/repos/wolox-training/fj-express-js/milestones{/number}","notifications_url":"https://api.github.com/repos/wolox-training/fj-express-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wolox-training/fj-express-js/labels{/name}","releases_url":"https://api.github.com/repos/wolox-training/fj-express-js/releases{/id}","deployments_url":"https://api.github.com/repos/wolox-training/fj-express-js/deployments","created_at":"2018-05-16T19:23:57Z","updated_at":"2018-06-18T15:59:29Z","pushed_at":"2018-06-18T19:17:42Z","git_url":"git://github.com/wolox-training/fj-express-js.git","ssh_url":"git@github.com:wolox-training/fj-express-js.git","clone_url":"https://github.com/wolox-training/fj-express-js.git","svn_url":"https://github.com/wolox-training/fj-express-js","homepage":null,"size":157,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"wolox-training:master","ref":"master","sha":"e475ae04ea962e0af5835e924356ebcf5a0c4387","user":{"login":"wolox-training","id":14113351,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTEzMzUx","avatar_url":"https://avatars1.githubusercontent.com/u/14113351?v=4","gravatar_id":"","url":"https://api.github.com/users/wolox-training","html_url":"https://github.com/wolox-training","followers_url":"https://api.github.com/users/wolox-training/followers","following_url":"https://api.github.com/users/wolox-training/following{/other_user}","gists_url":"https://api.github.com/users/wolox-training/gists{/gist_id}","starred_url":"https://api.github.com/users/wolox-training/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolox-training/subscriptions","organizations_url":"https://api.github.com/users/wolox-training/orgs","repos_url":"https://api.github.com/users/wolox-training/repos","events_url":"https://api.github.com/users/wolox-training/events{/privacy}","received_events_url":"https://api.github.com/users/wolox-training/received_events","type":"Organization","site_admin":false},"repo":{"id":133713421,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM3MTM0MjE=","name":"fj-express-js","full_name":"wolox-training/fj-express-js","owner":{"login":"wolox-training","id":14113351,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTEzMzUx","avatar_url":"https://avatars1.githubusercontent.com/u/14113351?v=4","gravatar_id":"","url":"https://api.github.com/users/wolox-training","html_url":"https://github.com/wolox-training","followers_url":"https://api.github.com/users/wolox-training/followers","following_url":"https://api.github.com/users/wolox-training/following{/other_user}","gists_url":"https://api.github.com/users/wolox-training/gists{/gist_id}","starred_url":"https://api.github.com/users/wolox-training/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolox-training/subscriptions","organizations_url":"https://api.github.com/users/wolox-training/orgs","repos_url":"https://api.github.com/users/wolox-training/repos","events_url":"https://api.github.com/users/wolox-training/events{/privacy}","received_events_url":"https://api.github.com/users/wolox-training/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wolox-training/fj-express-js","description":null,"fork":false,"url":"https://api.github.com/repos/wolox-training/fj-express-js","forks_url":"https://api.github.com/repos/wolox-training/fj-express-js/forks","keys_url":"https://api.github.com/repos/wolox-training/fj-express-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wolox-training/fj-express-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wolox-training/fj-express-js/teams","hooks_url":"https://api.github.com/repos/wolox-training/fj-express-js/hooks","issue_events_url":"https://api.github.com/repos/wolox-training/fj-express-js/issues/events{/number}","events_url":"https://api.github.com/repos/wolox-training/fj-express-js/events","assignees_url":"https://api.github.com/repos/wolox-training/fj-express-js/assignees{/user}","branches_url":"https://api.github.com/repos/wolox-training/fj-express-js/branches{/branch}","tags_url":"https://api.github.com/repos/wolox-training/fj-express-js/tags","blobs_url":"https://api.github.com/repos/wolox-training/fj-express-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wolox-training/fj-express-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wolox-training/fj-express-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/wolox-training/fj-express-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wolox-training/fj-express-js/statuses/{sha}","languages_url":"https://api.github.com/repos/wolox-training/fj-express-js/languages","stargazers_url":"https://api.github.com/repos/wolox-training/fj-express-js/stargazers","contributors_url":"https://api.github.com/repos/wolox-training/fj-express-js/contributors","subscribers_url":"https://api.github.com/repos/wolox-training/fj-express-js/subscribers","subscription_url":"https://api.github.com/repos/wolox-training/fj-express-js/subscription","commits_url":"https://api.github.com/repos/wolox-training/fj-express-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/wolox-training/fj-express-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/wolox-training/fj-express-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/wolox-training/fj-express-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/wolox-training/fj-express-js/contents/{+path}","compare_url":"https://api.github.com/repos/wolox-training/fj-express-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wolox-training/fj-express-js/merges","archive_url":"https://api.github.com/repos/wolox-training/fj-express-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wolox-training/fj-express-js/downloads","issues_url":"https://api.github.com/repos/wolox-training/fj-express-js/issues{/number}","pulls_url":"https://api.github.com/repos/wolox-training/fj-express-js/pulls{/number}","milestones_url":"https://api.github.com/repos/wolox-training/fj-express-js/milestones{/number}","notifications_url":"https://api.github.com/repos/wolox-training/fj-express-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wolox-training/fj-express-js/labels{/name}","releases_url":"https://api.github.com/repos/wolox-training/fj-express-js/releases{/id}","deployments_url":"https://api.github.com/repos/wolox-training/fj-express-js/deployments","created_at":"2018-05-16T19:23:57Z","updated_at":"2018-06-18T15:59:29Z","pushed_at":"2018-06-18T19:17:42Z","git_url":"git://github.com/wolox-training/fj-express-js.git","ssh_url":"git@github.com:wolox-training/fj-express-js.git","clone_url":"https://github.com/wolox-training/fj-express-js.git","svn_url":"https://github.com/wolox-training/fj-express-js","homepage":null,"size":157,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/7"},"html":{"href":"https://github.com/wolox-training/fj-express-js/pull/7"},"issue":{"href":"https://api.github.com/repos/wolox-training/fj-express-js/issues/7"},"comments":{"href":"https://api.github.com/repos/wolox-training/fj-express-js/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wolox-training/fj-express-js/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/wolox-training/fj-express-js/statuses/d133bb2265917760a4e487b069878c4e4feca51e"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"mpicollo-wolox"}}