{"action":"created","comment":{"url":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/comments/156835223","pull_request_review_id":83377321,"id":156835223,"diff_hunk":"@@ -0,0 +1,154 @@\n+import moment from 'moment';\n+import jwt from 'jsonwebtoken';\n+import nodeMailer from 'nodemailer';\n+import model from '../models';\n+import util from '../utils/limits';\n+\n+require('dotenv').config();\n+\n+const secret = process.env.SECRET;\n+const mailPassword = process.env.PASSWORD;\n+const borrowedBookModel = model.borrowedbook;\n+const bookModel = model.book;\n+\n+/**\n+ * \n+ * @param {object} req -Request object \n+ * @param {object} res - Response object\n+ * @returns { object} - returns an object\n+ */\n+class Helper {\n+  /** \n+ * @param { object } req request object\n+ * @param { object } res response object\n+ * @param { object } next passes action to following controller\n+ * @returns { object } books with count and rows\n+ */\n+  static checkBook(req, res, next) {\n+    bookModel.findById(parseInt(req.body.bookid, 10))\n+      .then((book) => {\n+        if (!book) return res.status(404).send({ msg: 'Book not found' });\n+        if (!book.dataValues.quantity) return res.status('404').json({ msg: 'This book is currently unavailable' });\n+        req.book = book;\n+        next();\n+      })\n+      .catch(error => res.status(500).json({ msg: error }));\n+  }\n+\n+  /** \n+ * @param { object } req \n+ * @param { object } res\n+ * @param { object } next\n+ * @returns { object } books with count and rows\n+ * ","path":"server/middleware/helper.js","position":43,"original_position":43,"commit_id":"3412b1c269d80a0f6960f847bbbc46fb7249cfef","original_commit_id":"3412b1c269d80a0f6960f847bbbc46fb7249cfef","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":"Trailing spaces not allowed                                         no-trailing-spaces","created_at":"2017-12-14T01:46:49Z","updated_at":"2017-12-14T01:46:50Z","html_url":"https://github.com/BalogunDell/HelloBooks/pull/93#discussion_r156835223","pull_request_url":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/93","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/comments/156835223"},"html":{"href":"https://github.com/BalogunDell/HelloBooks/pull/93#discussion_r156835223"},"pull_request":{"href":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/93"}}},"pull_request":{"url":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/93","id":151105847,"html_url":"https://github.com/BalogunDell/HelloBooks/pull/93","diff_url":"https://github.com/BalogunDell/HelloBooks/pull/93.diff","patch_url":"https://github.com/BalogunDell/HelloBooks/pull/93.patch","issue_url":"https://api.github.com/repos/BalogunDell/HelloBooks/issues/93","number":93,"state":"open","locked":false,"title":"Code Review","user":{"login":"BalogunDell","id":24609423,"avatar_url":"https://avatars1.githubusercontent.com/u/24609423?v=4","gravatar_id":"","url":"https://api.github.com/users/BalogunDell","html_url":"https://github.com/BalogunDell","followers_url":"https://api.github.com/users/BalogunDell/followers","following_url":"https://api.github.com/users/BalogunDell/following{/other_user}","gists_url":"https://api.github.com/users/BalogunDell/gists{/gist_id}","starred_url":"https://api.github.com/users/BalogunDell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BalogunDell/subscriptions","organizations_url":"https://api.github.com/users/BalogunDell/orgs","repos_url":"https://api.github.com/users/BalogunDell/repos","events_url":"https://api.github.com/users/BalogunDell/events{/privacy}","received_events_url":"https://api.github.com/users/BalogunDell/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-11-07T12:54:41Z","updated_at":"2017-12-14T01:46:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7d1a41a027025aef704933e118fafeb996ffb995","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/93/commits","review_comments_url":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/93/comments","review_comment_url":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BalogunDell/HelloBooks/issues/93/comments","statuses_url":"https://api.github.com/repos/BalogunDell/HelloBooks/statuses/3412b1c269d80a0f6960f847bbbc46fb7249cfef","head":{"label":"BalogunDell:develop","ref":"develop","sha":"3412b1c269d80a0f6960f847bbbc46fb7249cfef","user":{"login":"BalogunDell","id":24609423,"avatar_url":"https://avatars1.githubusercontent.com/u/24609423?v=4","gravatar_id":"","url":"https://api.github.com/users/BalogunDell","html_url":"https://github.com/BalogunDell","followers_url":"https://api.github.com/users/BalogunDell/followers","following_url":"https://api.github.com/users/BalogunDell/following{/other_user}","gists_url":"https://api.github.com/users/BalogunDell/gists{/gist_id}","starred_url":"https://api.github.com/users/BalogunDell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BalogunDell/subscriptions","organizations_url":"https://api.github.com/users/BalogunDell/orgs","repos_url":"https://api.github.com/users/BalogunDell/repos","events_url":"https://api.github.com/users/BalogunDell/events{/privacy}","received_events_url":"https://api.github.com/users/BalogunDell/received_events","type":"User","site_admin":false},"repo":{"id":98496358,"name":"HelloBooks","full_name":"BalogunDell/HelloBooks","owner":{"login":"BalogunDell","id":24609423,"avatar_url":"https://avatars1.githubusercontent.com/u/24609423?v=4","gravatar_id":"","url":"https://api.github.com/users/BalogunDell","html_url":"https://github.com/BalogunDell","followers_url":"https://api.github.com/users/BalogunDell/followers","following_url":"https://api.github.com/users/BalogunDell/following{/other_user}","gists_url":"https://api.github.com/users/BalogunDell/gists{/gist_id}","starred_url":"https://api.github.com/users/BalogunDell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BalogunDell/subscriptions","organizations_url":"https://api.github.com/users/BalogunDell/orgs","repos_url":"https://api.github.com/users/BalogunDell/repos","events_url":"https://api.github.com/users/BalogunDell/events{/privacy}","received_events_url":"https://api.github.com/users/BalogunDell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BalogunDell/HelloBooks","description":"Hello-Books is a simple application that helps manage a library and its processes like stocking, tracking and renting books.","fork":false,"url":"https://api.github.com/repos/BalogunDell/HelloBooks","forks_url":"https://api.github.com/repos/BalogunDell/HelloBooks/forks","keys_url":"https://api.github.com/repos/BalogunDell/HelloBooks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BalogunDell/HelloBooks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BalogunDell/HelloBooks/teams","hooks_url":"https://api.github.com/repos/BalogunDell/HelloBooks/hooks","issue_events_url":"https://api.github.com/repos/BalogunDell/HelloBooks/issues/events{/number}","events_url":"https://api.github.com/repos/BalogunDell/HelloBooks/events","assignees_url":"https://api.github.com/repos/BalogunDell/HelloBooks/assignees{/user}","branches_url":"https://api.github.com/repos/BalogunDell/HelloBooks/branches{/branch}","tags_url":"https://api.github.com/repos/BalogunDell/HelloBooks/tags","blobs_url":"https://api.github.com/repos/BalogunDell/HelloBooks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BalogunDell/HelloBooks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BalogunDell/HelloBooks/git/refs{/sha}","trees_url":"https://api.github.com/repos/BalogunDell/HelloBooks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BalogunDell/HelloBooks/statuses/{sha}","languages_url":"https://api.github.com/repos/BalogunDell/HelloBooks/languages","stargazers_url":"https://api.github.com/repos/BalogunDell/HelloBooks/stargazers","contributors_url":"https://api.github.com/repos/BalogunDell/HelloBooks/contributors","subscribers_url":"https://api.github.com/repos/BalogunDell/HelloBooks/subscribers","subscription_url":"https://api.github.com/repos/BalogunDell/HelloBooks/subscription","commits_url":"https://api.github.com/repos/BalogunDell/HelloBooks/commits{/sha}","git_commits_url":"https://api.github.com/repos/BalogunDell/HelloBooks/git/commits{/sha}","comments_url":"https://api.github.com/repos/BalogunDell/HelloBooks/comments{/number}","issue_comment_url":"https://api.github.com/repos/BalogunDell/HelloBooks/issues/comments{/number}","contents_url":"https://api.github.com/repos/BalogunDell/HelloBooks/contents/{+path}","compare_url":"https://api.github.com/repos/BalogunDell/HelloBooks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BalogunDell/HelloBooks/merges","archive_url":"https://api.github.com/repos/BalogunDell/HelloBooks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BalogunDell/HelloBooks/downloads","issues_url":"https://api.github.com/repos/BalogunDell/HelloBooks/issues{/number}","pulls_url":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls{/number}","milestones_url":"https://api.github.com/repos/BalogunDell/HelloBooks/milestones{/number}","notifications_url":"https://api.github.com/repos/BalogunDell/HelloBooks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BalogunDell/HelloBooks/labels{/name}","releases_url":"https://api.github.com/repos/BalogunDell/HelloBooks/releases{/id}","deployments_url":"https://api.github.com/repos/BalogunDell/HelloBooks/deployments","created_at":"2017-07-27T05:13:49Z","updated_at":"2017-12-14T01:42:42Z","pushed_at":"2017-12-14T01:46:04Z","git_url":"git://github.com/BalogunDell/HelloBooks.git","ssh_url":"git@github.com:BalogunDell/HelloBooks.git","clone_url":"https://github.com/BalogunDell/HelloBooks.git","svn_url":"https://github.com/BalogunDell/HelloBooks","homepage":"https://hellobooksapp.herokuapp.com/","size":15768,"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":1,"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"},"forks":1,"open_issues":1,"watchers":1,"default_branch":"develop"}},"base":{"label":"BalogunDell:master","ref":"master","sha":"e788f349bfd6f7dc65846fc7a5aa5c9f6e29aa32","user":{"login":"BalogunDell","id":24609423,"avatar_url":"https://avatars1.githubusercontent.com/u/24609423?v=4","gravatar_id":"","url":"https://api.github.com/users/BalogunDell","html_url":"https://github.com/BalogunDell","followers_url":"https://api.github.com/users/BalogunDell/followers","following_url":"https://api.github.com/users/BalogunDell/following{/other_user}","gists_url":"https://api.github.com/users/BalogunDell/gists{/gist_id}","starred_url":"https://api.github.com/users/BalogunDell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BalogunDell/subscriptions","organizations_url":"https://api.github.com/users/BalogunDell/orgs","repos_url":"https://api.github.com/users/BalogunDell/repos","events_url":"https://api.github.com/users/BalogunDell/events{/privacy}","received_events_url":"https://api.github.com/users/BalogunDell/received_events","type":"User","site_admin":false},"repo":{"id":98496358,"name":"HelloBooks","full_name":"BalogunDell/HelloBooks","owner":{"login":"BalogunDell","id":24609423,"avatar_url":"https://avatars1.githubusercontent.com/u/24609423?v=4","gravatar_id":"","url":"https://api.github.com/users/BalogunDell","html_url":"https://github.com/BalogunDell","followers_url":"https://api.github.com/users/BalogunDell/followers","following_url":"https://api.github.com/users/BalogunDell/following{/other_user}","gists_url":"https://api.github.com/users/BalogunDell/gists{/gist_id}","starred_url":"https://api.github.com/users/BalogunDell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BalogunDell/subscriptions","organizations_url":"https://api.github.com/users/BalogunDell/orgs","repos_url":"https://api.github.com/users/BalogunDell/repos","events_url":"https://api.github.com/users/BalogunDell/events{/privacy}","received_events_url":"https://api.github.com/users/BalogunDell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BalogunDell/HelloBooks","description":"Hello-Books is a simple application that helps manage a library and its processes like stocking, tracking and renting books.","fork":false,"url":"https://api.github.com/repos/BalogunDell/HelloBooks","forks_url":"https://api.github.com/repos/BalogunDell/HelloBooks/forks","keys_url":"https://api.github.com/repos/BalogunDell/HelloBooks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BalogunDell/HelloBooks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BalogunDell/HelloBooks/teams","hooks_url":"https://api.github.com/repos/BalogunDell/HelloBooks/hooks","issue_events_url":"https://api.github.com/repos/BalogunDell/HelloBooks/issues/events{/number}","events_url":"https://api.github.com/repos/BalogunDell/HelloBooks/events","assignees_url":"https://api.github.com/repos/BalogunDell/HelloBooks/assignees{/user}","branches_url":"https://api.github.com/repos/BalogunDell/HelloBooks/branches{/branch}","tags_url":"https://api.github.com/repos/BalogunDell/HelloBooks/tags","blobs_url":"https://api.github.com/repos/BalogunDell/HelloBooks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BalogunDell/HelloBooks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BalogunDell/HelloBooks/git/refs{/sha}","trees_url":"https://api.github.com/repos/BalogunDell/HelloBooks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BalogunDell/HelloBooks/statuses/{sha}","languages_url":"https://api.github.com/repos/BalogunDell/HelloBooks/languages","stargazers_url":"https://api.github.com/repos/BalogunDell/HelloBooks/stargazers","contributors_url":"https://api.github.com/repos/BalogunDell/HelloBooks/contributors","subscribers_url":"https://api.github.com/repos/BalogunDell/HelloBooks/subscribers","subscription_url":"https://api.github.com/repos/BalogunDell/HelloBooks/subscription","commits_url":"https://api.github.com/repos/BalogunDell/HelloBooks/commits{/sha}","git_commits_url":"https://api.github.com/repos/BalogunDell/HelloBooks/git/commits{/sha}","comments_url":"https://api.github.com/repos/BalogunDell/HelloBooks/comments{/number}","issue_comment_url":"https://api.github.com/repos/BalogunDell/HelloBooks/issues/comments{/number}","contents_url":"https://api.github.com/repos/BalogunDell/HelloBooks/contents/{+path}","compare_url":"https://api.github.com/repos/BalogunDell/HelloBooks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BalogunDell/HelloBooks/merges","archive_url":"https://api.github.com/repos/BalogunDell/HelloBooks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BalogunDell/HelloBooks/downloads","issues_url":"https://api.github.com/repos/BalogunDell/HelloBooks/issues{/number}","pulls_url":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls{/number}","milestones_url":"https://api.github.com/repos/BalogunDell/HelloBooks/milestones{/number}","notifications_url":"https://api.github.com/repos/BalogunDell/HelloBooks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BalogunDell/HelloBooks/labels{/name}","releases_url":"https://api.github.com/repos/BalogunDell/HelloBooks/releases{/id}","deployments_url":"https://api.github.com/repos/BalogunDell/HelloBooks/deployments","created_at":"2017-07-27T05:13:49Z","updated_at":"2017-12-14T01:42:42Z","pushed_at":"2017-12-14T01:46:04Z","git_url":"git://github.com/BalogunDell/HelloBooks.git","ssh_url":"git@github.com:BalogunDell/HelloBooks.git","clone_url":"https://github.com/BalogunDell/HelloBooks.git","svn_url":"https://github.com/BalogunDell/HelloBooks","homepage":"https://hellobooksapp.herokuapp.com/","size":15768,"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":1,"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"},"forks":1,"open_issues":1,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/93"},"html":{"href":"https://github.com/BalogunDell/HelloBooks/pull/93"},"issue":{"href":"https://api.github.com/repos/BalogunDell/HelloBooks/issues/93"},"comments":{"href":"https://api.github.com/repos/BalogunDell/HelloBooks/issues/93/comments"},"review_comments":{"href":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/93/comments"},"review_comment":{"href":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BalogunDell/HelloBooks/pulls/93/commits"},"statuses":{"href":"https://api.github.com/repos/BalogunDell/HelloBooks/statuses/3412b1c269d80a0f6960f847bbbc46fb7249cfef"}},"author_association":"OWNER"}}
{"actor":{"display_login":"houndci-bot"}}