{"action":"created","comment":{"url":"https://api.github.com/repos/urfu-2016/team5/pulls/comments/112817685","pull_request_review_id":34165030,"id":112817685,"diff_hunk":"@@ -1,64 +1,56 @@\n 'use strict';\n \n const httpStatus = require('http-status-codes');\n-const baseApi = require('./baseApi');\n const passport = require('../../libs/passport');\n const User = require('../../models/user');\n const constants = require('../../constants/constants');\n+const BadRequestError = require('../../libs/customErrors/errors').BadRequestError;\n \n module.exports = {\n     signIn(req, res, next) {\n         passport.authenticate('local', (err, user) => {\n             if (!user) {\n-                res.send(constants.models.user.wrongPasswordOrNameMessage);\n-                return;\n+                return next(new BadRequestError(constants.models.user.wrongPasswordOrNameMessage));\n             }\n \n             if (req.user) {\n-                res.send(constants.controllers.auth.alreadyAuthenticated);\n-                return;\n+                return next(new BadRequestError(constants.controllers.auth.alreadyAuthenticated));\n             }\n \n-            const data = {message: constants.controllers.auth.signedInPattern(req.body.username)};\n             if (err) {\n-                return baseApi.getErrorCallback(res, httpStatus.BAD_REQUEST)(err);\n+                return next(new BadRequestError(err.message));\n             }\n \n-            req.session.user = user._id;\n-\n-            return req.logIn(user, () => baseApi.getSuccessCallback(res, httpStatus.OK)(data));\n+            return req.logIn(user, () => res\n+                .status(httpStatus.OK)\n+                .send({message: constants.controllers.auth.signedInPattern(req.body.username)})\n+            );\n         })(req, res, next);\n     },\n \n-    async signUp(req, res) {\n-        const statusCodes = {\n-            successCode: httpStatus.CREATED,\n-            failureCode: httpStatus.BAD_REQUEST\n-        };\n-\n+    async signUp(req, res, next) {\n         const userData = {\n             username: req.body.username,\n             password: req.body.password\n         };\n \n-        let callbackResult;\n         try {\n             await User.create(userData);\n-            callbackResult = () => constants.controllers.auth.signedUpPattern(req.body.username);\n+            res\n+                .status(httpStatus.CREATED)","path":"controllers/api/auth.js","position":58,"original_position":58,"commit_id":"c87a2469d063fda9cad3687ac8158c43f794e21d","original_commit_id":"c87a2469d063fda9cad3687ac8158c43f794e21d","user":{"login":"AlSoEdit","id":14929897,"avatar_url":"https://avatars2.githubusercontent.com/u/14929897?v=3","gravatar_id":"","url":"https://api.github.com/users/AlSoEdit","html_url":"https://github.com/AlSoEdit","followers_url":"https://api.github.com/users/AlSoEdit/followers","following_url":"https://api.github.com/users/AlSoEdit/following{/other_user}","gists_url":"https://api.github.com/users/AlSoEdit/gists{/gist_id}","starred_url":"https://api.github.com/users/AlSoEdit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlSoEdit/subscriptions","organizations_url":"https://api.github.com/users/AlSoEdit/orgs","repos_url":"https://api.github.com/users/AlSoEdit/repos","events_url":"https://api.github.com/users/AlSoEdit/events{/privacy}","received_events_url":"https://api.github.com/users/AlSoEdit/received_events","type":"User","site_admin":false},"body":"@dimastark ну ты аккаунт новый создаешь (регистрируешь)","created_at":"2017-04-22T20:09:32Z","updated_at":"2017-04-22T20:09:33Z","html_url":"https://github.com/urfu-2016/team5/pull/136#discussion_r112817685","pull_request_url":"https://api.github.com/repos/urfu-2016/team5/pulls/136","_links":{"self":{"href":"https://api.github.com/repos/urfu-2016/team5/pulls/comments/112817685"},"html":{"href":"https://github.com/urfu-2016/team5/pull/136#discussion_r112817685"},"pull_request":{"href":"https://api.github.com/repos/urfu-2016/team5/pulls/136"}}},"pull_request":{"url":"https://api.github.com/repos/urfu-2016/team5/pulls/136","id":116923103,"html_url":"https://github.com/urfu-2016/team5/pull/136","diff_url":"https://github.com/urfu-2016/team5/pull/136.diff","patch_url":"https://github.com/urfu-2016/team5/pull/136.patch","issue_url":"https://api.github.com/repos/urfu-2016/team5/issues/136","number":136,"state":"open","locked":false,"title":"Исправил обработку запросов в контроллерах","user":{"login":"AlSoEdit","id":14929897,"avatar_url":"https://avatars2.githubusercontent.com/u/14929897?v=3","gravatar_id":"","url":"https://api.github.com/users/AlSoEdit","html_url":"https://github.com/AlSoEdit","followers_url":"https://api.github.com/users/AlSoEdit/followers","following_url":"https://api.github.com/users/AlSoEdit/following{/other_user}","gists_url":"https://api.github.com/users/AlSoEdit/gists{/gist_id}","starred_url":"https://api.github.com/users/AlSoEdit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlSoEdit/subscriptions","organizations_url":"https://api.github.com/users/AlSoEdit/orgs","repos_url":"https://api.github.com/users/AlSoEdit/repos","events_url":"https://api.github.com/users/AlSoEdit/events{/privacy}","received_events_url":"https://api.github.com/users/AlSoEdit/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-04-21T06:59:33Z","updated_at":"2017-04-22T20:09:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fd6843b4797d48d9ffe82fc1b9e5bf91b2adcb0f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/urfu-2016/team5/pulls/136/commits","review_comments_url":"https://api.github.com/repos/urfu-2016/team5/pulls/136/comments","review_comment_url":"https://api.github.com/repos/urfu-2016/team5/pulls/comments{/number}","comments_url":"https://api.github.com/repos/urfu-2016/team5/issues/136/comments","statuses_url":"https://api.github.com/repos/urfu-2016/team5/statuses/c87a2469d063fda9cad3687ac8158c43f794e21d","head":{"label":"AlSoEdit:err-middleware","ref":"err-middleware","sha":"c87a2469d063fda9cad3687ac8158c43f794e21d","user":{"login":"AlSoEdit","id":14929897,"avatar_url":"https://avatars2.githubusercontent.com/u/14929897?v=3","gravatar_id":"","url":"https://api.github.com/users/AlSoEdit","html_url":"https://github.com/AlSoEdit","followers_url":"https://api.github.com/users/AlSoEdit/followers","following_url":"https://api.github.com/users/AlSoEdit/following{/other_user}","gists_url":"https://api.github.com/users/AlSoEdit/gists{/gist_id}","starred_url":"https://api.github.com/users/AlSoEdit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlSoEdit/subscriptions","organizations_url":"https://api.github.com/users/AlSoEdit/orgs","repos_url":"https://api.github.com/users/AlSoEdit/repos","events_url":"https://api.github.com/users/AlSoEdit/events{/privacy}","received_events_url":"https://api.github.com/users/AlSoEdit/received_events","type":"User","site_admin":false},"repo":{"id":86216197,"name":"team5","full_name":"AlSoEdit/team5","owner":{"login":"AlSoEdit","id":14929897,"avatar_url":"https://avatars2.githubusercontent.com/u/14929897?v=3","gravatar_id":"","url":"https://api.github.com/users/AlSoEdit","html_url":"https://github.com/AlSoEdit","followers_url":"https://api.github.com/users/AlSoEdit/followers","following_url":"https://api.github.com/users/AlSoEdit/following{/other_user}","gists_url":"https://api.github.com/users/AlSoEdit/gists{/gist_id}","starred_url":"https://api.github.com/users/AlSoEdit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlSoEdit/subscriptions","organizations_url":"https://api.github.com/users/AlSoEdit/orgs","repos_url":"https://api.github.com/users/AlSoEdit/repos","events_url":"https://api.github.com/users/AlSoEdit/events{/privacy}","received_events_url":"https://api.github.com/users/AlSoEdit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlSoEdit/team5","description":null,"fork":true,"url":"https://api.github.com/repos/AlSoEdit/team5","forks_url":"https://api.github.com/repos/AlSoEdit/team5/forks","keys_url":"https://api.github.com/repos/AlSoEdit/team5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlSoEdit/team5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlSoEdit/team5/teams","hooks_url":"https://api.github.com/repos/AlSoEdit/team5/hooks","issue_events_url":"https://api.github.com/repos/AlSoEdit/team5/issues/events{/number}","events_url":"https://api.github.com/repos/AlSoEdit/team5/events","assignees_url":"https://api.github.com/repos/AlSoEdit/team5/assignees{/user}","branches_url":"https://api.github.com/repos/AlSoEdit/team5/branches{/branch}","tags_url":"https://api.github.com/repos/AlSoEdit/team5/tags","blobs_url":"https://api.github.com/repos/AlSoEdit/team5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlSoEdit/team5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlSoEdit/team5/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlSoEdit/team5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlSoEdit/team5/statuses/{sha}","languages_url":"https://api.github.com/repos/AlSoEdit/team5/languages","stargazers_url":"https://api.github.com/repos/AlSoEdit/team5/stargazers","contributors_url":"https://api.github.com/repos/AlSoEdit/team5/contributors","subscribers_url":"https://api.github.com/repos/AlSoEdit/team5/subscribers","subscription_url":"https://api.github.com/repos/AlSoEdit/team5/subscription","commits_url":"https://api.github.com/repos/AlSoEdit/team5/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlSoEdit/team5/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlSoEdit/team5/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlSoEdit/team5/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlSoEdit/team5/contents/{+path}","compare_url":"https://api.github.com/repos/AlSoEdit/team5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlSoEdit/team5/merges","archive_url":"https://api.github.com/repos/AlSoEdit/team5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlSoEdit/team5/downloads","issues_url":"https://api.github.com/repos/AlSoEdit/team5/issues{/number}","pulls_url":"https://api.github.com/repos/AlSoEdit/team5/pulls{/number}","milestones_url":"https://api.github.com/repos/AlSoEdit/team5/milestones{/number}","notifications_url":"https://api.github.com/repos/AlSoEdit/team5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlSoEdit/team5/labels{/name}","releases_url":"https://api.github.com/repos/AlSoEdit/team5/releases{/id}","deployments_url":"https://api.github.com/repos/AlSoEdit/team5/deployments","created_at":"2017-03-26T07:45:33Z","updated_at":"2017-03-26T07:45:34Z","pushed_at":"2017-04-22T16:02:33Z","git_url":"git://github.com/AlSoEdit/team5.git","ssh_url":"git@github.com:AlSoEdit/team5.git","clone_url":"https://github.com/AlSoEdit/team5.git","svn_url":"https://github.com/AlSoEdit/team5","homepage":null,"size":190,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"urfu-2016:master","ref":"master","sha":"83c3bc7ec4601171cd0d1eb2891764f8fed34b4f","user":{"login":"urfu-2016","id":22170529,"avatar_url":"https://avatars3.githubusercontent.com/u/22170529?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2016","html_url":"https://github.com/urfu-2016","followers_url":"https://api.github.com/users/urfu-2016/followers","following_url":"https://api.github.com/users/urfu-2016/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2016/subscriptions","organizations_url":"https://api.github.com/users/urfu-2016/orgs","repos_url":"https://api.github.com/users/urfu-2016/repos","events_url":"https://api.github.com/users/urfu-2016/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2016/received_events","type":"Organization","site_admin":false},"repo":{"id":84701953,"name":"team5","full_name":"urfu-2016/team5","owner":{"login":"urfu-2016","id":22170529,"avatar_url":"https://avatars3.githubusercontent.com/u/22170529?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2016","html_url":"https://github.com/urfu-2016","followers_url":"https://api.github.com/users/urfu-2016/followers","following_url":"https://api.github.com/users/urfu-2016/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2016/subscriptions","organizations_url":"https://api.github.com/users/urfu-2016/orgs","repos_url":"https://api.github.com/users/urfu-2016/repos","events_url":"https://api.github.com/users/urfu-2016/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2016/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urfu-2016/team5","description":null,"fork":false,"url":"https://api.github.com/repos/urfu-2016/team5","forks_url":"https://api.github.com/repos/urfu-2016/team5/forks","keys_url":"https://api.github.com/repos/urfu-2016/team5/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urfu-2016/team5/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urfu-2016/team5/teams","hooks_url":"https://api.github.com/repos/urfu-2016/team5/hooks","issue_events_url":"https://api.github.com/repos/urfu-2016/team5/issues/events{/number}","events_url":"https://api.github.com/repos/urfu-2016/team5/events","assignees_url":"https://api.github.com/repos/urfu-2016/team5/assignees{/user}","branches_url":"https://api.github.com/repos/urfu-2016/team5/branches{/branch}","tags_url":"https://api.github.com/repos/urfu-2016/team5/tags","blobs_url":"https://api.github.com/repos/urfu-2016/team5/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urfu-2016/team5/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urfu-2016/team5/git/refs{/sha}","trees_url":"https://api.github.com/repos/urfu-2016/team5/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urfu-2016/team5/statuses/{sha}","languages_url":"https://api.github.com/repos/urfu-2016/team5/languages","stargazers_url":"https://api.github.com/repos/urfu-2016/team5/stargazers","contributors_url":"https://api.github.com/repos/urfu-2016/team5/contributors","subscribers_url":"https://api.github.com/repos/urfu-2016/team5/subscribers","subscription_url":"https://api.github.com/repos/urfu-2016/team5/subscription","commits_url":"https://api.github.com/repos/urfu-2016/team5/commits{/sha}","git_commits_url":"https://api.github.com/repos/urfu-2016/team5/git/commits{/sha}","comments_url":"https://api.github.com/repos/urfu-2016/team5/comments{/number}","issue_comment_url":"https://api.github.com/repos/urfu-2016/team5/issues/comments{/number}","contents_url":"https://api.github.com/repos/urfu-2016/team5/contents/{+path}","compare_url":"https://api.github.com/repos/urfu-2016/team5/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urfu-2016/team5/merges","archive_url":"https://api.github.com/repos/urfu-2016/team5/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urfu-2016/team5/downloads","issues_url":"https://api.github.com/repos/urfu-2016/team5/issues{/number}","pulls_url":"https://api.github.com/repos/urfu-2016/team5/pulls{/number}","milestones_url":"https://api.github.com/repos/urfu-2016/team5/milestones{/number}","notifications_url":"https://api.github.com/repos/urfu-2016/team5/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urfu-2016/team5/labels{/name}","releases_url":"https://api.github.com/repos/urfu-2016/team5/releases{/id}","deployments_url":"https://api.github.com/repos/urfu-2016/team5/deployments","created_at":"2017-03-12T05:19:24Z","updated_at":"2017-03-12T07:37:06Z","pushed_at":"2017-04-22T19:11:34Z","git_url":"git://github.com/urfu-2016/team5.git","ssh_url":"git@github.com:urfu-2016/team5.git","clone_url":"https://github.com/urfu-2016/team5.git","svn_url":"https://github.com/urfu-2016/team5","homepage":null,"size":183,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":23,"forks":6,"open_issues":23,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urfu-2016/team5/pulls/136"},"html":{"href":"https://github.com/urfu-2016/team5/pull/136"},"issue":{"href":"https://api.github.com/repos/urfu-2016/team5/issues/136"},"comments":{"href":"https://api.github.com/repos/urfu-2016/team5/issues/136/comments"},"review_comments":{"href":"https://api.github.com/repos/urfu-2016/team5/pulls/136/comments"},"review_comment":{"href":"https://api.github.com/repos/urfu-2016/team5/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/urfu-2016/team5/pulls/136/commits"},"statuses":{"href":"https://api.github.com/repos/urfu-2016/team5/statuses/c87a2469d063fda9cad3687ac8158c43f794e21d"}}}}
{"actor":{"display_login":"AlSoEdit"}}