{"action":"created","comment":{"url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/comments/184854005","pull_request_review_id":116137166,"id":184854005,"diff_hunk":"@@ -0,0 +1,54 @@\n+import fs from 'fs';\n+import path from 'path';\n+import User from '../models/user';\n+\n+const UserController = {\n+  addUser(req, res) {\n+    console.log(req.body, \"hsjhkldnadk\");\n+    if (Object.keys(req.body).length === 0) {\n+      return res.status(204).send({\n+        message: 'Please provide all relevant information',\n+      });\n+    }\n+    const data = fs.readFileSync(path.join(`${__dirname}/../database/userDatabase.json`));\n+    if (!data.toString()) {\n+      return res.status(500).send({ message: 'Sever Error' });\n+    }\n+    const user = JSON.parse(data);\n+    if (\n+      req.body.id !== '' &&\n+      req.body.name !== '' &&\n+      req.body.price !== '' &&\n+      req.body.image !== '' &&\n+      req.body.isChecked !== ''\n+    ) {\n+      const newUser = new User(\n+        req.body.id,\n+        req.body.fullName,\n+        req.body.email,\n+        req.body.phoneNumber,\n+        req.body.password,\n+      );\n+      const filter = user.data.filter(checkName => checkName.fullName === req.body.fullName);\n+      if (filter.length === 0) {\n+        user.data.push(newUser);\n+        const userDatabaseUpdate = JSON.stringify(user, null, 2);\n+        return fs.writeFile(\n+          path.join(`${__dirname}/../database/userDatabase.json`),\n+          userDatabaseUpdate,\n+          (err) => {\n+            if (err) {\n+              return res.status(400).send({ message: 'User not added successfully' });\n+            }\n+            return res.status(201).send({ data: newUser });\n+          },\n+        );\n+      }\n+      return res.status(409).send({ message: 'User already exist' });\n+    }\n+    return res.status(206).send({ message: 'Please provide all required field' });\n+  },\n+\n+};\n+\n+export default UserController;","path":"server/controllers/UserController.js","position":54,"original_position":54,"commit_id":"10ed7dc23cde2c2a6cc42b11685bf0bdac63458b","original_commit_id":"10ed7dc23cde2c2a6cc42b11685bf0bdac63458b","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":"'export' is only available in ES6 (use 'esversion: 6').","created_at":"2018-04-28T13:40:03Z","updated_at":"2018-04-28T13:40:04Z","html_url":"https://github.com/Nkemjiks/book-a-meal-app/pull/31#discussion_r184854005","pull_request_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/31","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/comments/184854005"},"html":{"href":"https://github.com/Nkemjiks/book-a-meal-app/pull/31#discussion_r184854005"},"pull_request":{"href":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/31"}}},"pull_request":{"url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/31","id":184786651,"html_url":"https://github.com/Nkemjiks/book-a-meal-app/pull/31","diff_url":"https://github.com/Nkemjiks/book-a-meal-app/pull/31.diff","patch_url":"https://github.com/Nkemjiks/book-a-meal-app/pull/31.patch","issue_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/issues/31","number":31,"state":"open","locked":false,"title":"Created the user signup API","user":{"login":"Nkemjiks","id":32465536,"avatar_url":"https://avatars0.githubusercontent.com/u/32465536?v=4","gravatar_id":"","url":"https://api.github.com/users/Nkemjiks","html_url":"https://github.com/Nkemjiks","followers_url":"https://api.github.com/users/Nkemjiks/followers","following_url":"https://api.github.com/users/Nkemjiks/following{/other_user}","gists_url":"https://api.github.com/users/Nkemjiks/gists{/gist_id}","starred_url":"https://api.github.com/users/Nkemjiks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nkemjiks/subscriptions","organizations_url":"https://api.github.com/users/Nkemjiks/orgs","repos_url":"https://api.github.com/users/Nkemjiks/repos","events_url":"https://api.github.com/users/Nkemjiks/events{/privacy}","received_events_url":"https://api.github.com/users/Nkemjiks/received_events","type":"User","site_admin":false},"body":"- Created a user controller file\r\n- Created a user model file\r\n- Updated the routes file \r\n\r\n[Finishes #156861898]\r\n","created_at":"2018-04-28T13:39:54Z","updated_at":"2018-04-28T13:40:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"59b65974292fc8b2c5121e261a0172c6cd64b6e8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/31/commits","review_comments_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/31/comments","review_comment_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/issues/31/comments","statuses_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/statuses/10ed7dc23cde2c2a6cc42b11685bf0bdac63458b","head":{"label":"Nkemjiks:ft-user-signup-api-156861898","ref":"ft-user-signup-api-156861898","sha":"10ed7dc23cde2c2a6cc42b11685bf0bdac63458b","user":{"login":"Nkemjiks","id":32465536,"avatar_url":"https://avatars0.githubusercontent.com/u/32465536?v=4","gravatar_id":"","url":"https://api.github.com/users/Nkemjiks","html_url":"https://github.com/Nkemjiks","followers_url":"https://api.github.com/users/Nkemjiks/followers","following_url":"https://api.github.com/users/Nkemjiks/following{/other_user}","gists_url":"https://api.github.com/users/Nkemjiks/gists{/gist_id}","starred_url":"https://api.github.com/users/Nkemjiks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nkemjiks/subscriptions","organizations_url":"https://api.github.com/users/Nkemjiks/orgs","repos_url":"https://api.github.com/users/Nkemjiks/repos","events_url":"https://api.github.com/users/Nkemjiks/events{/privacy}","received_events_url":"https://api.github.com/users/Nkemjiks/received_events","type":"User","site_admin":false},"repo":{"id":129936217,"name":"book-a-meal-app","full_name":"Nkemjiks/book-a-meal-app","owner":{"login":"Nkemjiks","id":32465536,"avatar_url":"https://avatars0.githubusercontent.com/u/32465536?v=4","gravatar_id":"","url":"https://api.github.com/users/Nkemjiks","html_url":"https://github.com/Nkemjiks","followers_url":"https://api.github.com/users/Nkemjiks/followers","following_url":"https://api.github.com/users/Nkemjiks/following{/other_user}","gists_url":"https://api.github.com/users/Nkemjiks/gists{/gist_id}","starred_url":"https://api.github.com/users/Nkemjiks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nkemjiks/subscriptions","organizations_url":"https://api.github.com/users/Nkemjiks/orgs","repos_url":"https://api.github.com/users/Nkemjiks/repos","events_url":"https://api.github.com/users/Nkemjiks/events{/privacy}","received_events_url":"https://api.github.com/users/Nkemjiks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Nkemjiks/book-a-meal-app","description":"Book-A-Meal is an application that allows customers to make food orders and helps the food vendor know what the customers want to eat. ","fork":false,"url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app","forks_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/forks","keys_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/teams","hooks_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/hooks","issue_events_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/issues/events{/number}","events_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/events","assignees_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/assignees{/user}","branches_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/branches{/branch}","tags_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/tags","blobs_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/statuses/{sha}","languages_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/languages","stargazers_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/stargazers","contributors_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/contributors","subscribers_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/subscribers","subscription_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/subscription","commits_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/contents/{+path}","compare_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/merges","archive_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/downloads","issues_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/issues{/number}","pulls_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls{/number}","milestones_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/milestones{/number}","notifications_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/labels{/name}","releases_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/releases{/id}","deployments_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/deployments","created_at":"2018-04-17T16:44:32Z","updated_at":"2018-04-28T11:15:12Z","pushed_at":"2018-04-28T13:39:54Z","git_url":"git://github.com/Nkemjiks/book-a-meal-app.git","ssh_url":"git@github.com:Nkemjiks/book-a-meal-app.git","clone_url":"https://github.com/Nkemjiks/book-a-meal-app.git","svn_url":"https://github.com/Nkemjiks/book-a-meal-app","homepage":null,"size":262,"stargazers_count":0,"watchers_count":0,"language":"HTML","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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"development"}},"base":{"label":"Nkemjiks:development","ref":"development","sha":"843c5ca9b29e7185b8b529d49e70f43ea71fc545","user":{"login":"Nkemjiks","id":32465536,"avatar_url":"https://avatars0.githubusercontent.com/u/32465536?v=4","gravatar_id":"","url":"https://api.github.com/users/Nkemjiks","html_url":"https://github.com/Nkemjiks","followers_url":"https://api.github.com/users/Nkemjiks/followers","following_url":"https://api.github.com/users/Nkemjiks/following{/other_user}","gists_url":"https://api.github.com/users/Nkemjiks/gists{/gist_id}","starred_url":"https://api.github.com/users/Nkemjiks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nkemjiks/subscriptions","organizations_url":"https://api.github.com/users/Nkemjiks/orgs","repos_url":"https://api.github.com/users/Nkemjiks/repos","events_url":"https://api.github.com/users/Nkemjiks/events{/privacy}","received_events_url":"https://api.github.com/users/Nkemjiks/received_events","type":"User","site_admin":false},"repo":{"id":129936217,"name":"book-a-meal-app","full_name":"Nkemjiks/book-a-meal-app","owner":{"login":"Nkemjiks","id":32465536,"avatar_url":"https://avatars0.githubusercontent.com/u/32465536?v=4","gravatar_id":"","url":"https://api.github.com/users/Nkemjiks","html_url":"https://github.com/Nkemjiks","followers_url":"https://api.github.com/users/Nkemjiks/followers","following_url":"https://api.github.com/users/Nkemjiks/following{/other_user}","gists_url":"https://api.github.com/users/Nkemjiks/gists{/gist_id}","starred_url":"https://api.github.com/users/Nkemjiks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nkemjiks/subscriptions","organizations_url":"https://api.github.com/users/Nkemjiks/orgs","repos_url":"https://api.github.com/users/Nkemjiks/repos","events_url":"https://api.github.com/users/Nkemjiks/events{/privacy}","received_events_url":"https://api.github.com/users/Nkemjiks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Nkemjiks/book-a-meal-app","description":"Book-A-Meal is an application that allows customers to make food orders and helps the food vendor know what the customers want to eat. ","fork":false,"url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app","forks_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/forks","keys_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/teams","hooks_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/hooks","issue_events_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/issues/events{/number}","events_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/events","assignees_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/assignees{/user}","branches_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/branches{/branch}","tags_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/tags","blobs_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/statuses/{sha}","languages_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/languages","stargazers_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/stargazers","contributors_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/contributors","subscribers_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/subscribers","subscription_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/subscription","commits_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/contents/{+path}","compare_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/merges","archive_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/downloads","issues_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/issues{/number}","pulls_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls{/number}","milestones_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/milestones{/number}","notifications_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/labels{/name}","releases_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/releases{/id}","deployments_url":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/deployments","created_at":"2018-04-17T16:44:32Z","updated_at":"2018-04-28T11:15:12Z","pushed_at":"2018-04-28T13:39:54Z","git_url":"git://github.com/Nkemjiks/book-a-meal-app.git","ssh_url":"git@github.com:Nkemjiks/book-a-meal-app.git","clone_url":"https://github.com/Nkemjiks/book-a-meal-app.git","svn_url":"https://github.com/Nkemjiks/book-a-meal-app","homepage":null,"size":262,"stargazers_count":0,"watchers_count":0,"language":"HTML","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":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/31"},"html":{"href":"https://github.com/Nkemjiks/book-a-meal-app/pull/31"},"issue":{"href":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/issues/31"},"comments":{"href":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/issues/31/comments"},"review_comments":{"href":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/31/comments"},"review_comment":{"href":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/pulls/31/commits"},"statuses":{"href":"https://api.github.com/repos/Nkemjiks/book-a-meal-app/statuses/10ed7dc23cde2c2a6cc42b11685bf0bdac63458b"}},"author_association":"OWNER"}}
{"actor":{"display_login":"houndci-bot"}}