{"action":"created","comment":{"url":"https://api.github.com/repos/EaseApp/web-backend/pulls/comments/41204987","id":41204987,"diff_hunk":"@@ -1,32 +1,69 @@\n package main\n \n-import (\n+import(\n \t\"fmt\"\n \t\"log\"\n \t\"net/http\"\n-\n \t\"github.com/EaseApp/web-backend/src/db\"\n-\n \t\"github.com/codegangsta/negroni\"\n \t\"github.com/gorilla/mux\"\n+\tuser \"github.com/EaseApp/web-backend/src/app/controllers/user\"\n+\tapplication \"github.com/EaseApp/web-backend/src/app/controllers/application\"\n+\tdao \"github.com/EaseApp/web-backend/src/app/dao\"\n )\n \n+\n+\n+func NewStaticUserHandler(w http.ResponseWriter, req *http.Request){\n+\t_ = user.InsertStaticUser()\n+\thttp.Redirect(w, req, \"/users\", http.StatusFound)\n+}\n+\n+func DBCountHandler(w http.ResponseWriter, req *http.Request){\n+\tvars := mux.Vars(req)\n+\tdb := vars[\"db\"]\n+\n+\t// Move RecordCount out of user DAO and into generic DAO\n+\tfmt.Fprintf(w, \"Db (%v) has (%v) objects.\", db, dao.RecordCount(db))\n+}\n+\n func main() {\n \tlog.Println(\"Starting server...\")\n \n-\trouter := mux.NewRouter()\n-\trouter.HandleFunc(\"/\", func(w http.ResponseWriter, req *http.Request) {\n-\t\tfmt.Fprintf(w, \"Welcome to the home page!\")\n-\t})\n-\n \t// TODO: Use command line flag credentials.\n \tclient, err := db.NewClient(\"localhost:28015\")\n \tif err != nil {\n \t\tlog.Fatal(\"Couldn't initialize database: \", err.Error())\n \t}\n+\tdb.CreateEaseDb(client)\n+\tdb.CreateUserTable(client)\n+\tdb.CreateDbTable(client)\n+\n+\tdao.Init(client.Session)\n+\tuser.Init(client.Session)\n+\tapplication.Init(client.Session)\n+\n+\trouter := mux.NewRouter()\n+\trouter.HandleFunc(\"/\", func(w http.ResponseWriter, req *http.Request) {\n+\t\tfmt.Fprintf(w, \"Welcome to the home page!\")\n+\t})\n+\n+\n+\trouter.HandleFunc(\"/static/user/new\", NewStaticUserHandler)\n+\n+\t// These should be POST, but it's easier to test with GET\n+\trouter.HandleFunc(\"/users/sign_in\", user.SignInHandler)\n+\trouter.HandleFunc(\"/users/sign_up\", user.SignUpHandler)\n+\n+\trouter.HandleFunc(\"/count/{db}\", DBCountHandler)\n+\trouter.HandleFunc(\"/{db}\", user.FetchAllHandler)\n+\n+\trouter.HandleFunc(\"/{client}/{application}\", application.QueryApplicationHandler).Methods(\"POST\")\n+\trouter.HandleFunc(\"/{client}/{application}/new\", application.CreateApplicationHandler).Methods(\"POST\")\n+\n \tdefer client.Close()\n \n \tn := negroni.Classic()\n \tn.UseHandler(router)\n-\tn.Run(\":3001\")\n+\tn.Run(\":3000\")","path":"main.go","position":77,"original_position":77,"commit_id":"5317c745fa68b166b8dcffa30daed4cc219d6c54","original_commit_id":"5317c745fa68b166b8dcffa30daed4cc219d6c54","user":{"login":"Felttrip","id":4372470,"avatar_url":"https://avatars.githubusercontent.com/u/4372470?v=3","gravatar_id":"","url":"https://api.github.com/users/Felttrip","html_url":"https://github.com/Felttrip","followers_url":"https://api.github.com/users/Felttrip/followers","following_url":"https://api.github.com/users/Felttrip/following{/other_user}","gists_url":"https://api.github.com/users/Felttrip/gists{/gist_id}","starred_url":"https://api.github.com/users/Felttrip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Felttrip/subscriptions","organizations_url":"https://api.github.com/users/Felttrip/orgs","repos_url":"https://api.github.com/users/Felttrip/repos","events_url":"https://api.github.com/users/Felttrip/events{/privacy}","received_events_url":"https://api.github.com/users/Felttrip/received_events","type":"User","site_admin":false},"body":"We should keep this on 3001 unless we really need it to be on 3000","created_at":"2015-10-05T22:16:57Z","updated_at":"2015-10-05T22:16:57Z","html_url":"https://github.com/EaseApp/web-backend/pull/26#discussion_r41204987","pull_request_url":"https://api.github.com/repos/EaseApp/web-backend/pulls/26","_links":{"self":{"href":"https://api.github.com/repos/EaseApp/web-backend/pulls/comments/41204987"},"html":{"href":"https://github.com/EaseApp/web-backend/pull/26#discussion_r41204987"},"pull_request":{"href":"https://api.github.com/repos/EaseApp/web-backend/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/EaseApp/web-backend/pulls/26","id":46810812,"html_url":"https://github.com/EaseApp/web-backend/pull/26","diff_url":"https://github.com/EaseApp/web-backend/pull/26.diff","patch_url":"https://github.com/EaseApp/web-backend/pull/26.patch","issue_url":"https://api.github.com/repos/EaseApp/web-backend/issues/26","number":26,"state":"open","locked":false,"title":"Dyanmic app querying","user":{"login":"DrewWeth","id":4162957,"avatar_url":"https://avatars.githubusercontent.com/u/4162957?v=3","gravatar_id":"","url":"https://api.github.com/users/DrewWeth","html_url":"https://github.com/DrewWeth","followers_url":"https://api.github.com/users/DrewWeth/followers","following_url":"https://api.github.com/users/DrewWeth/following{/other_user}","gists_url":"https://api.github.com/users/DrewWeth/gists{/gist_id}","starred_url":"https://api.github.com/users/DrewWeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DrewWeth/subscriptions","organizations_url":"https://api.github.com/users/DrewWeth/orgs","repos_url":"https://api.github.com/users/DrewWeth/repos","events_url":"https://api.github.com/users/DrewWeth/events{/privacy}","received_events_url":"https://api.github.com/users/DrewWeth/received_events","type":"User","site_admin":false},"body":"Able to querying by filtering a client's application. You can only do strings right now. I'm not sure how to represent a JSON object in GoLang. I.e. I can't make a map of different types: strings/ints/floats","created_at":"2015-10-05T17:44:46Z","updated_at":"2015-10-05T22:16:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f61113f68e171186d134d5d9c824b152e0766c3","assignee":{"login":"ryan-endacott","id":2448142,"avatar_url":"https://avatars.githubusercontent.com/u/2448142?v=3","gravatar_id":"","url":"https://api.github.com/users/ryan-endacott","html_url":"https://github.com/ryan-endacott","followers_url":"https://api.github.com/users/ryan-endacott/followers","following_url":"https://api.github.com/users/ryan-endacott/following{/other_user}","gists_url":"https://api.github.com/users/ryan-endacott/gists{/gist_id}","starred_url":"https://api.github.com/users/ryan-endacott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryan-endacott/subscriptions","organizations_url":"https://api.github.com/users/ryan-endacott/orgs","repos_url":"https://api.github.com/users/ryan-endacott/repos","events_url":"https://api.github.com/users/ryan-endacott/events{/privacy}","received_events_url":"https://api.github.com/users/ryan-endacott/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/EaseApp/web-backend/pulls/26/commits","review_comments_url":"https://api.github.com/repos/EaseApp/web-backend/pulls/26/comments","review_comment_url":"https://api.github.com/repos/EaseApp/web-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/EaseApp/web-backend/issues/26/comments","statuses_url":"https://api.github.com/repos/EaseApp/web-backend/statuses/5317c745fa68b166b8dcffa30daed4cc219d6c54","head":{"label":"EaseApp:DYANMIC-APP-QUERYING","ref":"DYANMIC-APP-QUERYING","sha":"5317c745fa68b166b8dcffa30daed4cc219d6c54","user":{"login":"EaseApp","id":11878829,"avatar_url":"https://avatars.githubusercontent.com/u/11878829?v=3","gravatar_id":"","url":"https://api.github.com/users/EaseApp","html_url":"https://github.com/EaseApp","followers_url":"https://api.github.com/users/EaseApp/followers","following_url":"https://api.github.com/users/EaseApp/following{/other_user}","gists_url":"https://api.github.com/users/EaseApp/gists{/gist_id}","starred_url":"https://api.github.com/users/EaseApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EaseApp/subscriptions","organizations_url":"https://api.github.com/users/EaseApp/orgs","repos_url":"https://api.github.com/users/EaseApp/repos","events_url":"https://api.github.com/users/EaseApp/events{/privacy}","received_events_url":"https://api.github.com/users/EaseApp/received_events","type":"Organization","site_admin":false},"repo":{"id":33699718,"name":"web-backend","full_name":"EaseApp/web-backend","owner":{"login":"EaseApp","id":11878829,"avatar_url":"https://avatars.githubusercontent.com/u/11878829?v=3","gravatar_id":"","url":"https://api.github.com/users/EaseApp","html_url":"https://github.com/EaseApp","followers_url":"https://api.github.com/users/EaseApp/followers","following_url":"https://api.github.com/users/EaseApp/following{/other_user}","gists_url":"https://api.github.com/users/EaseApp/gists{/gist_id}","starred_url":"https://api.github.com/users/EaseApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EaseApp/subscriptions","organizations_url":"https://api.github.com/users/EaseApp/orgs","repos_url":"https://api.github.com/users/EaseApp/repos","events_url":"https://api.github.com/users/EaseApp/events{/privacy}","received_events_url":"https://api.github.com/users/EaseApp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/EaseApp/web-backend","description":"Web backend for Ease.","fork":false,"url":"https://api.github.com/repos/EaseApp/web-backend","forks_url":"https://api.github.com/repos/EaseApp/web-backend/forks","keys_url":"https://api.github.com/repos/EaseApp/web-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EaseApp/web-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EaseApp/web-backend/teams","hooks_url":"https://api.github.com/repos/EaseApp/web-backend/hooks","issue_events_url":"https://api.github.com/repos/EaseApp/web-backend/issues/events{/number}","events_url":"https://api.github.com/repos/EaseApp/web-backend/events","assignees_url":"https://api.github.com/repos/EaseApp/web-backend/assignees{/user}","branches_url":"https://api.github.com/repos/EaseApp/web-backend/branches{/branch}","tags_url":"https://api.github.com/repos/EaseApp/web-backend/tags","blobs_url":"https://api.github.com/repos/EaseApp/web-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EaseApp/web-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EaseApp/web-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/EaseApp/web-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EaseApp/web-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/EaseApp/web-backend/languages","stargazers_url":"https://api.github.com/repos/EaseApp/web-backend/stargazers","contributors_url":"https://api.github.com/repos/EaseApp/web-backend/contributors","subscribers_url":"https://api.github.com/repos/EaseApp/web-backend/subscribers","subscription_url":"https://api.github.com/repos/EaseApp/web-backend/subscription","commits_url":"https://api.github.com/repos/EaseApp/web-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/EaseApp/web-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/EaseApp/web-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/EaseApp/web-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/EaseApp/web-backend/contents/{+path}","compare_url":"https://api.github.com/repos/EaseApp/web-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EaseApp/web-backend/merges","archive_url":"https://api.github.com/repos/EaseApp/web-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EaseApp/web-backend/downloads","issues_url":"https://api.github.com/repos/EaseApp/web-backend/issues{/number}","pulls_url":"https://api.github.com/repos/EaseApp/web-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/EaseApp/web-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/EaseApp/web-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EaseApp/web-backend/labels{/name}","releases_url":"https://api.github.com/repos/EaseApp/web-backend/releases{/id}","created_at":"2015-04-10T00:30:38Z","updated_at":"2015-05-19T05:37:06Z","pushed_at":"2015-10-05T17:44:47Z","git_url":"git://github.com/EaseApp/web-backend.git","ssh_url":"git@github.com:EaseApp/web-backend.git","clone_url":"https://github.com/EaseApp/web-backend.git","svn_url":"https://github.com/EaseApp/web-backend","homepage":null,"size":5311,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":2,"default_branch":"master"}},"base":{"label":"EaseApp:master","ref":"master","sha":"a50f8a308fee89c3043c3110c3de302fd44cecbd","user":{"login":"EaseApp","id":11878829,"avatar_url":"https://avatars.githubusercontent.com/u/11878829?v=3","gravatar_id":"","url":"https://api.github.com/users/EaseApp","html_url":"https://github.com/EaseApp","followers_url":"https://api.github.com/users/EaseApp/followers","following_url":"https://api.github.com/users/EaseApp/following{/other_user}","gists_url":"https://api.github.com/users/EaseApp/gists{/gist_id}","starred_url":"https://api.github.com/users/EaseApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EaseApp/subscriptions","organizations_url":"https://api.github.com/users/EaseApp/orgs","repos_url":"https://api.github.com/users/EaseApp/repos","events_url":"https://api.github.com/users/EaseApp/events{/privacy}","received_events_url":"https://api.github.com/users/EaseApp/received_events","type":"Organization","site_admin":false},"repo":{"id":33699718,"name":"web-backend","full_name":"EaseApp/web-backend","owner":{"login":"EaseApp","id":11878829,"avatar_url":"https://avatars.githubusercontent.com/u/11878829?v=3","gravatar_id":"","url":"https://api.github.com/users/EaseApp","html_url":"https://github.com/EaseApp","followers_url":"https://api.github.com/users/EaseApp/followers","following_url":"https://api.github.com/users/EaseApp/following{/other_user}","gists_url":"https://api.github.com/users/EaseApp/gists{/gist_id}","starred_url":"https://api.github.com/users/EaseApp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EaseApp/subscriptions","organizations_url":"https://api.github.com/users/EaseApp/orgs","repos_url":"https://api.github.com/users/EaseApp/repos","events_url":"https://api.github.com/users/EaseApp/events{/privacy}","received_events_url":"https://api.github.com/users/EaseApp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/EaseApp/web-backend","description":"Web backend for Ease.","fork":false,"url":"https://api.github.com/repos/EaseApp/web-backend","forks_url":"https://api.github.com/repos/EaseApp/web-backend/forks","keys_url":"https://api.github.com/repos/EaseApp/web-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EaseApp/web-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EaseApp/web-backend/teams","hooks_url":"https://api.github.com/repos/EaseApp/web-backend/hooks","issue_events_url":"https://api.github.com/repos/EaseApp/web-backend/issues/events{/number}","events_url":"https://api.github.com/repos/EaseApp/web-backend/events","assignees_url":"https://api.github.com/repos/EaseApp/web-backend/assignees{/user}","branches_url":"https://api.github.com/repos/EaseApp/web-backend/branches{/branch}","tags_url":"https://api.github.com/repos/EaseApp/web-backend/tags","blobs_url":"https://api.github.com/repos/EaseApp/web-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EaseApp/web-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EaseApp/web-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/EaseApp/web-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EaseApp/web-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/EaseApp/web-backend/languages","stargazers_url":"https://api.github.com/repos/EaseApp/web-backend/stargazers","contributors_url":"https://api.github.com/repos/EaseApp/web-backend/contributors","subscribers_url":"https://api.github.com/repos/EaseApp/web-backend/subscribers","subscription_url":"https://api.github.com/repos/EaseApp/web-backend/subscription","commits_url":"https://api.github.com/repos/EaseApp/web-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/EaseApp/web-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/EaseApp/web-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/EaseApp/web-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/EaseApp/web-backend/contents/{+path}","compare_url":"https://api.github.com/repos/EaseApp/web-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EaseApp/web-backend/merges","archive_url":"https://api.github.com/repos/EaseApp/web-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EaseApp/web-backend/downloads","issues_url":"https://api.github.com/repos/EaseApp/web-backend/issues{/number}","pulls_url":"https://api.github.com/repos/EaseApp/web-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/EaseApp/web-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/EaseApp/web-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EaseApp/web-backend/labels{/name}","releases_url":"https://api.github.com/repos/EaseApp/web-backend/releases{/id}","created_at":"2015-04-10T00:30:38Z","updated_at":"2015-05-19T05:37:06Z","pushed_at":"2015-10-05T17:44:47Z","git_url":"git://github.com/EaseApp/web-backend.git","ssh_url":"git@github.com:EaseApp/web-backend.git","clone_url":"https://github.com/EaseApp/web-backend.git","svn_url":"https://github.com/EaseApp/web-backend","homepage":null,"size":5311,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/EaseApp/web-backend/pulls/26"},"html":{"href":"https://github.com/EaseApp/web-backend/pull/26"},"issue":{"href":"https://api.github.com/repos/EaseApp/web-backend/issues/26"},"comments":{"href":"https://api.github.com/repos/EaseApp/web-backend/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/EaseApp/web-backend/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/EaseApp/web-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/EaseApp/web-backend/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/EaseApp/web-backend/statuses/5317c745fa68b166b8dcffa30daed4cc219d6c54"}}}}