{"action":"created","comment":{"url":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/comments/222291419","pull_request_review_id":161140737,"id":222291419,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjI5MTQxOQ==","diff_hunk":"@@ -0,0 +1,58 @@\n+\"\"\"Database module\"\"\"\n+import psycopg2\n+\n+class DatabaseConnection:\n+    \"\"\"This class sets up a database connection and creates tables \"\"\"\n+    \n+    def __init__(self):\n+        \"\"\"initialises database connections\"\"\"\n+        self.conn = psycopg2.connect(dbname=\"fastfooddb\", user=\"postgres\", password=\"diana\", host=\"localhost\")\n+        #self.conn.rollback()\n+        self.cur = self.conn.cursor()\n+        self.conn.autocommit = True\n+\n+    def create_all_tables(self): \n+        try: \n+            self.cur.execute('''CREATE TABLE IF NOT EXISTS users(user_id SERIAL PRIMARY KEY,username VARCHAR(100),email VARCHAR(50),user_password VARCHAR(50),admin BOOLEAN NOT NULL DEFAULT FALSE)''')\n+            self.cur.execute('''CREATE TABLE IF NOT EXISTS menus(menu_id SERIAL PRIMARY KEY,food_name VARCHAR(50),food_price INTEGER)''')\n+            self.cur.execute('''CREATE TABLE IF NOT EXISTS orders(order_id SERIAL PRIMARY KEY,place VARCHAR(50),today TIMESTAMP NOT NULL,order_status VARCHAR(25),menu_id INTEGER NOT NULL REFERENCES menus (menu_id) ON UPDATE CASCADE ON DELETE CASCADE,user_id INTEGER NOT NULL REFERENCES users (user_id) ON UPDATE CASCADE ON DELETE CASCADE)''')\n+            self.conn.commit()\n+        except(psycopg2.DatabaseError):\n+            self.conn.rollback()\n+    \n+    # def add_food_query(self, query):\n+    #     \"\"\"Executes query to add food item\"\"\"","path":"api/models/db.py","position":24,"original_position":24,"commit_id":"47f9913f01ed9dea3de157af02ceb76cdc3b6cbb","original_commit_id":"47f9913f01ed9dea3de157af02ceb76cdc3b6cbb","user":{"login":"LehruAngela","id":27921138,"node_id":"MDQ6VXNlcjI3OTIxMTM4","avatar_url":"https://avatars1.githubusercontent.com/u/27921138?v=4","gravatar_id":"","url":"https://api.github.com/users/LehruAngela","html_url":"https://github.com/LehruAngela","followers_url":"https://api.github.com/users/LehruAngela/followers","following_url":"https://api.github.com/users/LehruAngela/following{/other_user}","gists_url":"https://api.github.com/users/LehruAngela/gists{/gist_id}","starred_url":"https://api.github.com/users/LehruAngela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LehruAngela/subscriptions","organizations_url":"https://api.github.com/users/LehruAngela/orgs","repos_url":"https://api.github.com/users/LehruAngela/repos","events_url":"https://api.github.com/users/LehruAngela/events{/privacy}","received_events_url":"https://api.github.com/users/LehruAngela/received_events","type":"User","site_admin":false},"body":"Remove commented code","created_at":"2018-10-03T12:38:50Z","updated_at":"2018-10-03T12:43:09Z","html_url":"https://github.com/d-rita/fast-food-fast/pull/30#discussion_r222291419","pull_request_url":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/30","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/comments/222291419"},"html":{"href":"https://github.com/d-rita/fast-food-fast/pull/30#discussion_r222291419"},"pull_request":{"href":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/30","id":220001730,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwMDAxNzMw","html_url":"https://github.com/d-rita/fast-food-fast/pull/30","diff_url":"https://github.com/d-rita/fast-food-fast/pull/30.diff","patch_url":"https://github.com/d-rita/fast-food-fast/pull/30.patch","issue_url":"https://api.github.com/repos/d-rita/fast-food-fast/issues/30","number":30,"state":"open","locked":false,"title":"#160939634-Feature Add Food API ","user":{"login":"d-rita","id":31903212,"node_id":"MDQ6VXNlcjMxOTAzMjEy","avatar_url":"https://avatars1.githubusercontent.com/u/31903212?v=4","gravatar_id":"","url":"https://api.github.com/users/d-rita","html_url":"https://github.com/d-rita","followers_url":"https://api.github.com/users/d-rita/followers","following_url":"https://api.github.com/users/d-rita/following{/other_user}","gists_url":"https://api.github.com/users/d-rita/gists{/gist_id}","starred_url":"https://api.github.com/users/d-rita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d-rita/subscriptions","organizations_url":"https://api.github.com/users/d-rita/orgs","repos_url":"https://api.github.com/users/d-rita/repos","events_url":"https://api.github.com/users/d-rita/events{/privacy}","received_events_url":"https://api.github.com/users/d-rita/received_events","type":"User","site_admin":false},"body":"**What does this PR do?**\r\nAdd food item to the menus table\r\n\r\n**Description of tasks**\r\n- Execute a query to insert data into the menus table. \r\n- Run API in POSTMAN and add food item in JSON format. \r\n\r\n**Relevant Pivotal Tracker Story**\r\n- #160939634","created_at":"2018-10-03T11:25:37Z","updated_at":"2018-10-03T12:43:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e111da3b028b1bb7ee3ab0d94df2f54715c81c9b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/30/commits","review_comments_url":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/30/comments","review_comment_url":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/d-rita/fast-food-fast/issues/30/comments","statuses_url":"https://api.github.com/repos/d-rita/fast-food-fast/statuses/47f9913f01ed9dea3de157af02ceb76cdc3b6cbb","head":{"label":"d-rita:ft-add-food-api-160939634","ref":"ft-add-food-api-160939634","sha":"47f9913f01ed9dea3de157af02ceb76cdc3b6cbb","user":{"login":"d-rita","id":31903212,"node_id":"MDQ6VXNlcjMxOTAzMjEy","avatar_url":"https://avatars1.githubusercontent.com/u/31903212?v=4","gravatar_id":"","url":"https://api.github.com/users/d-rita","html_url":"https://github.com/d-rita","followers_url":"https://api.github.com/users/d-rita/followers","following_url":"https://api.github.com/users/d-rita/following{/other_user}","gists_url":"https://api.github.com/users/d-rita/gists{/gist_id}","starred_url":"https://api.github.com/users/d-rita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d-rita/subscriptions","organizations_url":"https://api.github.com/users/d-rita/orgs","repos_url":"https://api.github.com/users/d-rita/repos","events_url":"https://api.github.com/users/d-rita/events{/privacy}","received_events_url":"https://api.github.com/users/d-rita/received_events","type":"User","site_admin":false},"repo":{"id":147580976,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc1ODA5NzY=","name":"fast-food-fast","full_name":"d-rita/fast-food-fast","private":false,"owner":{"login":"d-rita","id":31903212,"node_id":"MDQ6VXNlcjMxOTAzMjEy","avatar_url":"https://avatars1.githubusercontent.com/u/31903212?v=4","gravatar_id":"","url":"https://api.github.com/users/d-rita","html_url":"https://github.com/d-rita","followers_url":"https://api.github.com/users/d-rita/followers","following_url":"https://api.github.com/users/d-rita/following{/other_user}","gists_url":"https://api.github.com/users/d-rita/gists{/gist_id}","starred_url":"https://api.github.com/users/d-rita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d-rita/subscriptions","organizations_url":"https://api.github.com/users/d-rita/orgs","repos_url":"https://api.github.com/users/d-rita/repos","events_url":"https://api.github.com/users/d-rita/events{/privacy}","received_events_url":"https://api.github.com/users/d-rita/received_events","type":"User","site_admin":false},"html_url":"https://github.com/d-rita/fast-food-fast","description":null,"fork":false,"url":"https://api.github.com/repos/d-rita/fast-food-fast","forks_url":"https://api.github.com/repos/d-rita/fast-food-fast/forks","keys_url":"https://api.github.com/repos/d-rita/fast-food-fast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/d-rita/fast-food-fast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/d-rita/fast-food-fast/teams","hooks_url":"https://api.github.com/repos/d-rita/fast-food-fast/hooks","issue_events_url":"https://api.github.com/repos/d-rita/fast-food-fast/issues/events{/number}","events_url":"https://api.github.com/repos/d-rita/fast-food-fast/events","assignees_url":"https://api.github.com/repos/d-rita/fast-food-fast/assignees{/user}","branches_url":"https://api.github.com/repos/d-rita/fast-food-fast/branches{/branch}","tags_url":"https://api.github.com/repos/d-rita/fast-food-fast/tags","blobs_url":"https://api.github.com/repos/d-rita/fast-food-fast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/d-rita/fast-food-fast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/d-rita/fast-food-fast/git/refs{/sha}","trees_url":"https://api.github.com/repos/d-rita/fast-food-fast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/d-rita/fast-food-fast/statuses/{sha}","languages_url":"https://api.github.com/repos/d-rita/fast-food-fast/languages","stargazers_url":"https://api.github.com/repos/d-rita/fast-food-fast/stargazers","contributors_url":"https://api.github.com/repos/d-rita/fast-food-fast/contributors","subscribers_url":"https://api.github.com/repos/d-rita/fast-food-fast/subscribers","subscription_url":"https://api.github.com/repos/d-rita/fast-food-fast/subscription","commits_url":"https://api.github.com/repos/d-rita/fast-food-fast/commits{/sha}","git_commits_url":"https://api.github.com/repos/d-rita/fast-food-fast/git/commits{/sha}","comments_url":"https://api.github.com/repos/d-rita/fast-food-fast/comments{/number}","issue_comment_url":"https://api.github.com/repos/d-rita/fast-food-fast/issues/comments{/number}","contents_url":"https://api.github.com/repos/d-rita/fast-food-fast/contents/{+path}","compare_url":"https://api.github.com/repos/d-rita/fast-food-fast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/d-rita/fast-food-fast/merges","archive_url":"https://api.github.com/repos/d-rita/fast-food-fast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/d-rita/fast-food-fast/downloads","issues_url":"https://api.github.com/repos/d-rita/fast-food-fast/issues{/number}","pulls_url":"https://api.github.com/repos/d-rita/fast-food-fast/pulls{/number}","milestones_url":"https://api.github.com/repos/d-rita/fast-food-fast/milestones{/number}","notifications_url":"https://api.github.com/repos/d-rita/fast-food-fast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/d-rita/fast-food-fast/labels{/name}","releases_url":"https://api.github.com/repos/d-rita/fast-food-fast/releases{/id}","deployments_url":"https://api.github.com/repos/d-rita/fast-food-fast/deployments","created_at":"2018-09-05T21:22:31Z","updated_at":"2018-09-27T06:56:27Z","pushed_at":"2018-10-03T11:25:37Z","git_url":"git://github.com/d-rita/fast-food-fast.git","ssh_url":"git@github.com:d-rita/fast-food-fast.git","clone_url":"https://github.com/d-rita/fast-food-fast.git","svn_url":"https://github.com/d-rita/fast-food-fast","homepage":null,"size":351,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"d-rita:challenge3","ref":"challenge3","sha":"f3b6d9e1c8d367684a7c07e2a86400fd1b5c499c","user":{"login":"d-rita","id":31903212,"node_id":"MDQ6VXNlcjMxOTAzMjEy","avatar_url":"https://avatars1.githubusercontent.com/u/31903212?v=4","gravatar_id":"","url":"https://api.github.com/users/d-rita","html_url":"https://github.com/d-rita","followers_url":"https://api.github.com/users/d-rita/followers","following_url":"https://api.github.com/users/d-rita/following{/other_user}","gists_url":"https://api.github.com/users/d-rita/gists{/gist_id}","starred_url":"https://api.github.com/users/d-rita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d-rita/subscriptions","organizations_url":"https://api.github.com/users/d-rita/orgs","repos_url":"https://api.github.com/users/d-rita/repos","events_url":"https://api.github.com/users/d-rita/events{/privacy}","received_events_url":"https://api.github.com/users/d-rita/received_events","type":"User","site_admin":false},"repo":{"id":147580976,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc1ODA5NzY=","name":"fast-food-fast","full_name":"d-rita/fast-food-fast","private":false,"owner":{"login":"d-rita","id":31903212,"node_id":"MDQ6VXNlcjMxOTAzMjEy","avatar_url":"https://avatars1.githubusercontent.com/u/31903212?v=4","gravatar_id":"","url":"https://api.github.com/users/d-rita","html_url":"https://github.com/d-rita","followers_url":"https://api.github.com/users/d-rita/followers","following_url":"https://api.github.com/users/d-rita/following{/other_user}","gists_url":"https://api.github.com/users/d-rita/gists{/gist_id}","starred_url":"https://api.github.com/users/d-rita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d-rita/subscriptions","organizations_url":"https://api.github.com/users/d-rita/orgs","repos_url":"https://api.github.com/users/d-rita/repos","events_url":"https://api.github.com/users/d-rita/events{/privacy}","received_events_url":"https://api.github.com/users/d-rita/received_events","type":"User","site_admin":false},"html_url":"https://github.com/d-rita/fast-food-fast","description":null,"fork":false,"url":"https://api.github.com/repos/d-rita/fast-food-fast","forks_url":"https://api.github.com/repos/d-rita/fast-food-fast/forks","keys_url":"https://api.github.com/repos/d-rita/fast-food-fast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/d-rita/fast-food-fast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/d-rita/fast-food-fast/teams","hooks_url":"https://api.github.com/repos/d-rita/fast-food-fast/hooks","issue_events_url":"https://api.github.com/repos/d-rita/fast-food-fast/issues/events{/number}","events_url":"https://api.github.com/repos/d-rita/fast-food-fast/events","assignees_url":"https://api.github.com/repos/d-rita/fast-food-fast/assignees{/user}","branches_url":"https://api.github.com/repos/d-rita/fast-food-fast/branches{/branch}","tags_url":"https://api.github.com/repos/d-rita/fast-food-fast/tags","blobs_url":"https://api.github.com/repos/d-rita/fast-food-fast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/d-rita/fast-food-fast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/d-rita/fast-food-fast/git/refs{/sha}","trees_url":"https://api.github.com/repos/d-rita/fast-food-fast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/d-rita/fast-food-fast/statuses/{sha}","languages_url":"https://api.github.com/repos/d-rita/fast-food-fast/languages","stargazers_url":"https://api.github.com/repos/d-rita/fast-food-fast/stargazers","contributors_url":"https://api.github.com/repos/d-rita/fast-food-fast/contributors","subscribers_url":"https://api.github.com/repos/d-rita/fast-food-fast/subscribers","subscription_url":"https://api.github.com/repos/d-rita/fast-food-fast/subscription","commits_url":"https://api.github.com/repos/d-rita/fast-food-fast/commits{/sha}","git_commits_url":"https://api.github.com/repos/d-rita/fast-food-fast/git/commits{/sha}","comments_url":"https://api.github.com/repos/d-rita/fast-food-fast/comments{/number}","issue_comment_url":"https://api.github.com/repos/d-rita/fast-food-fast/issues/comments{/number}","contents_url":"https://api.github.com/repos/d-rita/fast-food-fast/contents/{+path}","compare_url":"https://api.github.com/repos/d-rita/fast-food-fast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/d-rita/fast-food-fast/merges","archive_url":"https://api.github.com/repos/d-rita/fast-food-fast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/d-rita/fast-food-fast/downloads","issues_url":"https://api.github.com/repos/d-rita/fast-food-fast/issues{/number}","pulls_url":"https://api.github.com/repos/d-rita/fast-food-fast/pulls{/number}","milestones_url":"https://api.github.com/repos/d-rita/fast-food-fast/milestones{/number}","notifications_url":"https://api.github.com/repos/d-rita/fast-food-fast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/d-rita/fast-food-fast/labels{/name}","releases_url":"https://api.github.com/repos/d-rita/fast-food-fast/releases{/id}","deployments_url":"https://api.github.com/repos/d-rita/fast-food-fast/deployments","created_at":"2018-09-05T21:22:31Z","updated_at":"2018-09-27T06:56:27Z","pushed_at":"2018-10-03T11:25:37Z","git_url":"git://github.com/d-rita/fast-food-fast.git","ssh_url":"git@github.com:d-rita/fast-food-fast.git","clone_url":"https://github.com/d-rita/fast-food-fast.git","svn_url":"https://github.com/d-rita/fast-food-fast","homepage":null,"size":351,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/30"},"html":{"href":"https://github.com/d-rita/fast-food-fast/pull/30"},"issue":{"href":"https://api.github.com/repos/d-rita/fast-food-fast/issues/30"},"comments":{"href":"https://api.github.com/repos/d-rita/fast-food-fast/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/d-rita/fast-food-fast/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/d-rita/fast-food-fast/statuses/47f9913f01ed9dea3de157af02ceb76cdc3b6cbb"}},"author_association":"OWNER"}}
{"actor":{"display_login":"LehruAngela"}}