{"action":"created","comment":{"url":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/comments/88814298","pull_request_review_id":9375558,"id":88814298,"diff_hunk":"@@ -0,0 +1,66 @@\n+const PERIOD_TO_INTERVAL = {\n+    'day': 60,\n+    'week': 60,\n+    'month': 60*24,\n+    'year': 60*24\n+};\n+\n+import APIError from '../helpers/APIError';\n+import httpStatus from 'http-status';\n+import moment from 'moment';\n+\n+function query(req, res, next) {\n+\n+    if (!req.query.period || ! PERIOD_TO_INTERVAL.hasOwnProperty(req.query.period)) {\n+        const err = new APIError('Period is not provided to wrong', httpStatus.BAD_REQUEST);\n+        return next(err);\n+    }\n+\n+    if (!req.query.sensor) {\n+        const err = new APIError('Sensor is not provided', httpStatus.BAD_REQUEST);\n+        return next(err);\n+    }\n+\n+    const sensor = req.query.sensor;\n+    const period = req.query.period;\n+    const stepMin = PERIOD_TO_INTERVAL[period];\n+    const from = moment();\n+    const to = from.clone();\n+\n+    // Period","path":"src/API/timeseries/timeseries.controller.js","position":30,"original_position":30,"commit_id":"8306b88a1182096ac660d383245bdf8e4ddca46e","original_commit_id":"8306b88a1182096ac660d383245bdf8e4ddca46e","user":{"login":"vreshch","id":9742863,"avatar_url":"https://avatars.githubusercontent.com/u/9742863?v=3","gravatar_id":"","url":"https://api.github.com/users/vreshch","html_url":"https://github.com/vreshch","followers_url":"https://api.github.com/users/vreshch/followers","following_url":"https://api.github.com/users/vreshch/following{/other_user}","gists_url":"https://api.github.com/users/vreshch/gists{/gist_id}","starred_url":"https://api.github.com/users/vreshch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vreshch/subscriptions","organizations_url":"https://api.github.com/users/vreshch/orgs","repos_url":"https://api.github.com/users/vreshch/repos","events_url":"https://api.github.com/users/vreshch/events{/privacy}","received_events_url":"https://api.github.com/users/vreshch/received_events","type":"User","site_admin":false},"body":"agree, but for now it's just mock data","created_at":"2016-11-20T22:57:08Z","updated_at":"2016-11-20T22:57:08Z","html_url":"https://github.com/garage-it/SmartHouse-backend/pull/71#discussion_r88814298","pull_request_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/comments/88814298"},"html":{"href":"https://github.com/garage-it/SmartHouse-backend/pull/71#discussion_r88814298"},"pull_request":{"href":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/71","id":93403949,"html_url":"https://github.com/garage-it/SmartHouse-backend/pull/71","diff_url":"https://github.com/garage-it/SmartHouse-backend/pull/71.diff","patch_url":"https://github.com/garage-it/SmartHouse-backend/pull/71.patch","issue_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/issues/71","number":71,"state":"open","locked":false,"title":"feat(TG-277): timeseries","user":{"login":"vreshch","id":9742863,"avatar_url":"https://avatars.githubusercontent.com/u/9742863?v=3","gravatar_id":"","url":"https://api.github.com/users/vreshch","html_url":"https://github.com/vreshch","followers_url":"https://api.github.com/users/vreshch/followers","following_url":"https://api.github.com/users/vreshch/following{/other_user}","gists_url":"https://api.github.com/users/vreshch/gists{/gist_id}","starred_url":"https://api.github.com/users/vreshch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vreshch/subscriptions","organizations_url":"https://api.github.com/users/vreshch/orgs","repos_url":"https://api.github.com/users/vreshch/repos","events_url":"https://api.github.com/users/vreshch/events{/privacy}","received_events_url":"https://api.github.com/users/vreshch/received_events","type":"User","site_admin":false},"body":"mock backend for timeseries","created_at":"2016-11-11T21:49:32Z","updated_at":"2016-11-20T22:57:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d12bdfc6a5de30b3593c57494692063de06e4ab9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/71/commits","review_comments_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/71/comments","review_comment_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/issues/71/comments","statuses_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/statuses/8306b88a1182096ac660d383245bdf8e4ddca46e","head":{"label":"garage-it:story/TG-277","ref":"story/TG-277","sha":"8306b88a1182096ac660d383245bdf8e4ddca46e","user":{"login":"garage-it","id":17927734,"avatar_url":"https://avatars.githubusercontent.com/u/17927734?v=3","gravatar_id":"","url":"https://api.github.com/users/garage-it","html_url":"https://github.com/garage-it","followers_url":"https://api.github.com/users/garage-it/followers","following_url":"https://api.github.com/users/garage-it/following{/other_user}","gists_url":"https://api.github.com/users/garage-it/gists{/gist_id}","starred_url":"https://api.github.com/users/garage-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garage-it/subscriptions","organizations_url":"https://api.github.com/users/garage-it/orgs","repos_url":"https://api.github.com/users/garage-it/repos","events_url":"https://api.github.com/users/garage-it/events{/privacy}","received_events_url":"https://api.github.com/users/garage-it/received_events","type":"Organization","site_admin":false},"repo":{"id":54199833,"name":"SmartHouse-backend","full_name":"garage-it/SmartHouse-backend","owner":{"login":"garage-it","id":17927734,"avatar_url":"https://avatars.githubusercontent.com/u/17927734?v=3","gravatar_id":"","url":"https://api.github.com/users/garage-it","html_url":"https://github.com/garage-it","followers_url":"https://api.github.com/users/garage-it/followers","following_url":"https://api.github.com/users/garage-it/following{/other_user}","gists_url":"https://api.github.com/users/garage-it/gists{/gist_id}","starred_url":"https://api.github.com/users/garage-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garage-it/subscriptions","organizations_url":"https://api.github.com/users/garage-it/orgs","repos_url":"https://api.github.com/users/garage-it/repos","events_url":"https://api.github.com/users/garage-it/events{/privacy}","received_events_url":"https://api.github.com/users/garage-it/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/garage-it/SmartHouse-backend","description":null,"fork":false,"url":"https://api.github.com/repos/garage-it/SmartHouse-backend","forks_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/forks","keys_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/teams","hooks_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/hooks","issue_events_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/issues/events{/number}","events_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/events","assignees_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/assignees{/user}","branches_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/branches{/branch}","tags_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/tags","blobs_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/languages","stargazers_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/stargazers","contributors_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/contributors","subscribers_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/subscribers","subscription_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/subscription","commits_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/contents/{+path}","compare_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/merges","archive_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/downloads","issues_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/issues{/number}","pulls_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/labels{/name}","releases_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/releases{/id}","deployments_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/deployments","created_at":"2016-03-18T12:34:23Z","updated_at":"2016-11-01T16:14:20Z","pushed_at":"2016-11-16T22:31:11Z","git_url":"git://github.com/garage-it/SmartHouse-backend.git","ssh_url":"git@github.com:garage-it/SmartHouse-backend.git","clone_url":"https://github.com/garage-it/SmartHouse-backend.git","svn_url":"https://github.com/garage-it/SmartHouse-backend","homepage":null,"size":261,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":7,"default_branch":"master"}},"base":{"label":"garage-it:master","ref":"master","sha":"dcb6c11d315cbb9d7e7bc87a908ac9d6aaa362fa","user":{"login":"garage-it","id":17927734,"avatar_url":"https://avatars.githubusercontent.com/u/17927734?v=3","gravatar_id":"","url":"https://api.github.com/users/garage-it","html_url":"https://github.com/garage-it","followers_url":"https://api.github.com/users/garage-it/followers","following_url":"https://api.github.com/users/garage-it/following{/other_user}","gists_url":"https://api.github.com/users/garage-it/gists{/gist_id}","starred_url":"https://api.github.com/users/garage-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garage-it/subscriptions","organizations_url":"https://api.github.com/users/garage-it/orgs","repos_url":"https://api.github.com/users/garage-it/repos","events_url":"https://api.github.com/users/garage-it/events{/privacy}","received_events_url":"https://api.github.com/users/garage-it/received_events","type":"Organization","site_admin":false},"repo":{"id":54199833,"name":"SmartHouse-backend","full_name":"garage-it/SmartHouse-backend","owner":{"login":"garage-it","id":17927734,"avatar_url":"https://avatars.githubusercontent.com/u/17927734?v=3","gravatar_id":"","url":"https://api.github.com/users/garage-it","html_url":"https://github.com/garage-it","followers_url":"https://api.github.com/users/garage-it/followers","following_url":"https://api.github.com/users/garage-it/following{/other_user}","gists_url":"https://api.github.com/users/garage-it/gists{/gist_id}","starred_url":"https://api.github.com/users/garage-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garage-it/subscriptions","organizations_url":"https://api.github.com/users/garage-it/orgs","repos_url":"https://api.github.com/users/garage-it/repos","events_url":"https://api.github.com/users/garage-it/events{/privacy}","received_events_url":"https://api.github.com/users/garage-it/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/garage-it/SmartHouse-backend","description":null,"fork":false,"url":"https://api.github.com/repos/garage-it/SmartHouse-backend","forks_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/forks","keys_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/teams","hooks_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/hooks","issue_events_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/issues/events{/number}","events_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/events","assignees_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/assignees{/user}","branches_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/branches{/branch}","tags_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/tags","blobs_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/languages","stargazers_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/stargazers","contributors_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/contributors","subscribers_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/subscribers","subscription_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/subscription","commits_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/contents/{+path}","compare_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/merges","archive_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/downloads","issues_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/issues{/number}","pulls_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/labels{/name}","releases_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/releases{/id}","deployments_url":"https://api.github.com/repos/garage-it/SmartHouse-backend/deployments","created_at":"2016-03-18T12:34:23Z","updated_at":"2016-11-01T16:14:20Z","pushed_at":"2016-11-16T22:31:11Z","git_url":"git://github.com/garage-it/SmartHouse-backend.git","ssh_url":"git@github.com:garage-it/SmartHouse-backend.git","clone_url":"https://github.com/garage-it/SmartHouse-backend.git","svn_url":"https://github.com/garage-it/SmartHouse-backend","homepage":null,"size":261,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/71"},"html":{"href":"https://github.com/garage-it/SmartHouse-backend/pull/71"},"issue":{"href":"https://api.github.com/repos/garage-it/SmartHouse-backend/issues/71"},"comments":{"href":"https://api.github.com/repos/garage-it/SmartHouse-backend/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/garage-it/SmartHouse-backend/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/garage-it/SmartHouse-backend/statuses/8306b88a1182096ac660d383245bdf8e4ddca46e"}}}}
{"actor":{"display_login":"vreshch"}}