{"action":"created","comment":{"url":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/comments/165851400","pull_request_review_id":93852164,"id":165851400,"diff_hunk":"@@ -0,0 +1,226 @@\n+'use strict';\n+\n+const config = require('../config.js');\n+\n+const regexLat = /^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$/;\n+const regexLng = /^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$/;\n+\n+class EventsController {\n+  constructor (Events, monk) {\n+    this.Events = Events;\n+    this.monk = monk;\n+  }\n+  \n+  async createEvent (ctx, next) {\n+    if ('POST' != ctx.method) return await next();\n+    const newEvent = {\n+      place_id: ctx.request.body.place_id,\n+      place_name: ctx.request.body.place_name,\n+      place_address: ctx.request.body.place_address,\n+      location: ctx.request.body.location,\n+      when: ctx.request.body.when,\n+      creator: ctx.user._id,\n+      attendees: [ctx.user._id],\n+    };\n+    try {\n+      for (const key in newEvent) {\n+        if (!newEvent[key]) throw `Empty parameter ${[key]}`;\n+      }\n+      if (!ctx.request.body.location.coordinates[1] || !ctx.request.body.location.coordinates[0] ) throw 'Latitude and or Longitude not present';\n+      if (!regexLat.test(ctx.request.body.location.coordinates[0])) throw 'Not valid latitude or Latitude';\n+      if (!regexLng.test(ctx.request.body.location.coordinates[1])) throw 'Not valid latitude or Longitude';\n+      const event = await this.Events.insert(newEvent);\n+      ctx.status = 201;\n+      ctx.body = JSON.stringify({'event': event});\n+    } catch (e) { \n+      // eslint-disable-next-line no-console","path":"controllers/eventsController.js","position":36,"original_position":36,"commit_id":"91632ea3b6564869ce5bcf7de1a1eb3ce01b8c82","original_commit_id":"91632ea3b6564869ce5bcf7de1a1eb3ce01b8c82","user":{"login":"Glitches","id":3679351,"avatar_url":"https://avatars1.githubusercontent.com/u/3679351?v=4","gravatar_id":"","url":"https://api.github.com/users/Glitches","html_url":"https://github.com/Glitches","followers_url":"https://api.github.com/users/Glitches/followers","following_url":"https://api.github.com/users/Glitches/following{/other_user}","gists_url":"https://api.github.com/users/Glitches/gists{/gist_id}","starred_url":"https://api.github.com/users/Glitches/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Glitches/subscriptions","organizations_url":"https://api.github.com/users/Glitches/orgs","repos_url":"https://api.github.com/users/Glitches/repos","events_url":"https://api.github.com/users/Glitches/events{/privacy}","received_events_url":"https://api.github.com/users/Glitches/received_events","type":"User","site_admin":false},"body":"You mean the stringify?","created_at":"2018-02-04T17:30:48Z","updated_at":"2018-02-04T17:30:48Z","html_url":"https://github.com/sergipt/go-for-eat-server/pull/23#discussion_r165851400","pull_request_url":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/23","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/comments/165851400"},"html":{"href":"https://github.com/sergipt/go-for-eat-server/pull/23#discussion_r165851400"},"pull_request":{"href":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/23"}},"in_reply_to_id":165821026},"pull_request":{"url":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/23","id":166970462,"html_url":"https://github.com/sergipt/go-for-eat-server/pull/23","diff_url":"https://github.com/sergipt/go-for-eat-server/pull/23.diff","patch_url":"https://github.com/sergipt/go-for-eat-server/pull/23.patch","issue_url":"https://api.github.com/repos/sergipt/go-for-eat-server/issues/23","number":23,"state":"open","locked":false,"title":"Development","user":{"login":"Glitches","id":3679351,"avatar_url":"https://avatars1.githubusercontent.com/u/3679351?v=4","gravatar_id":"","url":"https://api.github.com/users/Glitches","html_url":"https://github.com/Glitches","followers_url":"https://api.github.com/users/Glitches/followers","following_url":"https://api.github.com/users/Glitches/following{/other_user}","gists_url":"https://api.github.com/users/Glitches/gists{/gist_id}","starred_url":"https://api.github.com/users/Glitches/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Glitches/subscriptions","organizations_url":"https://api.github.com/users/Glitches/orgs","repos_url":"https://api.github.com/users/Glitches/repos","events_url":"https://api.github.com/users/Glitches/events{/privacy}","received_events_url":"https://api.github.com/users/Glitches/received_events","type":"User","site_admin":false},"body":"First review","created_at":"2018-02-03T17:07:34Z","updated_at":"2018-02-04T17:30:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c36a3188c2d6645fd6e9df0cf7fce39b030d747","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/23/commits","review_comments_url":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/23/comments","review_comment_url":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sergipt/go-for-eat-server/issues/23/comments","statuses_url":"https://api.github.com/repos/sergipt/go-for-eat-server/statuses/91632ea3b6564869ce5bcf7de1a1eb3ce01b8c82","head":{"label":"sergipt:development","ref":"development","sha":"91632ea3b6564869ce5bcf7de1a1eb3ce01b8c82","user":{"login":"sergipt","id":12625986,"avatar_url":"https://avatars1.githubusercontent.com/u/12625986?v=4","gravatar_id":"","url":"https://api.github.com/users/sergipt","html_url":"https://github.com/sergipt","followers_url":"https://api.github.com/users/sergipt/followers","following_url":"https://api.github.com/users/sergipt/following{/other_user}","gists_url":"https://api.github.com/users/sergipt/gists{/gist_id}","starred_url":"https://api.github.com/users/sergipt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergipt/subscriptions","organizations_url":"https://api.github.com/users/sergipt/orgs","repos_url":"https://api.github.com/users/sergipt/repos","events_url":"https://api.github.com/users/sergipt/events{/privacy}","received_events_url":"https://api.github.com/users/sergipt/received_events","type":"User","site_admin":false},"repo":{"id":118919597,"name":"go-for-eat-server","full_name":"sergipt/go-for-eat-server","owner":{"login":"sergipt","id":12625986,"avatar_url":"https://avatars1.githubusercontent.com/u/12625986?v=4","gravatar_id":"","url":"https://api.github.com/users/sergipt","html_url":"https://github.com/sergipt","followers_url":"https://api.github.com/users/sergipt/followers","following_url":"https://api.github.com/users/sergipt/following{/other_user}","gists_url":"https://api.github.com/users/sergipt/gists{/gist_id}","starred_url":"https://api.github.com/users/sergipt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergipt/subscriptions","organizations_url":"https://api.github.com/users/sergipt/orgs","repos_url":"https://api.github.com/users/sergipt/repos","events_url":"https://api.github.com/users/sergipt/events{/privacy}","received_events_url":"https://api.github.com/users/sergipt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sergipt/go-for-eat-server","description":null,"fork":false,"url":"https://api.github.com/repos/sergipt/go-for-eat-server","forks_url":"https://api.github.com/repos/sergipt/go-for-eat-server/forks","keys_url":"https://api.github.com/repos/sergipt/go-for-eat-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sergipt/go-for-eat-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sergipt/go-for-eat-server/teams","hooks_url":"https://api.github.com/repos/sergipt/go-for-eat-server/hooks","issue_events_url":"https://api.github.com/repos/sergipt/go-for-eat-server/issues/events{/number}","events_url":"https://api.github.com/repos/sergipt/go-for-eat-server/events","assignees_url":"https://api.github.com/repos/sergipt/go-for-eat-server/assignees{/user}","branches_url":"https://api.github.com/repos/sergipt/go-for-eat-server/branches{/branch}","tags_url":"https://api.github.com/repos/sergipt/go-for-eat-server/tags","blobs_url":"https://api.github.com/repos/sergipt/go-for-eat-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sergipt/go-for-eat-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sergipt/go-for-eat-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/sergipt/go-for-eat-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sergipt/go-for-eat-server/statuses/{sha}","languages_url":"https://api.github.com/repos/sergipt/go-for-eat-server/languages","stargazers_url":"https://api.github.com/repos/sergipt/go-for-eat-server/stargazers","contributors_url":"https://api.github.com/repos/sergipt/go-for-eat-server/contributors","subscribers_url":"https://api.github.com/repos/sergipt/go-for-eat-server/subscribers","subscription_url":"https://api.github.com/repos/sergipt/go-for-eat-server/subscription","commits_url":"https://api.github.com/repos/sergipt/go-for-eat-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/sergipt/go-for-eat-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/sergipt/go-for-eat-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/sergipt/go-for-eat-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/sergipt/go-for-eat-server/contents/{+path}","compare_url":"https://api.github.com/repos/sergipt/go-for-eat-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sergipt/go-for-eat-server/merges","archive_url":"https://api.github.com/repos/sergipt/go-for-eat-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sergipt/go-for-eat-server/downloads","issues_url":"https://api.github.com/repos/sergipt/go-for-eat-server/issues{/number}","pulls_url":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls{/number}","milestones_url":"https://api.github.com/repos/sergipt/go-for-eat-server/milestones{/number}","notifications_url":"https://api.github.com/repos/sergipt/go-for-eat-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sergipt/go-for-eat-server/labels{/name}","releases_url":"https://api.github.com/repos/sergipt/go-for-eat-server/releases{/id}","deployments_url":"https://api.github.com/repos/sergipt/go-for-eat-server/deployments","created_at":"2018-01-25T13:59:56Z","updated_at":"2018-01-26T08:16:00Z","pushed_at":"2018-02-04T16:59:07Z","git_url":"git://github.com/sergipt/go-for-eat-server.git","ssh_url":"git@github.com:sergipt/go-for-eat-server.git","clone_url":"https://github.com/sergipt/go-for-eat-server.git","svn_url":"https://github.com/sergipt/go-for-eat-server","homepage":null,"size":228,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"sergipt:master","ref":"master","sha":"c6e2bcd47dcbefa9836eb3d49c47ce57e5e62a04","user":{"login":"sergipt","id":12625986,"avatar_url":"https://avatars1.githubusercontent.com/u/12625986?v=4","gravatar_id":"","url":"https://api.github.com/users/sergipt","html_url":"https://github.com/sergipt","followers_url":"https://api.github.com/users/sergipt/followers","following_url":"https://api.github.com/users/sergipt/following{/other_user}","gists_url":"https://api.github.com/users/sergipt/gists{/gist_id}","starred_url":"https://api.github.com/users/sergipt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergipt/subscriptions","organizations_url":"https://api.github.com/users/sergipt/orgs","repos_url":"https://api.github.com/users/sergipt/repos","events_url":"https://api.github.com/users/sergipt/events{/privacy}","received_events_url":"https://api.github.com/users/sergipt/received_events","type":"User","site_admin":false},"repo":{"id":118919597,"name":"go-for-eat-server","full_name":"sergipt/go-for-eat-server","owner":{"login":"sergipt","id":12625986,"avatar_url":"https://avatars1.githubusercontent.com/u/12625986?v=4","gravatar_id":"","url":"https://api.github.com/users/sergipt","html_url":"https://github.com/sergipt","followers_url":"https://api.github.com/users/sergipt/followers","following_url":"https://api.github.com/users/sergipt/following{/other_user}","gists_url":"https://api.github.com/users/sergipt/gists{/gist_id}","starred_url":"https://api.github.com/users/sergipt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergipt/subscriptions","organizations_url":"https://api.github.com/users/sergipt/orgs","repos_url":"https://api.github.com/users/sergipt/repos","events_url":"https://api.github.com/users/sergipt/events{/privacy}","received_events_url":"https://api.github.com/users/sergipt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sergipt/go-for-eat-server","description":null,"fork":false,"url":"https://api.github.com/repos/sergipt/go-for-eat-server","forks_url":"https://api.github.com/repos/sergipt/go-for-eat-server/forks","keys_url":"https://api.github.com/repos/sergipt/go-for-eat-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sergipt/go-for-eat-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sergipt/go-for-eat-server/teams","hooks_url":"https://api.github.com/repos/sergipt/go-for-eat-server/hooks","issue_events_url":"https://api.github.com/repos/sergipt/go-for-eat-server/issues/events{/number}","events_url":"https://api.github.com/repos/sergipt/go-for-eat-server/events","assignees_url":"https://api.github.com/repos/sergipt/go-for-eat-server/assignees{/user}","branches_url":"https://api.github.com/repos/sergipt/go-for-eat-server/branches{/branch}","tags_url":"https://api.github.com/repos/sergipt/go-for-eat-server/tags","blobs_url":"https://api.github.com/repos/sergipt/go-for-eat-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sergipt/go-for-eat-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sergipt/go-for-eat-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/sergipt/go-for-eat-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sergipt/go-for-eat-server/statuses/{sha}","languages_url":"https://api.github.com/repos/sergipt/go-for-eat-server/languages","stargazers_url":"https://api.github.com/repos/sergipt/go-for-eat-server/stargazers","contributors_url":"https://api.github.com/repos/sergipt/go-for-eat-server/contributors","subscribers_url":"https://api.github.com/repos/sergipt/go-for-eat-server/subscribers","subscription_url":"https://api.github.com/repos/sergipt/go-for-eat-server/subscription","commits_url":"https://api.github.com/repos/sergipt/go-for-eat-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/sergipt/go-for-eat-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/sergipt/go-for-eat-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/sergipt/go-for-eat-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/sergipt/go-for-eat-server/contents/{+path}","compare_url":"https://api.github.com/repos/sergipt/go-for-eat-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sergipt/go-for-eat-server/merges","archive_url":"https://api.github.com/repos/sergipt/go-for-eat-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sergipt/go-for-eat-server/downloads","issues_url":"https://api.github.com/repos/sergipt/go-for-eat-server/issues{/number}","pulls_url":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls{/number}","milestones_url":"https://api.github.com/repos/sergipt/go-for-eat-server/milestones{/number}","notifications_url":"https://api.github.com/repos/sergipt/go-for-eat-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sergipt/go-for-eat-server/labels{/name}","releases_url":"https://api.github.com/repos/sergipt/go-for-eat-server/releases{/id}","deployments_url":"https://api.github.com/repos/sergipt/go-for-eat-server/deployments","created_at":"2018-01-25T13:59:56Z","updated_at":"2018-01-26T08:16:00Z","pushed_at":"2018-02-04T16:59:07Z","git_url":"git://github.com/sergipt/go-for-eat-server.git","ssh_url":"git@github.com:sergipt/go-for-eat-server.git","clone_url":"https://github.com/sergipt/go-for-eat-server.git","svn_url":"https://github.com/sergipt/go-for-eat-server","homepage":null,"size":228,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/23"},"html":{"href":"https://github.com/sergipt/go-for-eat-server/pull/23"},"issue":{"href":"https://api.github.com/repos/sergipt/go-for-eat-server/issues/23"},"comments":{"href":"https://api.github.com/repos/sergipt/go-for-eat-server/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sergipt/go-for-eat-server/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/sergipt/go-for-eat-server/statuses/91632ea3b6564869ce5bcf7de1a1eb3ce01b8c82"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Glitches"}}