{"action":"created","comment":{"url":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/comments/228695087","pull_request_review_id":169035888,"id":228695087,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyODY5NTA4Nw==","diff_hunk":"@@ -0,0 +1,47 @@\n+import * as functions from 'firebase-functions'\n+import * as admin from 'firebase-admin'\n+import calculateResult from '../utils/calculateResult'\n+import { to } from '../utils/async'\n+\n+/**\n+ * @param req - Express HTTP Request\n+ * @param res - Express HTTP Response\n+ */\n+async function calculatorRequest(req, res) {\n+  const number1 = Number(req.body.number1)","path":"functions/src/calculator/index.js","position":11,"original_position":11,"commit_id":"d4d335604d0d93b7bd9f840ea4bb6ac106949bc8","original_commit_id":"d4d335604d0d93b7bd9f840ea4bb6ac106949bc8","user":{"login":"prescottprue","id":2992224,"node_id":"MDQ6VXNlcjI5OTIyMjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2992224?v=4","gravatar_id":"","url":"https://api.github.com/users/prescottprue","html_url":"https://github.com/prescottprue","followers_url":"https://api.github.com/users/prescottprue/followers","following_url":"https://api.github.com/users/prescottprue/following{/other_user}","gists_url":"https://api.github.com/users/prescottprue/gists{/gist_id}","starred_url":"https://api.github.com/users/prescottprue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prescottprue/subscriptions","organizations_url":"https://api.github.com/users/prescottprue/orgs","repos_url":"https://api.github.com/users/prescottprue/repos","events_url":"https://api.github.com/users/prescottprue/events{/privacy}","received_events_url":"https://api.github.com/users/prescottprue/received_events","type":"User","site_admin":false},"body":"It may be good to check for the object before getting the parameters off of it to prevent errors. It could be done using something [like `get` from lodash](https://lodash.com/docs/4.17.10#get) or destructuring with a default:\r\n\r\n```js\r\nconst {\r\n  number1: unparsedNumber1, \r\n  number2: unparsedNumber2\r\n} = req.body || {}\r\nconst number1 = Number(unparsedNumber1)\r\nconst number2 = Number(unparsedNumber2)\r\n```\r\nor\r\n```js\r\nimport { get } from 'lodash'\r\n\r\nconst number1 = Number(get(req, 'body.number1'))\r\nconst number2 = Number(get(req, 'body.number2'))\r\n```\r\n\r\nThis also brings up the point: Do we want it to assume 0 if no number is passed or return an error response to the user?","created_at":"2018-10-27T00:39:45Z","updated_at":"2018-10-27T00:41:04Z","html_url":"https://github.com/monisahmad/firebasefunctions/pull/1#discussion_r228695087","pull_request_url":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/comments/228695087"},"html":{"href":"https://github.com/monisahmad/firebasefunctions/pull/1#discussion_r228695087"},"pull_request":{"href":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/1","id":226256057,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2MjU2MDU3","html_url":"https://github.com/monisahmad/firebasefunctions/pull/1","diff_url":"https://github.com/monisahmad/firebasefunctions/pull/1.diff","patch_url":"https://github.com/monisahmad/firebasefunctions/pull/1.patch","issue_url":"https://api.github.com/repos/monisahmad/firebasefunctions/issues/1","number":1,"state":"open","locked":false,"title":"REM-12: Created Firebase Functions","user":{"login":"monisahmad","id":28215276,"node_id":"MDQ6VXNlcjI4MjE1Mjc2","avatar_url":"https://avatars1.githubusercontent.com/u/28215276?v=4","gravatar_id":"","url":"https://api.github.com/users/monisahmad","html_url":"https://github.com/monisahmad","followers_url":"https://api.github.com/users/monisahmad/followers","following_url":"https://api.github.com/users/monisahmad/following{/other_user}","gists_url":"https://api.github.com/users/monisahmad/gists{/gist_id}","starred_url":"https://api.github.com/users/monisahmad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monisahmad/subscriptions","organizations_url":"https://api.github.com/users/monisahmad/orgs","repos_url":"https://api.github.com/users/monisahmad/repos","events_url":"https://api.github.com/users/monisahmad/events{/privacy}","received_events_url":"https://api.github.com/users/monisahmad/received_events","type":"User","site_admin":false},"body":"### What's this PR do?\r\n\r\n- Firebase Function to perform simple calculator operations and store the result in Firestore and RTDB\r\n- Firebase Function to Watches the result of above function and store the double in another RTDB\r\n\r\n### What are the important parts of the code?\r\n\r\n- `functions/src/calculator/index`\r\n- `functions/src/doubleValue/index`\r\n\r\n### How should this be tested by the reviewer?\r\n- Test On delpoyed version https://us-central1-fir-functions-b96c5.cloudfunctions.net/calculator\r\n\r\n**Test as Role:**\r\nAny\r\n#### Set-up:\r\nNone\r\n#### Tests:\r\nNone\r\n\r\n#### Environments to test\r\n* Desktop - MacOS - Browser (Chrome)\r\n\r\n\r\n### Is any other information necessary to understand this?\r\n\r\n### What are the relevant tickets? (Please add `closes`, `refs`, etc)\r\n\r\n* closes [REM-12](https://residenetwork.atlassian.net/browse/REM-12)\r\n\r\n#### Screenshots (if appropriate)\r\nNone","created_at":"2018-10-27T00:23:58Z","updated_at":"2018-10-27T00:41:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd8da5da9ed76227bf2b33c723762a10cfe5628a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/1/commits","review_comments_url":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/1/comments","review_comment_url":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/monisahmad/firebasefunctions/issues/1/comments","statuses_url":"https://api.github.com/repos/monisahmad/firebasefunctions/statuses/d4d335604d0d93b7bd9f840ea4bb6ac106949bc8","head":{"label":"monisahmad:Monis-FirebaseFunctions","ref":"Monis-FirebaseFunctions","sha":"d4d335604d0d93b7bd9f840ea4bb6ac106949bc8","user":{"login":"monisahmad","id":28215276,"node_id":"MDQ6VXNlcjI4MjE1Mjc2","avatar_url":"https://avatars1.githubusercontent.com/u/28215276?v=4","gravatar_id":"","url":"https://api.github.com/users/monisahmad","html_url":"https://github.com/monisahmad","followers_url":"https://api.github.com/users/monisahmad/followers","following_url":"https://api.github.com/users/monisahmad/following{/other_user}","gists_url":"https://api.github.com/users/monisahmad/gists{/gist_id}","starred_url":"https://api.github.com/users/monisahmad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monisahmad/subscriptions","organizations_url":"https://api.github.com/users/monisahmad/orgs","repos_url":"https://api.github.com/users/monisahmad/repos","events_url":"https://api.github.com/users/monisahmad/events{/privacy}","received_events_url":"https://api.github.com/users/monisahmad/received_events","type":"User","site_admin":false},"repo":{"id":154906700,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQ5MDY3MDA=","name":"firebasefunctions","full_name":"monisahmad/firebasefunctions","private":false,"owner":{"login":"monisahmad","id":28215276,"node_id":"MDQ6VXNlcjI4MjE1Mjc2","avatar_url":"https://avatars1.githubusercontent.com/u/28215276?v=4","gravatar_id":"","url":"https://api.github.com/users/monisahmad","html_url":"https://github.com/monisahmad","followers_url":"https://api.github.com/users/monisahmad/followers","following_url":"https://api.github.com/users/monisahmad/following{/other_user}","gists_url":"https://api.github.com/users/monisahmad/gists{/gist_id}","starred_url":"https://api.github.com/users/monisahmad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monisahmad/subscriptions","organizations_url":"https://api.github.com/users/monisahmad/orgs","repos_url":"https://api.github.com/users/monisahmad/repos","events_url":"https://api.github.com/users/monisahmad/events{/privacy}","received_events_url":"https://api.github.com/users/monisahmad/received_events","type":"User","site_admin":false},"html_url":"https://github.com/monisahmad/firebasefunctions","description":"A demo of Firebase Functions","fork":false,"url":"https://api.github.com/repos/monisahmad/firebasefunctions","forks_url":"https://api.github.com/repos/monisahmad/firebasefunctions/forks","keys_url":"https://api.github.com/repos/monisahmad/firebasefunctions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/monisahmad/firebasefunctions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/monisahmad/firebasefunctions/teams","hooks_url":"https://api.github.com/repos/monisahmad/firebasefunctions/hooks","issue_events_url":"https://api.github.com/repos/monisahmad/firebasefunctions/issues/events{/number}","events_url":"https://api.github.com/repos/monisahmad/firebasefunctions/events","assignees_url":"https://api.github.com/repos/monisahmad/firebasefunctions/assignees{/user}","branches_url":"https://api.github.com/repos/monisahmad/firebasefunctions/branches{/branch}","tags_url":"https://api.github.com/repos/monisahmad/firebasefunctions/tags","blobs_url":"https://api.github.com/repos/monisahmad/firebasefunctions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/monisahmad/firebasefunctions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/monisahmad/firebasefunctions/git/refs{/sha}","trees_url":"https://api.github.com/repos/monisahmad/firebasefunctions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/monisahmad/firebasefunctions/statuses/{sha}","languages_url":"https://api.github.com/repos/monisahmad/firebasefunctions/languages","stargazers_url":"https://api.github.com/repos/monisahmad/firebasefunctions/stargazers","contributors_url":"https://api.github.com/repos/monisahmad/firebasefunctions/contributors","subscribers_url":"https://api.github.com/repos/monisahmad/firebasefunctions/subscribers","subscription_url":"https://api.github.com/repos/monisahmad/firebasefunctions/subscription","commits_url":"https://api.github.com/repos/monisahmad/firebasefunctions/commits{/sha}","git_commits_url":"https://api.github.com/repos/monisahmad/firebasefunctions/git/commits{/sha}","comments_url":"https://api.github.com/repos/monisahmad/firebasefunctions/comments{/number}","issue_comment_url":"https://api.github.com/repos/monisahmad/firebasefunctions/issues/comments{/number}","contents_url":"https://api.github.com/repos/monisahmad/firebasefunctions/contents/{+path}","compare_url":"https://api.github.com/repos/monisahmad/firebasefunctions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/monisahmad/firebasefunctions/merges","archive_url":"https://api.github.com/repos/monisahmad/firebasefunctions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/monisahmad/firebasefunctions/downloads","issues_url":"https://api.github.com/repos/monisahmad/firebasefunctions/issues{/number}","pulls_url":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls{/number}","milestones_url":"https://api.github.com/repos/monisahmad/firebasefunctions/milestones{/number}","notifications_url":"https://api.github.com/repos/monisahmad/firebasefunctions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/monisahmad/firebasefunctions/labels{/name}","releases_url":"https://api.github.com/repos/monisahmad/firebasefunctions/releases{/id}","deployments_url":"https://api.github.com/repos/monisahmad/firebasefunctions/deployments","created_at":"2018-10-27T00:00:15Z","updated_at":"2018-10-27T00:04:05Z","pushed_at":"2018-10-27T00:23:59Z","git_url":"git://github.com/monisahmad/firebasefunctions.git","ssh_url":"git@github.com:monisahmad/firebasefunctions.git","clone_url":"https://github.com/monisahmad/firebasefunctions.git","svn_url":"https://github.com/monisahmad/firebasefunctions","homepage":null,"size":0,"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":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"monisahmad:master","ref":"master","sha":"7be9c7ecfb00db9e0be0d77499112c9d66bab970","user":{"login":"monisahmad","id":28215276,"node_id":"MDQ6VXNlcjI4MjE1Mjc2","avatar_url":"https://avatars1.githubusercontent.com/u/28215276?v=4","gravatar_id":"","url":"https://api.github.com/users/monisahmad","html_url":"https://github.com/monisahmad","followers_url":"https://api.github.com/users/monisahmad/followers","following_url":"https://api.github.com/users/monisahmad/following{/other_user}","gists_url":"https://api.github.com/users/monisahmad/gists{/gist_id}","starred_url":"https://api.github.com/users/monisahmad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monisahmad/subscriptions","organizations_url":"https://api.github.com/users/monisahmad/orgs","repos_url":"https://api.github.com/users/monisahmad/repos","events_url":"https://api.github.com/users/monisahmad/events{/privacy}","received_events_url":"https://api.github.com/users/monisahmad/received_events","type":"User","site_admin":false},"repo":{"id":154906700,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQ5MDY3MDA=","name":"firebasefunctions","full_name":"monisahmad/firebasefunctions","private":false,"owner":{"login":"monisahmad","id":28215276,"node_id":"MDQ6VXNlcjI4MjE1Mjc2","avatar_url":"https://avatars1.githubusercontent.com/u/28215276?v=4","gravatar_id":"","url":"https://api.github.com/users/monisahmad","html_url":"https://github.com/monisahmad","followers_url":"https://api.github.com/users/monisahmad/followers","following_url":"https://api.github.com/users/monisahmad/following{/other_user}","gists_url":"https://api.github.com/users/monisahmad/gists{/gist_id}","starred_url":"https://api.github.com/users/monisahmad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monisahmad/subscriptions","organizations_url":"https://api.github.com/users/monisahmad/orgs","repos_url":"https://api.github.com/users/monisahmad/repos","events_url":"https://api.github.com/users/monisahmad/events{/privacy}","received_events_url":"https://api.github.com/users/monisahmad/received_events","type":"User","site_admin":false},"html_url":"https://github.com/monisahmad/firebasefunctions","description":"A demo of Firebase Functions","fork":false,"url":"https://api.github.com/repos/monisahmad/firebasefunctions","forks_url":"https://api.github.com/repos/monisahmad/firebasefunctions/forks","keys_url":"https://api.github.com/repos/monisahmad/firebasefunctions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/monisahmad/firebasefunctions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/monisahmad/firebasefunctions/teams","hooks_url":"https://api.github.com/repos/monisahmad/firebasefunctions/hooks","issue_events_url":"https://api.github.com/repos/monisahmad/firebasefunctions/issues/events{/number}","events_url":"https://api.github.com/repos/monisahmad/firebasefunctions/events","assignees_url":"https://api.github.com/repos/monisahmad/firebasefunctions/assignees{/user}","branches_url":"https://api.github.com/repos/monisahmad/firebasefunctions/branches{/branch}","tags_url":"https://api.github.com/repos/monisahmad/firebasefunctions/tags","blobs_url":"https://api.github.com/repos/monisahmad/firebasefunctions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/monisahmad/firebasefunctions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/monisahmad/firebasefunctions/git/refs{/sha}","trees_url":"https://api.github.com/repos/monisahmad/firebasefunctions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/monisahmad/firebasefunctions/statuses/{sha}","languages_url":"https://api.github.com/repos/monisahmad/firebasefunctions/languages","stargazers_url":"https://api.github.com/repos/monisahmad/firebasefunctions/stargazers","contributors_url":"https://api.github.com/repos/monisahmad/firebasefunctions/contributors","subscribers_url":"https://api.github.com/repos/monisahmad/firebasefunctions/subscribers","subscription_url":"https://api.github.com/repos/monisahmad/firebasefunctions/subscription","commits_url":"https://api.github.com/repos/monisahmad/firebasefunctions/commits{/sha}","git_commits_url":"https://api.github.com/repos/monisahmad/firebasefunctions/git/commits{/sha}","comments_url":"https://api.github.com/repos/monisahmad/firebasefunctions/comments{/number}","issue_comment_url":"https://api.github.com/repos/monisahmad/firebasefunctions/issues/comments{/number}","contents_url":"https://api.github.com/repos/monisahmad/firebasefunctions/contents/{+path}","compare_url":"https://api.github.com/repos/monisahmad/firebasefunctions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/monisahmad/firebasefunctions/merges","archive_url":"https://api.github.com/repos/monisahmad/firebasefunctions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/monisahmad/firebasefunctions/downloads","issues_url":"https://api.github.com/repos/monisahmad/firebasefunctions/issues{/number}","pulls_url":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls{/number}","milestones_url":"https://api.github.com/repos/monisahmad/firebasefunctions/milestones{/number}","notifications_url":"https://api.github.com/repos/monisahmad/firebasefunctions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/monisahmad/firebasefunctions/labels{/name}","releases_url":"https://api.github.com/repos/monisahmad/firebasefunctions/releases{/id}","deployments_url":"https://api.github.com/repos/monisahmad/firebasefunctions/deployments","created_at":"2018-10-27T00:00:15Z","updated_at":"2018-10-27T00:04:05Z","pushed_at":"2018-10-27T00:23:59Z","git_url":"git://github.com/monisahmad/firebasefunctions.git","ssh_url":"git@github.com:monisahmad/firebasefunctions.git","clone_url":"https://github.com/monisahmad/firebasefunctions.git","svn_url":"https://github.com/monisahmad/firebasefunctions","homepage":null,"size":0,"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":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/1"},"html":{"href":"https://github.com/monisahmad/firebasefunctions/pull/1"},"issue":{"href":"https://api.github.com/repos/monisahmad/firebasefunctions/issues/1"},"comments":{"href":"https://api.github.com/repos/monisahmad/firebasefunctions/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/monisahmad/firebasefunctions/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/monisahmad/firebasefunctions/statuses/d4d335604d0d93b7bd9f840ea4bb6ac106949bc8"}},"author_association":"OWNER"}}
{"actor":{"display_login":"prescottprue"}}