{"action":"created","comment":{"url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/comments/181776992","pull_request_review_id":112459227,"id":181776992,"diff_hunk":"@@ -0,0 +1,65 @@\n+const bodybuilder = require('bodybuilder');\n+const { get, isEmpty } = require('lodash');\n+const uuid = require('uuid');\n+\n+const client = require('../services/elasticsearch');\n+\n+const searchEvents = (req, res, next) => client.search({\n+  index: 'event',\n+  type: 'event',\n+  body: bodybuilder()\n+    .query('match_all')\n+    // .query('match', 'name', 'my event')\n+    .build()\n+})\n+  .then(result => get(result, 'hits.hits', []).map(hit => ({\n+    id: get(hit, '_id'),\n+    ...get(hit, '_source', {})\n+  })))\n+  .then(events => res.json(events))\n+  .catch(next);\n+\n+const createEvent = (req, res, next) => {\n+  // TODO: create validation for route params\n+  if (isEmpty(req.body)) {\n+    return res.sendStatus(400);\n+  }\n+\n+  const { name, description, date } = req.body;\n+\n+  return client.create({\n+    id: uuid(),\n+    index: 'event',\n+    type: 'event',\n+    body: {\n+      name,\n+      description,\n+      date,\n+    }\n+  })\n+    .then(() => res.sendStatus(204))","path":"app/controllers/events.js","position":40,"original_position":40,"commit_id":"9fc519ded7c37be5196438ba0afdf83b898e0ad9","original_commit_id":"9fc519ded7c37be5196438ba0afdf83b898e0ad9","user":{"login":"akosenko","id":11784878,"avatar_url":"https://avatars2.githubusercontent.com/u/11784878?v=4","gravatar_id":"","url":"https://api.github.com/users/akosenko","html_url":"https://github.com/akosenko","followers_url":"https://api.github.com/users/akosenko/followers","following_url":"https://api.github.com/users/akosenko/following{/other_user}","gists_url":"https://api.github.com/users/akosenko/gists{/gist_id}","starred_url":"https://api.github.com/users/akosenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akosenko/subscriptions","organizations_url":"https://api.github.com/users/akosenko/orgs","repos_url":"https://api.github.com/users/akosenko/repos","events_url":"https://api.github.com/users/akosenko/events{/privacy}","received_events_url":"https://api.github.com/users/akosenko/received_events","type":"User","site_admin":false},"body":"204 or 201?","created_at":"2018-04-16T15:10:38Z","updated_at":"2018-04-16T15:26:11Z","html_url":"https://github.com/inst-event-emitter/eventemitter-backend/pull/10#discussion_r181776992","pull_request_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/10","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/comments/181776992"},"html":{"href":"https://github.com/inst-event-emitter/eventemitter-backend/pull/10#discussion_r181776992"},"pull_request":{"href":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/10","id":179929532,"html_url":"https://github.com/inst-event-emitter/eventemitter-backend/pull/10","diff_url":"https://github.com/inst-event-emitter/eventemitter-backend/pull/10.diff","patch_url":"https://github.com/inst-event-emitter/eventemitter-backend/pull/10.patch","issue_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/issues/10","number":10,"state":"open","locked":false,"title":"Create elasticsearch service","user":{"login":"DenKrivichanin","id":9417851,"avatar_url":"https://avatars2.githubusercontent.com/u/9417851?v=4","gravatar_id":"","url":"https://api.github.com/users/DenKrivichanin","html_url":"https://github.com/DenKrivichanin","followers_url":"https://api.github.com/users/DenKrivichanin/followers","following_url":"https://api.github.com/users/DenKrivichanin/following{/other_user}","gists_url":"https://api.github.com/users/DenKrivichanin/gists{/gist_id}","starred_url":"https://api.github.com/users/DenKrivichanin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenKrivichanin/subscriptions","organizations_url":"https://api.github.com/users/DenKrivichanin/orgs","repos_url":"https://api.github.com/users/DenKrivichanin/repos","events_url":"https://api.github.com/users/DenKrivichanin/events{/privacy}","received_events_url":"https://api.github.com/users/DenKrivichanin/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-06T12:04:53Z","updated_at":"2018-04-16T15:26:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"72b4a880406de9dcdcde0cf8aecdbdca1dfd4a14","assignee":{"login":"DenKrivichanin","id":9417851,"avatar_url":"https://avatars2.githubusercontent.com/u/9417851?v=4","gravatar_id":"","url":"https://api.github.com/users/DenKrivichanin","html_url":"https://github.com/DenKrivichanin","followers_url":"https://api.github.com/users/DenKrivichanin/followers","following_url":"https://api.github.com/users/DenKrivichanin/following{/other_user}","gists_url":"https://api.github.com/users/DenKrivichanin/gists{/gist_id}","starred_url":"https://api.github.com/users/DenKrivichanin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenKrivichanin/subscriptions","organizations_url":"https://api.github.com/users/DenKrivichanin/orgs","repos_url":"https://api.github.com/users/DenKrivichanin/repos","events_url":"https://api.github.com/users/DenKrivichanin/events{/privacy}","received_events_url":"https://api.github.com/users/DenKrivichanin/received_events","type":"User","site_admin":false},"assignees":[{"login":"DenKrivichanin","id":9417851,"avatar_url":"https://avatars2.githubusercontent.com/u/9417851?v=4","gravatar_id":"","url":"https://api.github.com/users/DenKrivichanin","html_url":"https://github.com/DenKrivichanin","followers_url":"https://api.github.com/users/DenKrivichanin/followers","following_url":"https://api.github.com/users/DenKrivichanin/following{/other_user}","gists_url":"https://api.github.com/users/DenKrivichanin/gists{/gist_id}","starred_url":"https://api.github.com/users/DenKrivichanin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DenKrivichanin/subscriptions","organizations_url":"https://api.github.com/users/DenKrivichanin/orgs","repos_url":"https://api.github.com/users/DenKrivichanin/repos","events_url":"https://api.github.com/users/DenKrivichanin/events{/privacy}","received_events_url":"https://api.github.com/users/DenKrivichanin/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":875592119,"url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/labels/Priority:%20Medium","name":"Priority: Medium","color":"0052cc","default":false},{"id":875590524,"url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/labels/Status:%20Review%20Needed","name":"Status: Review Needed","color":"fbca04","default":false},{"id":875591779,"url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/labels/Type:%20Enhancement","name":"Type: Enhancement","color":"c5def5","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/10/commits","review_comments_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/10/comments","review_comment_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/issues/10/comments","statuses_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/statuses/9fc519ded7c37be5196438ba0afdf83b898e0ad9","head":{"label":"inst-event-emitter:elasticsearch-service","ref":"elasticsearch-service","sha":"9fc519ded7c37be5196438ba0afdf83b898e0ad9","user":{"login":"inst-event-emitter","id":37331895,"avatar_url":"https://avatars0.githubusercontent.com/u/37331895?v=4","gravatar_id":"","url":"https://api.github.com/users/inst-event-emitter","html_url":"https://github.com/inst-event-emitter","followers_url":"https://api.github.com/users/inst-event-emitter/followers","following_url":"https://api.github.com/users/inst-event-emitter/following{/other_user}","gists_url":"https://api.github.com/users/inst-event-emitter/gists{/gist_id}","starred_url":"https://api.github.com/users/inst-event-emitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inst-event-emitter/subscriptions","organizations_url":"https://api.github.com/users/inst-event-emitter/orgs","repos_url":"https://api.github.com/users/inst-event-emitter/repos","events_url":"https://api.github.com/users/inst-event-emitter/events{/privacy}","received_events_url":"https://api.github.com/users/inst-event-emitter/received_events","type":"Organization","site_admin":false},"repo":{"id":125036404,"name":"eventemitter-backend","full_name":"inst-event-emitter/eventemitter-backend","owner":{"login":"inst-event-emitter","id":37331895,"avatar_url":"https://avatars0.githubusercontent.com/u/37331895?v=4","gravatar_id":"","url":"https://api.github.com/users/inst-event-emitter","html_url":"https://github.com/inst-event-emitter","followers_url":"https://api.github.com/users/inst-event-emitter/followers","following_url":"https://api.github.com/users/inst-event-emitter/following{/other_user}","gists_url":"https://api.github.com/users/inst-event-emitter/gists{/gist_id}","starred_url":"https://api.github.com/users/inst-event-emitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inst-event-emitter/subscriptions","organizations_url":"https://api.github.com/users/inst-event-emitter/orgs","repos_url":"https://api.github.com/users/inst-event-emitter/repos","events_url":"https://api.github.com/users/inst-event-emitter/events{/privacy}","received_events_url":"https://api.github.com/users/inst-event-emitter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inst-event-emitter/eventemitter-backend","description":"Project server side","fork":false,"url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend","forks_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/forks","keys_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/teams","hooks_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/hooks","issue_events_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/issues/events{/number}","events_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/events","assignees_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/assignees{/user}","branches_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/branches{/branch}","tags_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/tags","blobs_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/languages","stargazers_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/stargazers","contributors_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/contributors","subscribers_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/subscribers","subscription_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/subscription","commits_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/contents/{+path}","compare_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/merges","archive_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/downloads","issues_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/issues{/number}","pulls_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/labels{/name}","releases_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/releases{/id}","deployments_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/deployments","created_at":"2018-03-13T10:49:48Z","updated_at":"2018-03-22T14:03:40Z","pushed_at":"2018-04-11T10:13:47Z","git_url":"git://github.com/inst-event-emitter/eventemitter-backend.git","ssh_url":"git@github.com:inst-event-emitter/eventemitter-backend.git","clone_url":"https://github.com/inst-event-emitter/eventemitter-backend.git","svn_url":"https://github.com/inst-event-emitter/eventemitter-backend","homepage":"","size":46,"stargazers_count":0,"watchers_count":0,"language":null,"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"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"dev"}},"base":{"label":"inst-event-emitter:dev","ref":"dev","sha":"eb2de2ca6bd71cd5148ee6671e4ac228f99e59e1","user":{"login":"inst-event-emitter","id":37331895,"avatar_url":"https://avatars0.githubusercontent.com/u/37331895?v=4","gravatar_id":"","url":"https://api.github.com/users/inst-event-emitter","html_url":"https://github.com/inst-event-emitter","followers_url":"https://api.github.com/users/inst-event-emitter/followers","following_url":"https://api.github.com/users/inst-event-emitter/following{/other_user}","gists_url":"https://api.github.com/users/inst-event-emitter/gists{/gist_id}","starred_url":"https://api.github.com/users/inst-event-emitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inst-event-emitter/subscriptions","organizations_url":"https://api.github.com/users/inst-event-emitter/orgs","repos_url":"https://api.github.com/users/inst-event-emitter/repos","events_url":"https://api.github.com/users/inst-event-emitter/events{/privacy}","received_events_url":"https://api.github.com/users/inst-event-emitter/received_events","type":"Organization","site_admin":false},"repo":{"id":125036404,"name":"eventemitter-backend","full_name":"inst-event-emitter/eventemitter-backend","owner":{"login":"inst-event-emitter","id":37331895,"avatar_url":"https://avatars0.githubusercontent.com/u/37331895?v=4","gravatar_id":"","url":"https://api.github.com/users/inst-event-emitter","html_url":"https://github.com/inst-event-emitter","followers_url":"https://api.github.com/users/inst-event-emitter/followers","following_url":"https://api.github.com/users/inst-event-emitter/following{/other_user}","gists_url":"https://api.github.com/users/inst-event-emitter/gists{/gist_id}","starred_url":"https://api.github.com/users/inst-event-emitter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inst-event-emitter/subscriptions","organizations_url":"https://api.github.com/users/inst-event-emitter/orgs","repos_url":"https://api.github.com/users/inst-event-emitter/repos","events_url":"https://api.github.com/users/inst-event-emitter/events{/privacy}","received_events_url":"https://api.github.com/users/inst-event-emitter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inst-event-emitter/eventemitter-backend","description":"Project server side","fork":false,"url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend","forks_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/forks","keys_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/teams","hooks_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/hooks","issue_events_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/issues/events{/number}","events_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/events","assignees_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/assignees{/user}","branches_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/branches{/branch}","tags_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/tags","blobs_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/languages","stargazers_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/stargazers","contributors_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/contributors","subscribers_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/subscribers","subscription_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/subscription","commits_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/contents/{+path}","compare_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/merges","archive_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/downloads","issues_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/issues{/number}","pulls_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/labels{/name}","releases_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/releases{/id}","deployments_url":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/deployments","created_at":"2018-03-13T10:49:48Z","updated_at":"2018-03-22T14:03:40Z","pushed_at":"2018-04-11T10:13:47Z","git_url":"git://github.com/inst-event-emitter/eventemitter-backend.git","ssh_url":"git@github.com:inst-event-emitter/eventemitter-backend.git","clone_url":"https://github.com/inst-event-emitter/eventemitter-backend.git","svn_url":"https://github.com/inst-event-emitter/eventemitter-backend","homepage":"","size":46,"stargazers_count":0,"watchers_count":0,"language":null,"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"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/10"},"html":{"href":"https://github.com/inst-event-emitter/eventemitter-backend/pull/10"},"issue":{"href":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/issues/10"},"comments":{"href":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/inst-event-emitter/eventemitter-backend/statuses/9fc519ded7c37be5196438ba0afdf83b898e0ad9"}},"author_association":"OWNER"}}
{"actor":{"display_login":"akosenko"}}