{"action":"created","comment":{"url":"https://api.github.com/repos/lena-team/lena-orders/pulls/comments/147043097","pull_request_review_id":72075785,"id":147043097,"diff_hunk":"@@ -0,0 +1,63 @@\n+const { Client } = require('pg');\n+const Promise = require('bluebird');\n+\n+const client = new Client({\n+  user: process.env.LENA_ORDERS_DB_USER || 'lena',\n+  host: process.env.LENA_ORDERS_DB_HOST || 'localhost',\n+  database: process.env.LENA_ORDERS_DB_data || 'transactions',\n+  port: process.env.LENA_ORDERS_DB_PORT || 5432,\n+});\n+\n+client.connect();\n+\n+const createOrder = (userId, shippingAddress) => {\n+  const queryStr = `\n+    INSERT INTO orders\n+    (user_id, shipping_address, delivery_status, created_at)\n+    VALUES\n+    ($1, $2, 'created', $3)\n+  `;\n+  const currDate = new Date().toISOString().slice(0, 10);\n+  const queryArgs = [userId, shippingAddress, currDate];\n+  return new Promise((resolve, reject) => {\n+    client.query(queryStr, queryArgs, (err, res) => {\n+      if (err) {","path":"database/index.js","position":24,"original_position":24,"commit_id":"dbb458e891b019969a4fe83aaf44f30439b732c0","original_commit_id":"dbb458e891b019969a4fe83aaf44f30439b732c0","user":{"login":"eugenesoo","id":20952179,"avatar_url":"https://avatars2.githubusercontent.com/u/20952179?v=4","gravatar_id":"","url":"https://api.github.com/users/eugenesoo","html_url":"https://github.com/eugenesoo","followers_url":"https://api.github.com/users/eugenesoo/followers","following_url":"https://api.github.com/users/eugenesoo/following{/other_user}","gists_url":"https://api.github.com/users/eugenesoo/gists{/gist_id}","starred_url":"https://api.github.com/users/eugenesoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eugenesoo/subscriptions","organizations_url":"https://api.github.com/users/eugenesoo/orgs","repos_url":"https://api.github.com/users/eugenesoo/repos","events_url":"https://api.github.com/users/eugenesoo/events{/privacy}","received_events_url":"https://api.github.com/users/eugenesoo/received_events","type":"User","site_admin":false},"body":"not a big deal, but i guess ternary operators would do here as well?","created_at":"2017-10-26T04:21:31Z","updated_at":"2017-10-26T04:21:31Z","html_url":"https://github.com/lena-team/lena-orders/pull/5#discussion_r147043097","pull_request_url":"https://api.github.com/repos/lena-team/lena-orders/pulls/5","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/lena-team/lena-orders/pulls/comments/147043097"},"html":{"href":"https://github.com/lena-team/lena-orders/pull/5#discussion_r147043097"},"pull_request":{"href":"https://api.github.com/repos/lena-team/lena-orders/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/lena-team/lena-orders/pulls/5","id":148750368,"html_url":"https://github.com/lena-team/lena-orders/pull/5","diff_url":"https://github.com/lena-team/lena-orders/pull/5.diff","patch_url":"https://github.com/lena-team/lena-orders/pull/5.patch","issue_url":"https://api.github.com/repos/lena-team/lena-orders/issues/5","number":5,"state":"open","locked":false,"title":"Feat/db queries","user":{"login":"Blaradox","id":19960414,"avatar_url":"https://avatars0.githubusercontent.com/u/19960414?v=4","gravatar_id":"","url":"https://api.github.com/users/Blaradox","html_url":"https://github.com/Blaradox","followers_url":"https://api.github.com/users/Blaradox/followers","following_url":"https://api.github.com/users/Blaradox/following{/other_user}","gists_url":"https://api.github.com/users/Blaradox/gists{/gist_id}","starred_url":"https://api.github.com/users/Blaradox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blaradox/subscriptions","organizations_url":"https://api.github.com/users/Blaradox/orgs","repos_url":"https://api.github.com/users/Blaradox/repos","events_url":"https://api.github.com/users/Blaradox/events{/privacy}","received_events_url":"https://api.github.com/users/Blaradox/received_events","type":"User","site_admin":false},"body":"created two functions that modify the database. One function will add orders to the database, and the other will update that order with a supplied delivery status and date in the 'YYYY-MM-DD' format. For now I will be ignoring adding products to each order, as that is not relevant to the business question and I want to focus first on data generation.","created_at":"2017-10-25T18:49:15Z","updated_at":"2017-10-26T04:21:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d22ab12b738aed28759a236a58b524e33cf17beb","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/lena-team/lena-orders/pulls/5/commits","review_comments_url":"https://api.github.com/repos/lena-team/lena-orders/pulls/5/comments","review_comment_url":"https://api.github.com/repos/lena-team/lena-orders/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lena-team/lena-orders/issues/5/comments","statuses_url":"https://api.github.com/repos/lena-team/lena-orders/statuses/dbb458e891b019969a4fe83aaf44f30439b732c0","head":{"label":"lena-team:feat/dbQueries","ref":"feat/dbQueries","sha":"dbb458e891b019969a4fe83aaf44f30439b732c0","user":{"login":"lena-team","id":32881511,"avatar_url":"https://avatars1.githubusercontent.com/u/32881511?v=4","gravatar_id":"","url":"https://api.github.com/users/lena-team","html_url":"https://github.com/lena-team","followers_url":"https://api.github.com/users/lena-team/followers","following_url":"https://api.github.com/users/lena-team/following{/other_user}","gists_url":"https://api.github.com/users/lena-team/gists{/gist_id}","starred_url":"https://api.github.com/users/lena-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lena-team/subscriptions","organizations_url":"https://api.github.com/users/lena-team/orgs","repos_url":"https://api.github.com/users/lena-team/repos","events_url":"https://api.github.com/users/lena-team/events{/privacy}","received_events_url":"https://api.github.com/users/lena-team/received_events","type":"Organization","site_admin":false},"repo":{"id":108067797,"name":"lena-orders","full_name":"lena-team/lena-orders","owner":{"login":"lena-team","id":32881511,"avatar_url":"https://avatars1.githubusercontent.com/u/32881511?v=4","gravatar_id":"","url":"https://api.github.com/users/lena-team","html_url":"https://github.com/lena-team","followers_url":"https://api.github.com/users/lena-team/followers","following_url":"https://api.github.com/users/lena-team/following{/other_user}","gists_url":"https://api.github.com/users/lena-team/gists{/gist_id}","starred_url":"https://api.github.com/users/lena-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lena-team/subscriptions","organizations_url":"https://api.github.com/users/lena-team/orgs","repos_url":"https://api.github.com/users/lena-team/repos","events_url":"https://api.github.com/users/lena-team/events{/privacy}","received_events_url":"https://api.github.com/users/lena-team/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lena-team/lena-orders","description":"this service manages and stores all orders created by consumers and sends any relevant information to the Analytics service","fork":false,"url":"https://api.github.com/repos/lena-team/lena-orders","forks_url":"https://api.github.com/repos/lena-team/lena-orders/forks","keys_url":"https://api.github.com/repos/lena-team/lena-orders/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lena-team/lena-orders/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lena-team/lena-orders/teams","hooks_url":"https://api.github.com/repos/lena-team/lena-orders/hooks","issue_events_url":"https://api.github.com/repos/lena-team/lena-orders/issues/events{/number}","events_url":"https://api.github.com/repos/lena-team/lena-orders/events","assignees_url":"https://api.github.com/repos/lena-team/lena-orders/assignees{/user}","branches_url":"https://api.github.com/repos/lena-team/lena-orders/branches{/branch}","tags_url":"https://api.github.com/repos/lena-team/lena-orders/tags","blobs_url":"https://api.github.com/repos/lena-team/lena-orders/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lena-team/lena-orders/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lena-team/lena-orders/git/refs{/sha}","trees_url":"https://api.github.com/repos/lena-team/lena-orders/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lena-team/lena-orders/statuses/{sha}","languages_url":"https://api.github.com/repos/lena-team/lena-orders/languages","stargazers_url":"https://api.github.com/repos/lena-team/lena-orders/stargazers","contributors_url":"https://api.github.com/repos/lena-team/lena-orders/contributors","subscribers_url":"https://api.github.com/repos/lena-team/lena-orders/subscribers","subscription_url":"https://api.github.com/repos/lena-team/lena-orders/subscription","commits_url":"https://api.github.com/repos/lena-team/lena-orders/commits{/sha}","git_commits_url":"https://api.github.com/repos/lena-team/lena-orders/git/commits{/sha}","comments_url":"https://api.github.com/repos/lena-team/lena-orders/comments{/number}","issue_comment_url":"https://api.github.com/repos/lena-team/lena-orders/issues/comments{/number}","contents_url":"https://api.github.com/repos/lena-team/lena-orders/contents/{+path}","compare_url":"https://api.github.com/repos/lena-team/lena-orders/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lena-team/lena-orders/merges","archive_url":"https://api.github.com/repos/lena-team/lena-orders/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lena-team/lena-orders/downloads","issues_url":"https://api.github.com/repos/lena-team/lena-orders/issues{/number}","pulls_url":"https://api.github.com/repos/lena-team/lena-orders/pulls{/number}","milestones_url":"https://api.github.com/repos/lena-team/lena-orders/milestones{/number}","notifications_url":"https://api.github.com/repos/lena-team/lena-orders/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lena-team/lena-orders/labels{/name}","releases_url":"https://api.github.com/repos/lena-team/lena-orders/releases{/id}","deployments_url":"https://api.github.com/repos/lena-team/lena-orders/deployments","created_at":"2017-10-24T02:37:52Z","updated_at":"2017-10-24T03:11:26Z","pushed_at":"2017-10-26T02:49:05Z","git_url":"git://github.com/lena-team/lena-orders.git","ssh_url":"git@github.com:lena-team/lena-orders.git","clone_url":"https://github.com/lena-team/lena-orders.git","svn_url":"https://github.com/lena-team/lena-orders","homepage":null,"size":55,"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,"forks":0,"open_issues":2,"watchers":0,"default_branch":"develop"}},"base":{"label":"lena-team:develop","ref":"develop","sha":"01b60ffc6ca46921b9f673a6f751957e5de03325","user":{"login":"lena-team","id":32881511,"avatar_url":"https://avatars1.githubusercontent.com/u/32881511?v=4","gravatar_id":"","url":"https://api.github.com/users/lena-team","html_url":"https://github.com/lena-team","followers_url":"https://api.github.com/users/lena-team/followers","following_url":"https://api.github.com/users/lena-team/following{/other_user}","gists_url":"https://api.github.com/users/lena-team/gists{/gist_id}","starred_url":"https://api.github.com/users/lena-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lena-team/subscriptions","organizations_url":"https://api.github.com/users/lena-team/orgs","repos_url":"https://api.github.com/users/lena-team/repos","events_url":"https://api.github.com/users/lena-team/events{/privacy}","received_events_url":"https://api.github.com/users/lena-team/received_events","type":"Organization","site_admin":false},"repo":{"id":108067797,"name":"lena-orders","full_name":"lena-team/lena-orders","owner":{"login":"lena-team","id":32881511,"avatar_url":"https://avatars1.githubusercontent.com/u/32881511?v=4","gravatar_id":"","url":"https://api.github.com/users/lena-team","html_url":"https://github.com/lena-team","followers_url":"https://api.github.com/users/lena-team/followers","following_url":"https://api.github.com/users/lena-team/following{/other_user}","gists_url":"https://api.github.com/users/lena-team/gists{/gist_id}","starred_url":"https://api.github.com/users/lena-team/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lena-team/subscriptions","organizations_url":"https://api.github.com/users/lena-team/orgs","repos_url":"https://api.github.com/users/lena-team/repos","events_url":"https://api.github.com/users/lena-team/events{/privacy}","received_events_url":"https://api.github.com/users/lena-team/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lena-team/lena-orders","description":"this service manages and stores all orders created by consumers and sends any relevant information to the Analytics service","fork":false,"url":"https://api.github.com/repos/lena-team/lena-orders","forks_url":"https://api.github.com/repos/lena-team/lena-orders/forks","keys_url":"https://api.github.com/repos/lena-team/lena-orders/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lena-team/lena-orders/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lena-team/lena-orders/teams","hooks_url":"https://api.github.com/repos/lena-team/lena-orders/hooks","issue_events_url":"https://api.github.com/repos/lena-team/lena-orders/issues/events{/number}","events_url":"https://api.github.com/repos/lena-team/lena-orders/events","assignees_url":"https://api.github.com/repos/lena-team/lena-orders/assignees{/user}","branches_url":"https://api.github.com/repos/lena-team/lena-orders/branches{/branch}","tags_url":"https://api.github.com/repos/lena-team/lena-orders/tags","blobs_url":"https://api.github.com/repos/lena-team/lena-orders/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lena-team/lena-orders/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lena-team/lena-orders/git/refs{/sha}","trees_url":"https://api.github.com/repos/lena-team/lena-orders/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lena-team/lena-orders/statuses/{sha}","languages_url":"https://api.github.com/repos/lena-team/lena-orders/languages","stargazers_url":"https://api.github.com/repos/lena-team/lena-orders/stargazers","contributors_url":"https://api.github.com/repos/lena-team/lena-orders/contributors","subscribers_url":"https://api.github.com/repos/lena-team/lena-orders/subscribers","subscription_url":"https://api.github.com/repos/lena-team/lena-orders/subscription","commits_url":"https://api.github.com/repos/lena-team/lena-orders/commits{/sha}","git_commits_url":"https://api.github.com/repos/lena-team/lena-orders/git/commits{/sha}","comments_url":"https://api.github.com/repos/lena-team/lena-orders/comments{/number}","issue_comment_url":"https://api.github.com/repos/lena-team/lena-orders/issues/comments{/number}","contents_url":"https://api.github.com/repos/lena-team/lena-orders/contents/{+path}","compare_url":"https://api.github.com/repos/lena-team/lena-orders/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lena-team/lena-orders/merges","archive_url":"https://api.github.com/repos/lena-team/lena-orders/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lena-team/lena-orders/downloads","issues_url":"https://api.github.com/repos/lena-team/lena-orders/issues{/number}","pulls_url":"https://api.github.com/repos/lena-team/lena-orders/pulls{/number}","milestones_url":"https://api.github.com/repos/lena-team/lena-orders/milestones{/number}","notifications_url":"https://api.github.com/repos/lena-team/lena-orders/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lena-team/lena-orders/labels{/name}","releases_url":"https://api.github.com/repos/lena-team/lena-orders/releases{/id}","deployments_url":"https://api.github.com/repos/lena-team/lena-orders/deployments","created_at":"2017-10-24T02:37:52Z","updated_at":"2017-10-24T03:11:26Z","pushed_at":"2017-10-26T02:49:05Z","git_url":"git://github.com/lena-team/lena-orders.git","ssh_url":"git@github.com:lena-team/lena-orders.git","clone_url":"https://github.com/lena-team/lena-orders.git","svn_url":"https://github.com/lena-team/lena-orders","homepage":null,"size":55,"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,"forks":0,"open_issues":2,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/lena-team/lena-orders/pulls/5"},"html":{"href":"https://github.com/lena-team/lena-orders/pull/5"},"issue":{"href":"https://api.github.com/repos/lena-team/lena-orders/issues/5"},"comments":{"href":"https://api.github.com/repos/lena-team/lena-orders/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/lena-team/lena-orders/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/lena-team/lena-orders/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lena-team/lena-orders/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/lena-team/lena-orders/statuses/dbb458e891b019969a4fe83aaf44f30439b732c0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"eugenesoo"}}