{"action":"created","comment":{"url":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/comments/175286563","pull_request_review_id":104794742,"id":175286563,"diff_hunk":"@@ -0,0 +1,235 @@\n+\n+\n+import { businesses } from '../dummydb/db';\n+\n+/**\n+ * @class BusinessController\n+ *\n+ * @description CRUD operations on Business\n+ *\n+ */\n+class BusinessController {\n+\n+  /**\n+     * @static\n+     *\n+     *\n+     * @param {object} req - The request payload sent to the router\n+     * @param {object} res - The response payload sent back from the controller\n+     *\n+     * @returns {object} - status Message and list of all businesses\n+     *\n+     * @memberOf BusinessController\n+     */\n+  static getAllBusinesses(req, res) {\n+\n+    if (businesses.length === 0) {\n+\n+      return res.status(404).json({ message: 'No business available at this time', businesses });\n+\n+    }\n+\n+    return res.json({ message: 'business list loaded successfully', businesses });\n+\n+  }\n+\n+  /**\n+     * @static\n+     *\n+     *\n+     * @param {object} req - The request payload sent to the router\n+     * @param {object} res - The response payload sent back from the controller\n+     *\n+     * @returns {object} - status Message and the particul businesses by id.\n+     *\n+     * @memberOf BusinessController\n+     */\n+  static getBusinessById(req, res) {\n+\n+    const id = req.params.businessId;\n+\n+    const business = businesses.find(businessItem => +businessItem.businessId === +id);\n+\n+    if (!business) {\n+\n+      res.status(404).json({ message: `Business with businessId ${id} does not exist` });\n+\n+    } else {\n+\n+      res.json({ message: 'business search was successful', businesses });\n+\n+    }\n+\n+  }\n+\n+\n+  /**\n+     * @static\n+     *\n+     *\n+     * @param {object} req - The request payload sent to the router\n+     * @param {object} res - The response payload sent back from the controller\n+     *\n+     * @returns {object} - status Message and the particular businesses created.\n+     *\n+     * @memberOf BusinessController\n+     */\n+  static createBusiness(req, res) {\n+\n+    const businessId = businesses.length === 0 ? 1 :\n+\n+      businesses[businesses.length - 1].businessId + 1;\n+\n+    const {\n+\n+      businessName,\n+\n+      businessAddress,\n+\n+      location,\n+\n+      category,\n+\n+      userId\n+\n+    } = req.body;\n+\n+    const newBusiness = {\n+\n+      businessId,\n+\n+      businessName,\n+\n+      businessAddress,\n+\n+      location,\n+\n+      category,\n+\n+      userId,\n+\n+      reviews: []\n+\n+    };\n+\n+    businesses.push(newBusiness);\n+\n+    res.status(201).send({ message: 'business successfully added', newBusiness });\n+\n+\n+  }\n+\n+  /**\n+     * @static\n+     *\n+     *\n+     * @param {object} req - The request payload sent to the router\n+     * @param {object} res - The response payload sent back from the controller\n+     *\n+     * @returns {object} - status Message and the particular updated businesses created.\n+     *\n+     * @memberOf BusinessController\n+     */\n+  static updateBusiness(req, res) {\n+\n+    const id = req.params.businessId;\n+\n+    const business = businesses.find(businessItem => +businessItem.businessId === +id);\n+\n+    if (!business) {\n+\n+      res.status(404).json({ message: `Business with businessId ${id} does not exist!` });\n+\n+    } else {\n+\n+      const businessIndex = businesses.indexOf(business);\n+\n+      const {","path":"server/src/controllers/businessController.js","position":147,"original_position":147,"commit_id":"f0d0c25addef0ab43c74225be9cca043a2f3c50f","original_commit_id":"f0d0c25addef0ab43c74225be9cca043a2f3c50f","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":"'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).<br>'destructuring binding' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).","created_at":"2018-03-18T12:03:40Z","updated_at":"2018-03-18T12:03:41Z","html_url":"https://github.com/augustineezinwa/WEConnect/pull/15#discussion_r175286563","pull_request_url":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/15","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/comments/175286563"},"html":{"href":"https://github.com/augustineezinwa/WEConnect/pull/15#discussion_r175286563"},"pull_request":{"href":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/15","id":175747595,"html_url":"https://github.com/augustineezinwa/WEConnect/pull/15","diff_url":"https://github.com/augustineezinwa/WEConnect/pull/15.diff","patch_url":"https://github.com/augustineezinwa/WEConnect/pull/15.patch","issue_url":"https://api.github.com/repos/augustineezinwa/WEConnect/issues/15","number":15,"state":"open","locked":false,"title":"Feature- remove business by id route #155588040","user":{"login":"augustineezinwa","id":30579559,"avatar_url":"https://avatars3.githubusercontent.com/u/30579559?v=4","gravatar_id":"","url":"https://api.github.com/users/augustineezinwa","html_url":"https://github.com/augustineezinwa","followers_url":"https://api.github.com/users/augustineezinwa/followers","following_url":"https://api.github.com/users/augustineezinwa/following{/other_user}","gists_url":"https://api.github.com/users/augustineezinwa/gists{/gist_id}","starred_url":"https://api.github.com/users/augustineezinwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/augustineezinwa/subscriptions","organizations_url":"https://api.github.com/users/augustineezinwa/orgs","repos_url":"https://api.github.com/users/augustineezinwa/repos","events_url":"https://api.github.com/users/augustineezinwa/events{/privacy}","received_events_url":"https://api.github.com/users/augustineezinwa/received_events","type":"User","site_admin":false},"body":"Hello, this code creates an api endpoint that enables an authenticated user to remove a business he or she registered by Id. please i need reviews on this code. I am open to your feedbacks, suggestions and contributions. Thanks","created_at":"2018-03-18T12:03:29Z","updated_at":"2018-03-18T12:03:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8ef61e0f4a29fb0f8624ab71035ad4b9c9e67582","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/15/commits","review_comments_url":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/15/comments","review_comment_url":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/comments{/number}","comments_url":"https://api.github.com/repos/augustineezinwa/WEConnect/issues/15/comments","statuses_url":"https://api.github.com/repos/augustineezinwa/WEConnect/statuses/f0d0c25addef0ab43c74225be9cca043a2f3c50f","head":{"label":"augustineezinwa:ft-remove-business-byId-route-#155588040","ref":"ft-remove-business-byId-route-#155588040","sha":"f0d0c25addef0ab43c74225be9cca043a2f3c50f","user":{"login":"augustineezinwa","id":30579559,"avatar_url":"https://avatars3.githubusercontent.com/u/30579559?v=4","gravatar_id":"","url":"https://api.github.com/users/augustineezinwa","html_url":"https://github.com/augustineezinwa","followers_url":"https://api.github.com/users/augustineezinwa/followers","following_url":"https://api.github.com/users/augustineezinwa/following{/other_user}","gists_url":"https://api.github.com/users/augustineezinwa/gists{/gist_id}","starred_url":"https://api.github.com/users/augustineezinwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/augustineezinwa/subscriptions","organizations_url":"https://api.github.com/users/augustineezinwa/orgs","repos_url":"https://api.github.com/users/augustineezinwa/repos","events_url":"https://api.github.com/users/augustineezinwa/events{/privacy}","received_events_url":"https://api.github.com/users/augustineezinwa/received_events","type":"User","site_admin":false},"repo":{"id":123258104,"name":"WEConnect","full_name":"augustineezinwa/WEConnect","owner":{"login":"augustineezinwa","id":30579559,"avatar_url":"https://avatars3.githubusercontent.com/u/30579559?v=4","gravatar_id":"","url":"https://api.github.com/users/augustineezinwa","html_url":"https://github.com/augustineezinwa","followers_url":"https://api.github.com/users/augustineezinwa/followers","following_url":"https://api.github.com/users/augustineezinwa/following{/other_user}","gists_url":"https://api.github.com/users/augustineezinwa/gists{/gist_id}","starred_url":"https://api.github.com/users/augustineezinwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/augustineezinwa/subscriptions","organizations_url":"https://api.github.com/users/augustineezinwa/orgs","repos_url":"https://api.github.com/users/augustineezinwa/repos","events_url":"https://api.github.com/users/augustineezinwa/events{/privacy}","received_events_url":"https://api.github.com/users/augustineezinwa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/augustineezinwa/WEConnect","description":"WEConnect Application provides a platform that brings businesses and individuals together. ","fork":false,"url":"https://api.github.com/repos/augustineezinwa/WEConnect","forks_url":"https://api.github.com/repos/augustineezinwa/WEConnect/forks","keys_url":"https://api.github.com/repos/augustineezinwa/WEConnect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/augustineezinwa/WEConnect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/augustineezinwa/WEConnect/teams","hooks_url":"https://api.github.com/repos/augustineezinwa/WEConnect/hooks","issue_events_url":"https://api.github.com/repos/augustineezinwa/WEConnect/issues/events{/number}","events_url":"https://api.github.com/repos/augustineezinwa/WEConnect/events","assignees_url":"https://api.github.com/repos/augustineezinwa/WEConnect/assignees{/user}","branches_url":"https://api.github.com/repos/augustineezinwa/WEConnect/branches{/branch}","tags_url":"https://api.github.com/repos/augustineezinwa/WEConnect/tags","blobs_url":"https://api.github.com/repos/augustineezinwa/WEConnect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/augustineezinwa/WEConnect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/augustineezinwa/WEConnect/git/refs{/sha}","trees_url":"https://api.github.com/repos/augustineezinwa/WEConnect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/augustineezinwa/WEConnect/statuses/{sha}","languages_url":"https://api.github.com/repos/augustineezinwa/WEConnect/languages","stargazers_url":"https://api.github.com/repos/augustineezinwa/WEConnect/stargazers","contributors_url":"https://api.github.com/repos/augustineezinwa/WEConnect/contributors","subscribers_url":"https://api.github.com/repos/augustineezinwa/WEConnect/subscribers","subscription_url":"https://api.github.com/repos/augustineezinwa/WEConnect/subscription","commits_url":"https://api.github.com/repos/augustineezinwa/WEConnect/commits{/sha}","git_commits_url":"https://api.github.com/repos/augustineezinwa/WEConnect/git/commits{/sha}","comments_url":"https://api.github.com/repos/augustineezinwa/WEConnect/comments{/number}","issue_comment_url":"https://api.github.com/repos/augustineezinwa/WEConnect/issues/comments{/number}","contents_url":"https://api.github.com/repos/augustineezinwa/WEConnect/contents/{+path}","compare_url":"https://api.github.com/repos/augustineezinwa/WEConnect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/augustineezinwa/WEConnect/merges","archive_url":"https://api.github.com/repos/augustineezinwa/WEConnect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/augustineezinwa/WEConnect/downloads","issues_url":"https://api.github.com/repos/augustineezinwa/WEConnect/issues{/number}","pulls_url":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls{/number}","milestones_url":"https://api.github.com/repos/augustineezinwa/WEConnect/milestones{/number}","notifications_url":"https://api.github.com/repos/augustineezinwa/WEConnect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/augustineezinwa/WEConnect/labels{/name}","releases_url":"https://api.github.com/repos/augustineezinwa/WEConnect/releases{/id}","deployments_url":"https://api.github.com/repos/augustineezinwa/WEConnect/deployments","created_at":"2018-02-28T08:59:44Z","updated_at":"2018-03-18T08:58:25Z","pushed_at":"2018-03-18T12:03:29Z","git_url":"git://github.com/augustineezinwa/WEConnect.git","ssh_url":"git@github.com:augustineezinwa/WEConnect.git","clone_url":"https://github.com/augustineezinwa/WEConnect.git","svn_url":"https://github.com/augustineezinwa/WEConnect","homepage":"","size":16094,"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,"archived":false,"open_issues_count":15,"license":null,"forks":0,"open_issues":15,"watchers":0,"default_branch":"ft-signup-endpoint-#155587518"}},"base":{"label":"augustineezinwa:develop","ref":"develop","sha":"8049f0ae6c386c6620886f489d2071cdea120209","user":{"login":"augustineezinwa","id":30579559,"avatar_url":"https://avatars3.githubusercontent.com/u/30579559?v=4","gravatar_id":"","url":"https://api.github.com/users/augustineezinwa","html_url":"https://github.com/augustineezinwa","followers_url":"https://api.github.com/users/augustineezinwa/followers","following_url":"https://api.github.com/users/augustineezinwa/following{/other_user}","gists_url":"https://api.github.com/users/augustineezinwa/gists{/gist_id}","starred_url":"https://api.github.com/users/augustineezinwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/augustineezinwa/subscriptions","organizations_url":"https://api.github.com/users/augustineezinwa/orgs","repos_url":"https://api.github.com/users/augustineezinwa/repos","events_url":"https://api.github.com/users/augustineezinwa/events{/privacy}","received_events_url":"https://api.github.com/users/augustineezinwa/received_events","type":"User","site_admin":false},"repo":{"id":123258104,"name":"WEConnect","full_name":"augustineezinwa/WEConnect","owner":{"login":"augustineezinwa","id":30579559,"avatar_url":"https://avatars3.githubusercontent.com/u/30579559?v=4","gravatar_id":"","url":"https://api.github.com/users/augustineezinwa","html_url":"https://github.com/augustineezinwa","followers_url":"https://api.github.com/users/augustineezinwa/followers","following_url":"https://api.github.com/users/augustineezinwa/following{/other_user}","gists_url":"https://api.github.com/users/augustineezinwa/gists{/gist_id}","starred_url":"https://api.github.com/users/augustineezinwa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/augustineezinwa/subscriptions","organizations_url":"https://api.github.com/users/augustineezinwa/orgs","repos_url":"https://api.github.com/users/augustineezinwa/repos","events_url":"https://api.github.com/users/augustineezinwa/events{/privacy}","received_events_url":"https://api.github.com/users/augustineezinwa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/augustineezinwa/WEConnect","description":"WEConnect Application provides a platform that brings businesses and individuals together. ","fork":false,"url":"https://api.github.com/repos/augustineezinwa/WEConnect","forks_url":"https://api.github.com/repos/augustineezinwa/WEConnect/forks","keys_url":"https://api.github.com/repos/augustineezinwa/WEConnect/keys{/key_id}","collaborators_url":"https://api.github.com/repos/augustineezinwa/WEConnect/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/augustineezinwa/WEConnect/teams","hooks_url":"https://api.github.com/repos/augustineezinwa/WEConnect/hooks","issue_events_url":"https://api.github.com/repos/augustineezinwa/WEConnect/issues/events{/number}","events_url":"https://api.github.com/repos/augustineezinwa/WEConnect/events","assignees_url":"https://api.github.com/repos/augustineezinwa/WEConnect/assignees{/user}","branches_url":"https://api.github.com/repos/augustineezinwa/WEConnect/branches{/branch}","tags_url":"https://api.github.com/repos/augustineezinwa/WEConnect/tags","blobs_url":"https://api.github.com/repos/augustineezinwa/WEConnect/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/augustineezinwa/WEConnect/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/augustineezinwa/WEConnect/git/refs{/sha}","trees_url":"https://api.github.com/repos/augustineezinwa/WEConnect/git/trees{/sha}","statuses_url":"https://api.github.com/repos/augustineezinwa/WEConnect/statuses/{sha}","languages_url":"https://api.github.com/repos/augustineezinwa/WEConnect/languages","stargazers_url":"https://api.github.com/repos/augustineezinwa/WEConnect/stargazers","contributors_url":"https://api.github.com/repos/augustineezinwa/WEConnect/contributors","subscribers_url":"https://api.github.com/repos/augustineezinwa/WEConnect/subscribers","subscription_url":"https://api.github.com/repos/augustineezinwa/WEConnect/subscription","commits_url":"https://api.github.com/repos/augustineezinwa/WEConnect/commits{/sha}","git_commits_url":"https://api.github.com/repos/augustineezinwa/WEConnect/git/commits{/sha}","comments_url":"https://api.github.com/repos/augustineezinwa/WEConnect/comments{/number}","issue_comment_url":"https://api.github.com/repos/augustineezinwa/WEConnect/issues/comments{/number}","contents_url":"https://api.github.com/repos/augustineezinwa/WEConnect/contents/{+path}","compare_url":"https://api.github.com/repos/augustineezinwa/WEConnect/compare/{base}...{head}","merges_url":"https://api.github.com/repos/augustineezinwa/WEConnect/merges","archive_url":"https://api.github.com/repos/augustineezinwa/WEConnect/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/augustineezinwa/WEConnect/downloads","issues_url":"https://api.github.com/repos/augustineezinwa/WEConnect/issues{/number}","pulls_url":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls{/number}","milestones_url":"https://api.github.com/repos/augustineezinwa/WEConnect/milestones{/number}","notifications_url":"https://api.github.com/repos/augustineezinwa/WEConnect/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/augustineezinwa/WEConnect/labels{/name}","releases_url":"https://api.github.com/repos/augustineezinwa/WEConnect/releases{/id}","deployments_url":"https://api.github.com/repos/augustineezinwa/WEConnect/deployments","created_at":"2018-02-28T08:59:44Z","updated_at":"2018-03-18T08:58:25Z","pushed_at":"2018-03-18T12:03:29Z","git_url":"git://github.com/augustineezinwa/WEConnect.git","ssh_url":"git@github.com:augustineezinwa/WEConnect.git","clone_url":"https://github.com/augustineezinwa/WEConnect.git","svn_url":"https://github.com/augustineezinwa/WEConnect","homepage":"","size":16094,"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,"archived":false,"open_issues_count":15,"license":null,"forks":0,"open_issues":15,"watchers":0,"default_branch":"ft-signup-endpoint-#155587518"}},"_links":{"self":{"href":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/15"},"html":{"href":"https://github.com/augustineezinwa/WEConnect/pull/15"},"issue":{"href":"https://api.github.com/repos/augustineezinwa/WEConnect/issues/15"},"comments":{"href":"https://api.github.com/repos/augustineezinwa/WEConnect/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/augustineezinwa/WEConnect/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/augustineezinwa/WEConnect/statuses/f0d0c25addef0ab43c74225be9cca043a2f3c50f"}},"author_association":"OWNER"}}
{"actor":{"display_login":"houndci-bot"}}