{"action":"created","comment":{"url":"https://api.github.com/repos/codyleyhan/dinero/pulls/comments/93820982","pull_request_review_id":14356904,"id":93820982,"diff_hunk":"@@ -1,4 +1,104 @@\n from flask import Blueprint, request, g, redirect, url_for, jsonify\n from datetime import datetime, timedelta\n+import pprint\n \n-from app.auth.decorators import requires_login, requres_status_manager\n+from app import db\n+from app.item.models.Item import Item\n+from app.auth.models.User import User\n+from app.item.validators.ItemValidator import ItemValidator\n+#from app.auth.decorators import requires_login, requres_status_manager\n+\n+\n+\n+itemMod = Blueprint('item', __name__, url_prefix='/item')\n+\n+##index\n+@itemMod.route('/', methods=['GET', 'POST'])\n+def index():\n+    #index page\n+    if request.method == 'GET':\n+        return jsonify({\n+            'legal routes': {\n+                'route(\\'/\\')': 'for methods=[\\'GET\\',\\'POST\\']',\n+                'route(\\'/<string:itemName>\\')': 'for methods=[\\'GET\\', \\'PUT\\', \\'DELETE\\']'\n+                }\n+        }), 201\n+\n+    # add item to database\n+    if request.method == 'POST':\n+        print(\"got into add_item()\")\n+        # validate the inputted information.\n+        form = ItemValidator(data=request.json)\n+        if form.validate():\n+            # Check whether item exists\n+            name = request.json['name']\n+            check_item = get(name)\n+            if check_item:\n+                return jsonify(\n+                    '%r already exists in your system.' % name,{\n+                    'item': a_dict(check_item)\n+                    }), 400\n+            #add item to database\n+            item = Item(request.json['name'], request.json['cost'], request.json['description'])\n+            db.session.add(item)\n+            db.session.commit()\n+            return jsonify(\n+                'Item added successfully.',\n+                { 'added item': item.to_dict()\n+            }), 201\n+        return jsonify({'message': 'There was an error adding data', 'error': form.errors}), 400\n+\n+@itemMod.route('/<string:itemName>', methods=['GET', 'PUT', 'DELETE'])\n+def update(itemName):\n+    # Query all items in the database and return.\n+    if itemName == 'all':","path":"app/item/controller.py","position":55,"original_position":55,"commit_id":"e40461e4f5db3d1b71959856d53e2b397300f657","original_commit_id":"e40461e4f5db3d1b71959856d53e2b397300f657","user":{"login":"codyleyhan","id":11651981,"avatar_url":"https://avatars.githubusercontent.com/u/11651981?v=3","gravatar_id":"","url":"https://api.github.com/users/codyleyhan","html_url":"https://github.com/codyleyhan","followers_url":"https://api.github.com/users/codyleyhan/followers","following_url":"https://api.github.com/users/codyleyhan/following{/other_user}","gists_url":"https://api.github.com/users/codyleyhan/gists{/gist_id}","starred_url":"https://api.github.com/users/codyleyhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codyleyhan/subscriptions","organizations_url":"https://api.github.com/users/codyleyhan/orgs","repos_url":"https://api.github.com/users/codyleyhan/repos","events_url":"https://api.github.com/users/codyleyhan/events{/privacy}","received_events_url":"https://api.github.com/users/codyleyhan/received_events","type":"User","site_admin":false},"body":"This should be in the index route","created_at":"2016-12-24T20:14:04Z","updated_at":"2016-12-24T20:20:19Z","html_url":"https://github.com/codyleyhan/dinero/pull/4#discussion_r93820982","pull_request_url":"https://api.github.com/repos/codyleyhan/dinero/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/codyleyhan/dinero/pulls/comments/93820982"},"html":{"href":"https://github.com/codyleyhan/dinero/pull/4#discussion_r93820982"},"pull_request":{"href":"https://api.github.com/repos/codyleyhan/dinero/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/codyleyhan/dinero/pulls/4","id":99298596,"html_url":"https://github.com/codyleyhan/dinero/pull/4","diff_url":"https://github.com/codyleyhan/dinero/pull/4.diff","patch_url":"https://github.com/codyleyhan/dinero/pull/4.patch","issue_url":"https://api.github.com/repos/codyleyhan/dinero/issues/4","number":4,"state":"open","locked":false,"title":"Item","user":{"login":"WhiteRabbit27","id":16423247,"avatar_url":"https://avatars.githubusercontent.com/u/16423247?v=3","gravatar_id":"","url":"https://api.github.com/users/WhiteRabbit27","html_url":"https://github.com/WhiteRabbit27","followers_url":"https://api.github.com/users/WhiteRabbit27/followers","following_url":"https://api.github.com/users/WhiteRabbit27/following{/other_user}","gists_url":"https://api.github.com/users/WhiteRabbit27/gists{/gist_id}","starred_url":"https://api.github.com/users/WhiteRabbit27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WhiteRabbit27/subscriptions","organizations_url":"https://api.github.com/users/WhiteRabbit27/orgs","repos_url":"https://api.github.com/users/WhiteRabbit27/repos","events_url":"https://api.github.com/users/WhiteRabbit27/events{/privacy}","received_events_url":"https://api.github.com/users/WhiteRabbit27/received_events","type":"User","site_admin":false},"body":"index, add, view single, view all, update and delete work with the following:\r\nroute('/', methods=['GET', 'POST'])\r\nroute('/<string:itemName>', methods=['GET', 'PUT', 'DELETE'])\r\n\r\nIf there is specific functionality you might need/want, let me know","created_at":"2016-12-24T08:28:29Z","updated_at":"2016-12-24T20:20:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f81525fccf229abe18e7dd91b44bafb276899da","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/codyleyhan/dinero/pulls/4/commits","review_comments_url":"https://api.github.com/repos/codyleyhan/dinero/pulls/4/comments","review_comment_url":"https://api.github.com/repos/codyleyhan/dinero/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codyleyhan/dinero/issues/4/comments","statuses_url":"https://api.github.com/repos/codyleyhan/dinero/statuses/e40461e4f5db3d1b71959856d53e2b397300f657","head":{"label":"codyleyhan:item","ref":"item","sha":"e40461e4f5db3d1b71959856d53e2b397300f657","user":{"login":"codyleyhan","id":11651981,"avatar_url":"https://avatars.githubusercontent.com/u/11651981?v=3","gravatar_id":"","url":"https://api.github.com/users/codyleyhan","html_url":"https://github.com/codyleyhan","followers_url":"https://api.github.com/users/codyleyhan/followers","following_url":"https://api.github.com/users/codyleyhan/following{/other_user}","gists_url":"https://api.github.com/users/codyleyhan/gists{/gist_id}","starred_url":"https://api.github.com/users/codyleyhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codyleyhan/subscriptions","organizations_url":"https://api.github.com/users/codyleyhan/orgs","repos_url":"https://api.github.com/users/codyleyhan/repos","events_url":"https://api.github.com/users/codyleyhan/events{/privacy}","received_events_url":"https://api.github.com/users/codyleyhan/received_events","type":"User","site_admin":false},"repo":{"id":76908860,"name":"dinero","full_name":"codyleyhan/dinero","owner":{"login":"codyleyhan","id":11651981,"avatar_url":"https://avatars.githubusercontent.com/u/11651981?v=3","gravatar_id":"","url":"https://api.github.com/users/codyleyhan","html_url":"https://github.com/codyleyhan","followers_url":"https://api.github.com/users/codyleyhan/followers","following_url":"https://api.github.com/users/codyleyhan/following{/other_user}","gists_url":"https://api.github.com/users/codyleyhan/gists{/gist_id}","starred_url":"https://api.github.com/users/codyleyhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codyleyhan/subscriptions","organizations_url":"https://api.github.com/users/codyleyhan/orgs","repos_url":"https://api.github.com/users/codyleyhan/repos","events_url":"https://api.github.com/users/codyleyhan/events{/privacy}","received_events_url":"https://api.github.com/users/codyleyhan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/codyleyhan/dinero","description":"restaurant bill app","fork":false,"url":"https://api.github.com/repos/codyleyhan/dinero","forks_url":"https://api.github.com/repos/codyleyhan/dinero/forks","keys_url":"https://api.github.com/repos/codyleyhan/dinero/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codyleyhan/dinero/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codyleyhan/dinero/teams","hooks_url":"https://api.github.com/repos/codyleyhan/dinero/hooks","issue_events_url":"https://api.github.com/repos/codyleyhan/dinero/issues/events{/number}","events_url":"https://api.github.com/repos/codyleyhan/dinero/events","assignees_url":"https://api.github.com/repos/codyleyhan/dinero/assignees{/user}","branches_url":"https://api.github.com/repos/codyleyhan/dinero/branches{/branch}","tags_url":"https://api.github.com/repos/codyleyhan/dinero/tags","blobs_url":"https://api.github.com/repos/codyleyhan/dinero/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codyleyhan/dinero/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codyleyhan/dinero/git/refs{/sha}","trees_url":"https://api.github.com/repos/codyleyhan/dinero/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codyleyhan/dinero/statuses/{sha}","languages_url":"https://api.github.com/repos/codyleyhan/dinero/languages","stargazers_url":"https://api.github.com/repos/codyleyhan/dinero/stargazers","contributors_url":"https://api.github.com/repos/codyleyhan/dinero/contributors","subscribers_url":"https://api.github.com/repos/codyleyhan/dinero/subscribers","subscription_url":"https://api.github.com/repos/codyleyhan/dinero/subscription","commits_url":"https://api.github.com/repos/codyleyhan/dinero/commits{/sha}","git_commits_url":"https://api.github.com/repos/codyleyhan/dinero/git/commits{/sha}","comments_url":"https://api.github.com/repos/codyleyhan/dinero/comments{/number}","issue_comment_url":"https://api.github.com/repos/codyleyhan/dinero/issues/comments{/number}","contents_url":"https://api.github.com/repos/codyleyhan/dinero/contents/{+path}","compare_url":"https://api.github.com/repos/codyleyhan/dinero/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codyleyhan/dinero/merges","archive_url":"https://api.github.com/repos/codyleyhan/dinero/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codyleyhan/dinero/downloads","issues_url":"https://api.github.com/repos/codyleyhan/dinero/issues{/number}","pulls_url":"https://api.github.com/repos/codyleyhan/dinero/pulls{/number}","milestones_url":"https://api.github.com/repos/codyleyhan/dinero/milestones{/number}","notifications_url":"https://api.github.com/repos/codyleyhan/dinero/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codyleyhan/dinero/labels{/name}","releases_url":"https://api.github.com/repos/codyleyhan/dinero/releases{/id}","deployments_url":"https://api.github.com/repos/codyleyhan/dinero/deployments","created_at":"2016-12-20T00:37:21Z","updated_at":"2016-12-20T00:37:44Z","pushed_at":"2016-12-24T08:28:29Z","git_url":"git://github.com/codyleyhan/dinero.git","ssh_url":"git@github.com:codyleyhan/dinero.git","clone_url":"https://github.com/codyleyhan/dinero.git","svn_url":"https://github.com/codyleyhan/dinero","homepage":null,"size":8893,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"codyleyhan:master","ref":"master","sha":"371eb2204e69cba21d4327afbe7a9b039eaa653f","user":{"login":"codyleyhan","id":11651981,"avatar_url":"https://avatars.githubusercontent.com/u/11651981?v=3","gravatar_id":"","url":"https://api.github.com/users/codyleyhan","html_url":"https://github.com/codyleyhan","followers_url":"https://api.github.com/users/codyleyhan/followers","following_url":"https://api.github.com/users/codyleyhan/following{/other_user}","gists_url":"https://api.github.com/users/codyleyhan/gists{/gist_id}","starred_url":"https://api.github.com/users/codyleyhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codyleyhan/subscriptions","organizations_url":"https://api.github.com/users/codyleyhan/orgs","repos_url":"https://api.github.com/users/codyleyhan/repos","events_url":"https://api.github.com/users/codyleyhan/events{/privacy}","received_events_url":"https://api.github.com/users/codyleyhan/received_events","type":"User","site_admin":false},"repo":{"id":76908860,"name":"dinero","full_name":"codyleyhan/dinero","owner":{"login":"codyleyhan","id":11651981,"avatar_url":"https://avatars.githubusercontent.com/u/11651981?v=3","gravatar_id":"","url":"https://api.github.com/users/codyleyhan","html_url":"https://github.com/codyleyhan","followers_url":"https://api.github.com/users/codyleyhan/followers","following_url":"https://api.github.com/users/codyleyhan/following{/other_user}","gists_url":"https://api.github.com/users/codyleyhan/gists{/gist_id}","starred_url":"https://api.github.com/users/codyleyhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codyleyhan/subscriptions","organizations_url":"https://api.github.com/users/codyleyhan/orgs","repos_url":"https://api.github.com/users/codyleyhan/repos","events_url":"https://api.github.com/users/codyleyhan/events{/privacy}","received_events_url":"https://api.github.com/users/codyleyhan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/codyleyhan/dinero","description":"restaurant bill app","fork":false,"url":"https://api.github.com/repos/codyleyhan/dinero","forks_url":"https://api.github.com/repos/codyleyhan/dinero/forks","keys_url":"https://api.github.com/repos/codyleyhan/dinero/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codyleyhan/dinero/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codyleyhan/dinero/teams","hooks_url":"https://api.github.com/repos/codyleyhan/dinero/hooks","issue_events_url":"https://api.github.com/repos/codyleyhan/dinero/issues/events{/number}","events_url":"https://api.github.com/repos/codyleyhan/dinero/events","assignees_url":"https://api.github.com/repos/codyleyhan/dinero/assignees{/user}","branches_url":"https://api.github.com/repos/codyleyhan/dinero/branches{/branch}","tags_url":"https://api.github.com/repos/codyleyhan/dinero/tags","blobs_url":"https://api.github.com/repos/codyleyhan/dinero/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codyleyhan/dinero/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codyleyhan/dinero/git/refs{/sha}","trees_url":"https://api.github.com/repos/codyleyhan/dinero/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codyleyhan/dinero/statuses/{sha}","languages_url":"https://api.github.com/repos/codyleyhan/dinero/languages","stargazers_url":"https://api.github.com/repos/codyleyhan/dinero/stargazers","contributors_url":"https://api.github.com/repos/codyleyhan/dinero/contributors","subscribers_url":"https://api.github.com/repos/codyleyhan/dinero/subscribers","subscription_url":"https://api.github.com/repos/codyleyhan/dinero/subscription","commits_url":"https://api.github.com/repos/codyleyhan/dinero/commits{/sha}","git_commits_url":"https://api.github.com/repos/codyleyhan/dinero/git/commits{/sha}","comments_url":"https://api.github.com/repos/codyleyhan/dinero/comments{/number}","issue_comment_url":"https://api.github.com/repos/codyleyhan/dinero/issues/comments{/number}","contents_url":"https://api.github.com/repos/codyleyhan/dinero/contents/{+path}","compare_url":"https://api.github.com/repos/codyleyhan/dinero/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codyleyhan/dinero/merges","archive_url":"https://api.github.com/repos/codyleyhan/dinero/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codyleyhan/dinero/downloads","issues_url":"https://api.github.com/repos/codyleyhan/dinero/issues{/number}","pulls_url":"https://api.github.com/repos/codyleyhan/dinero/pulls{/number}","milestones_url":"https://api.github.com/repos/codyleyhan/dinero/milestones{/number}","notifications_url":"https://api.github.com/repos/codyleyhan/dinero/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codyleyhan/dinero/labels{/name}","releases_url":"https://api.github.com/repos/codyleyhan/dinero/releases{/id}","deployments_url":"https://api.github.com/repos/codyleyhan/dinero/deployments","created_at":"2016-12-20T00:37:21Z","updated_at":"2016-12-20T00:37:44Z","pushed_at":"2016-12-24T08:28:29Z","git_url":"git://github.com/codyleyhan/dinero.git","ssh_url":"git@github.com:codyleyhan/dinero.git","clone_url":"https://github.com/codyleyhan/dinero.git","svn_url":"https://github.com/codyleyhan/dinero","homepage":null,"size":8893,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codyleyhan/dinero/pulls/4"},"html":{"href":"https://github.com/codyleyhan/dinero/pull/4"},"issue":{"href":"https://api.github.com/repos/codyleyhan/dinero/issues/4"},"comments":{"href":"https://api.github.com/repos/codyleyhan/dinero/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/codyleyhan/dinero/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/codyleyhan/dinero/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codyleyhan/dinero/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/codyleyhan/dinero/statuses/e40461e4f5db3d1b71959856d53e2b397300f657"}}}}
{"actor":{"display_login":"codyleyhan"}}