{"action":"created","comment":{"url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/comments/197728005","pull_request_review_id":131483334,"id":197728005,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NzcyODAwNQ==","diff_hunk":"@@ -7,34 +7,93 @@ import {\n   Param,\n   Body,\n   UsePipes,\n+  Res,\n } from '@nestjs/common';\n import { EventsDto } from './events.dto';\n import { EventsService } from './events.service';\n import { ValidationPipe } from 'validations/validation.pipe';\n import { Events } from './events.entity';\n+import { ValidationService } from '../utils/validations/validations.service';\n \n @Controller('events')\n export class EventsController {\n-  constructor(private readonly eventsService: EventsService) {}\n+  constructor(\n+    private readonly eventsService: EventsService,\n+    private readonly validationService: ValidationService,\n+  ) {}\n   @Get()\n-  async findAll(): Promise<Events[]> {\n-    return this.eventsService.findAll();\n+  async findAll(@Res() response): Promise<Events[]> {\n+    try {\n+      const events = await this.eventsService.findAll();\n+      if (events) {\n+        return response.status(200).send(events);\n+      } else {\n+        return response\n+          .status(404)\n+          .send(`Could not find any events in the system.`);\n+      }\n+    } catch (error) {\n+      return response\n+        .status(500)\n+        .send(`Failed to get events: ${error.message}`);\n+    }\n   }\n \n   @Post()\n   @UsePipes(new ValidationPipe())\n-  create(@Body() event: EventsDto) {\n-    return this.eventsService.createEvent(event);\n+  async create(@Res() response, @Body() event: EventsDto) {\n+    try {\n+      const createdEvent = await this.eventsService.createEvent(event);","path":"backend/src/event/events.controller.ts","position":45,"original_position":45,"commit_id":"b55e693afb72813c68d6183235459f1fec75b7c2","original_commit_id":"b55e693afb72813c68d6183235459f1fec75b7c2","user":{"login":"goforelauri","id":40238559,"node_id":"MDQ6VXNlcjQwMjM4NTU5","avatar_url":"https://avatars3.githubusercontent.com/u/40238559?v=4","gravatar_id":"","url":"https://api.github.com/users/goforelauri","html_url":"https://github.com/goforelauri","followers_url":"https://api.github.com/users/goforelauri/followers","following_url":"https://api.github.com/users/goforelauri/following{/other_user}","gists_url":"https://api.github.com/users/goforelauri/gists{/gist_id}","starred_url":"https://api.github.com/users/goforelauri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goforelauri/subscriptions","organizations_url":"https://api.github.com/users/goforelauri/orgs","repos_url":"https://api.github.com/users/goforelauri/repos","events_url":"https://api.github.com/users/goforelauri/events{/privacy}","received_events_url":"https://api.github.com/users/goforelauri/received_events","type":"User","site_admin":false},"body":"Would it be also possible to validate the event data before trying to create it?","created_at":"2018-06-25T09:13:22Z","updated_at":"2018-06-25T09:32:12Z","html_url":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents/pull/4#discussion_r197728005","pull_request_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/4","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/comments/197728005"},"html":{"href":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents/pull/4#discussion_r197728005"},"pull_request":{"href":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/4","id":196754968,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2NzU0OTY4","html_url":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents/pull/4","diff_url":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents/pull/4.diff","patch_url":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents/pull/4.patch","issue_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/issues/4","number":4,"state":"open","locked":false,"title":"Changes for making a reservation","user":{"login":"shamnadps","id":3147778,"node_id":"MDQ6VXNlcjMxNDc3Nzg=","avatar_url":"https://avatars2.githubusercontent.com/u/3147778?v=4","gravatar_id":"","url":"https://api.github.com/users/shamnadps","html_url":"https://github.com/shamnadps","followers_url":"https://api.github.com/users/shamnadps/followers","following_url":"https://api.github.com/users/shamnadps/following{/other_user}","gists_url":"https://api.github.com/users/shamnadps/gists{/gist_id}","starred_url":"https://api.github.com/users/shamnadps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shamnadps/subscriptions","organizations_url":"https://api.github.com/users/shamnadps/orgs","repos_url":"https://api.github.com/users/shamnadps/repos","events_url":"https://api.github.com/users/shamnadps/events{/privacy}","received_events_url":"https://api.github.com/users/shamnadps/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-22T14:29:02Z","updated_at":"2018-06-25T09:32:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"20aa19a9853c86a1a8e16b190e0d4dd020477c30","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/4/commits","review_comments_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/4/comments","review_comment_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/comments{/number}","comments_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/issues/4/comments","statuses_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/statuses/b55e693afb72813c68d6183235459f1fec75b7c2","head":{"label":"City-of-Vantaa-SmartLab:reservations","ref":"reservations","sha":"b55e693afb72813c68d6183235459f1fec75b7c2","user":{"login":"City-of-Vantaa-SmartLab","id":26002577,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MDAyNTc3","avatar_url":"https://avatars2.githubusercontent.com/u/26002577?v=4","gravatar_id":"","url":"https://api.github.com/users/City-of-Vantaa-SmartLab","html_url":"https://github.com/City-of-Vantaa-SmartLab","followers_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/followers","following_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/following{/other_user}","gists_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/gists{/gist_id}","starred_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/subscriptions","organizations_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/orgs","repos_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/repos","events_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/events{/privacy}","received_events_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/received_events","type":"Organization","site_admin":false},"repo":{"id":137205085,"node_id":"MDEwOlJlcG9zaXRvcnkxMzcyMDUwODU=","name":"CultureEvents","full_name":"City-of-Vantaa-SmartLab/CultureEvents","owner":{"login":"City-of-Vantaa-SmartLab","id":26002577,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MDAyNTc3","avatar_url":"https://avatars2.githubusercontent.com/u/26002577?v=4","gravatar_id":"","url":"https://api.github.com/users/City-of-Vantaa-SmartLab","html_url":"https://github.com/City-of-Vantaa-SmartLab","followers_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/followers","following_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/following{/other_user}","gists_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/gists{/gist_id}","starred_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/subscriptions","organizations_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/orgs","repos_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/repos","events_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/events{/privacy}","received_events_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents","description":null,"fork":false,"url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents","forks_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/forks","keys_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/keys{/key_id}","collaborators_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/teams","hooks_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/hooks","issue_events_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/issues/events{/number}","events_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/events","assignees_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/assignees{/user}","branches_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/branches{/branch}","tags_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/tags","blobs_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/git/refs{/sha}","trees_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/git/trees{/sha}","statuses_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/statuses/{sha}","languages_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/languages","stargazers_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/stargazers","contributors_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/contributors","subscribers_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/subscribers","subscription_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/subscription","commits_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/commits{/sha}","git_commits_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/git/commits{/sha}","comments_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/comments{/number}","issue_comment_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/issues/comments{/number}","contents_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/contents/{+path}","compare_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/compare/{base}...{head}","merges_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/merges","archive_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/downloads","issues_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/issues{/number}","pulls_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls{/number}","milestones_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/milestones{/number}","notifications_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/labels{/name}","releases_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/releases{/id}","deployments_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/deployments","created_at":"2018-06-13T11:15:52Z","updated_at":"2018-06-22T12:14:23Z","pushed_at":"2018-06-25T08:54:49Z","git_url":"git://github.com/City-of-Vantaa-SmartLab/CultureEvents.git","ssh_url":"git@github.com:City-of-Vantaa-SmartLab/CultureEvents.git","clone_url":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents.git","svn_url":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents","homepage":null,"size":1300,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"City-of-Vantaa-SmartLab:master","ref":"master","sha":"cdd6d72c1686c993bbf0a84d6471f9d83cc0a8b8","user":{"login":"City-of-Vantaa-SmartLab","id":26002577,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MDAyNTc3","avatar_url":"https://avatars2.githubusercontent.com/u/26002577?v=4","gravatar_id":"","url":"https://api.github.com/users/City-of-Vantaa-SmartLab","html_url":"https://github.com/City-of-Vantaa-SmartLab","followers_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/followers","following_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/following{/other_user}","gists_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/gists{/gist_id}","starred_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/subscriptions","organizations_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/orgs","repos_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/repos","events_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/events{/privacy}","received_events_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/received_events","type":"Organization","site_admin":false},"repo":{"id":137205085,"node_id":"MDEwOlJlcG9zaXRvcnkxMzcyMDUwODU=","name":"CultureEvents","full_name":"City-of-Vantaa-SmartLab/CultureEvents","owner":{"login":"City-of-Vantaa-SmartLab","id":26002577,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MDAyNTc3","avatar_url":"https://avatars2.githubusercontent.com/u/26002577?v=4","gravatar_id":"","url":"https://api.github.com/users/City-of-Vantaa-SmartLab","html_url":"https://github.com/City-of-Vantaa-SmartLab","followers_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/followers","following_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/following{/other_user}","gists_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/gists{/gist_id}","starred_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/subscriptions","organizations_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/orgs","repos_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/repos","events_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/events{/privacy}","received_events_url":"https://api.github.com/users/City-of-Vantaa-SmartLab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents","description":null,"fork":false,"url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents","forks_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/forks","keys_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/keys{/key_id}","collaborators_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/teams","hooks_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/hooks","issue_events_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/issues/events{/number}","events_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/events","assignees_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/assignees{/user}","branches_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/branches{/branch}","tags_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/tags","blobs_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/git/refs{/sha}","trees_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/git/trees{/sha}","statuses_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/statuses/{sha}","languages_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/languages","stargazers_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/stargazers","contributors_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/contributors","subscribers_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/subscribers","subscription_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/subscription","commits_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/commits{/sha}","git_commits_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/git/commits{/sha}","comments_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/comments{/number}","issue_comment_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/issues/comments{/number}","contents_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/contents/{+path}","compare_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/compare/{base}...{head}","merges_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/merges","archive_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/downloads","issues_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/issues{/number}","pulls_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls{/number}","milestones_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/milestones{/number}","notifications_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/labels{/name}","releases_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/releases{/id}","deployments_url":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/deployments","created_at":"2018-06-13T11:15:52Z","updated_at":"2018-06-22T12:14:23Z","pushed_at":"2018-06-25T08:54:49Z","git_url":"git://github.com/City-of-Vantaa-SmartLab/CultureEvents.git","ssh_url":"git@github.com:City-of-Vantaa-SmartLab/CultureEvents.git","clone_url":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents.git","svn_url":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents","homepage":null,"size":1300,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/4"},"html":{"href":"https://github.com/City-of-Vantaa-SmartLab/CultureEvents/pull/4"},"issue":{"href":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/issues/4"},"comments":{"href":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/City-of-Vantaa-SmartLab/CultureEvents/statuses/b55e693afb72813c68d6183235459f1fec75b7c2"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"goforelauri"}}