{"action":"created","comment":{"url":"https://api.github.com/repos/akvo/akvo-lumen/pulls/comments/65216532","id":65216532,"diff_hunk":"@@ -0,0 +1,183 @@\n+(ns org.akvo.dash.endpoint.dashboard\n+  (:require [compojure.core :refer :all]\n+            [clojure.pprint :refer [pprint]]\n+            [clojure.java.jdbc :as jdbc]\n+            [hugsql.core :as hugsql]\n+            [org.akvo.dash.component.tenant-manager :refer [connection]]\n+            [org.akvo.dash.util :refer [squuid]]\n+            [ring.util.response :as resp]))\n+\n+(hugsql/def-db-fns \"org/akvo/dash/endpoint/dashboard.sql\")\n+\n+\n+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n+;;; Helpers\n+;;;\n+\n+(defn dashboard-keys-match?\n+  \"Make sure each key in entity have a matching key in layout.\"\n+  [dashboard]\n+  (= (keys (get dashboard \"entities\"))\n+     (keys (get dashboard \"layout\"))))\n+\n+\n+\n+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n+;;; /dashboards/:id GET\n+;;;\n+\n+(defn all-entities\n+  \"Merge text & dashboard_visualisations (dvs) entries, return an id keyed map\"\n+  [text-entities dvs]\n+  (let [entries (reduce conj text-entities (map (fn [dv]\n+                                        {\"id\"   (:visualisation_id dv)\n+                                         \"type\" \"visualiation\"}) dvs ))]","path":"backend/src/org/akvo/dash/endpoint/dashboard.clj","position":34,"original_position":34,"commit_id":"52738da02bbc0c4f1ab5d9d4ac87850113ab58ca","original_commit_id":"52738da02bbc0c4f1ab5d9d4ac87850113ab58ca","user":{"login":"gabemart","id":2589977,"avatar_url":"https://avatars.githubusercontent.com/u/2589977?v=3","gravatar_id":"","url":"https://api.github.com/users/gabemart","html_url":"https://github.com/gabemart","followers_url":"https://api.github.com/users/gabemart/followers","following_url":"https://api.github.com/users/gabemart/following{/other_user}","gists_url":"https://api.github.com/users/gabemart/gists{/gist_id}","starred_url":"https://api.github.com/users/gabemart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabemart/subscriptions","organizations_url":"https://api.github.com/users/gabemart/orgs","repos_url":"https://api.github.com/users/gabemart/repos","events_url":"https://api.github.com/users/gabemart/events{/privacy}","received_events_url":"https://api.github.com/users/gabemart/received_events","type":"User","site_admin":false},"body":"\"visualiation\" should be \"visualisation\"","created_at":"2016-05-31T16:26:31Z","updated_at":"2016-05-31T16:26:31Z","html_url":"https://github.com/akvo/akvo-lumen/pull/184#discussion_r65216532","pull_request_url":"https://api.github.com/repos/akvo/akvo-lumen/pulls/184","_links":{"self":{"href":"https://api.github.com/repos/akvo/akvo-lumen/pulls/comments/65216532"},"html":{"href":"https://github.com/akvo/akvo-lumen/pull/184#discussion_r65216532"},"pull_request":{"href":"https://api.github.com/repos/akvo/akvo-lumen/pulls/184"}}},"pull_request":{"url":"https://api.github.com/repos/akvo/akvo-lumen/pulls/184","id":71903650,"html_url":"https://github.com/akvo/akvo-lumen/pull/184","diff_url":"https://github.com/akvo/akvo-lumen/pull/184.diff","patch_url":"https://github.com/akvo/akvo-lumen/pull/184.patch","issue_url":"https://api.github.com/repos/akvo/akvo-lumen/issues/184","number":184,"state":"open","locked":false,"title":"#173 dashboards","user":{"login":"kardan","id":31837,"avatar_url":"https://avatars.githubusercontent.com/u/31837?v=3","gravatar_id":"","url":"https://api.github.com/users/kardan","html_url":"https://github.com/kardan","followers_url":"https://api.github.com/users/kardan/followers","following_url":"https://api.github.com/users/kardan/following{/other_user}","gists_url":"https://api.github.com/users/kardan/gists{/gist_id}","starred_url":"https://api.github.com/users/kardan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kardan/subscriptions","organizations_url":"https://api.github.com/users/kardan/orgs","repos_url":"https://api.github.com/users/kardan/repos","events_url":"https://api.github.com/users/kardan/events{/privacy}","received_events_url":"https://api.github.com/users/kardan/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-30T13:44:46Z","updated_at":"2016-05-31T16:26:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c16ee183ab7d3b0e1c9397bf7243da72933d326","assignee":{"login":"iperdomo","id":178474,"avatar_url":"https://avatars.githubusercontent.com/u/178474?v=3","gravatar_id":"","url":"https://api.github.com/users/iperdomo","html_url":"https://github.com/iperdomo","followers_url":"https://api.github.com/users/iperdomo/followers","following_url":"https://api.github.com/users/iperdomo/following{/other_user}","gists_url":"https://api.github.com/users/iperdomo/gists{/gist_id}","starred_url":"https://api.github.com/users/iperdomo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iperdomo/subscriptions","organizations_url":"https://api.github.com/users/iperdomo/orgs","repos_url":"https://api.github.com/users/iperdomo/repos","events_url":"https://api.github.com/users/iperdomo/events{/privacy}","received_events_url":"https://api.github.com/users/iperdomo/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/akvo/akvo-lumen/milestones/6","html_url":"https://github.com/akvo/akvo-lumen/milestones/2016-06-03","labels_url":"https://api.github.com/repos/akvo/akvo-lumen/milestones/6/labels","id":1773655,"number":6,"title":"2016-06-03","description":"","creator":{"login":"iperdomo","id":178474,"avatar_url":"https://avatars.githubusercontent.com/u/178474?v=3","gravatar_id":"","url":"https://api.github.com/users/iperdomo","html_url":"https://github.com/iperdomo","followers_url":"https://api.github.com/users/iperdomo/followers","following_url":"https://api.github.com/users/iperdomo/following{/other_user}","gists_url":"https://api.github.com/users/iperdomo/gists{/gist_id}","starred_url":"https://api.github.com/users/iperdomo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iperdomo/subscriptions","organizations_url":"https://api.github.com/users/iperdomo/orgs","repos_url":"https://api.github.com/users/iperdomo/repos","events_url":"https://api.github.com/users/iperdomo/events{/privacy}","received_events_url":"https://api.github.com/users/iperdomo/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":1,"state":"open","created_at":"2016-05-18T10:10:40Z","updated_at":"2016-05-31T08:23:18Z","due_on":"2016-06-02T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/akvo/akvo-lumen/pulls/184/commits","review_comments_url":"https://api.github.com/repos/akvo/akvo-lumen/pulls/184/comments","review_comment_url":"https://api.github.com/repos/akvo/akvo-lumen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akvo/akvo-lumen/issues/184/comments","statuses_url":"https://api.github.com/repos/akvo/akvo-lumen/statuses/52738da02bbc0c4f1ab5d9d4ac87850113ab58ca","head":{"label":"akvo:#173-dashboards","ref":"#173-dashboards","sha":"52738da02bbc0c4f1ab5d9d4ac87850113ab58ca","user":{"login":"akvo","id":159843,"avatar_url":"https://avatars.githubusercontent.com/u/159843?v=3","gravatar_id":"","url":"https://api.github.com/users/akvo","html_url":"https://github.com/akvo","followers_url":"https://api.github.com/users/akvo/followers","following_url":"https://api.github.com/users/akvo/following{/other_user}","gists_url":"https://api.github.com/users/akvo/gists{/gist_id}","starred_url":"https://api.github.com/users/akvo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akvo/subscriptions","organizations_url":"https://api.github.com/users/akvo/orgs","repos_url":"https://api.github.com/users/akvo/repos","events_url":"https://api.github.com/users/akvo/events{/privacy}","received_events_url":"https://api.github.com/users/akvo/received_events","type":"Organization","site_admin":false},"repo":{"id":44529983,"name":"akvo-lumen","full_name":"akvo/akvo-lumen","owner":{"login":"akvo","id":159843,"avatar_url":"https://avatars.githubusercontent.com/u/159843?v=3","gravatar_id":"","url":"https://api.github.com/users/akvo","html_url":"https://github.com/akvo","followers_url":"https://api.github.com/users/akvo/followers","following_url":"https://api.github.com/users/akvo/following{/other_user}","gists_url":"https://api.github.com/users/akvo/gists{/gist_id}","starred_url":"https://api.github.com/users/akvo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akvo/subscriptions","organizations_url":"https://api.github.com/users/akvo/orgs","repos_url":"https://api.github.com/users/akvo/repos","events_url":"https://api.github.com/users/akvo/events{/privacy}","received_events_url":"https://api.github.com/users/akvo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akvo/akvo-lumen","description":"Akvo Lumen","fork":false,"url":"https://api.github.com/repos/akvo/akvo-lumen","forks_url":"https://api.github.com/repos/akvo/akvo-lumen/forks","keys_url":"https://api.github.com/repos/akvo/akvo-lumen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akvo/akvo-lumen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akvo/akvo-lumen/teams","hooks_url":"https://api.github.com/repos/akvo/akvo-lumen/hooks","issue_events_url":"https://api.github.com/repos/akvo/akvo-lumen/issues/events{/number}","events_url":"https://api.github.com/repos/akvo/akvo-lumen/events","assignees_url":"https://api.github.com/repos/akvo/akvo-lumen/assignees{/user}","branches_url":"https://api.github.com/repos/akvo/akvo-lumen/branches{/branch}","tags_url":"https://api.github.com/repos/akvo/akvo-lumen/tags","blobs_url":"https://api.github.com/repos/akvo/akvo-lumen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akvo/akvo-lumen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akvo/akvo-lumen/git/refs{/sha}","trees_url":"https://api.github.com/repos/akvo/akvo-lumen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akvo/akvo-lumen/statuses/{sha}","languages_url":"https://api.github.com/repos/akvo/akvo-lumen/languages","stargazers_url":"https://api.github.com/repos/akvo/akvo-lumen/stargazers","contributors_url":"https://api.github.com/repos/akvo/akvo-lumen/contributors","subscribers_url":"https://api.github.com/repos/akvo/akvo-lumen/subscribers","subscription_url":"https://api.github.com/repos/akvo/akvo-lumen/subscription","commits_url":"https://api.github.com/repos/akvo/akvo-lumen/commits{/sha}","git_commits_url":"https://api.github.com/repos/akvo/akvo-lumen/git/commits{/sha}","comments_url":"https://api.github.com/repos/akvo/akvo-lumen/comments{/number}","issue_comment_url":"https://api.github.com/repos/akvo/akvo-lumen/issues/comments{/number}","contents_url":"https://api.github.com/repos/akvo/akvo-lumen/contents/{+path}","compare_url":"https://api.github.com/repos/akvo/akvo-lumen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akvo/akvo-lumen/merges","archive_url":"https://api.github.com/repos/akvo/akvo-lumen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akvo/akvo-lumen/downloads","issues_url":"https://api.github.com/repos/akvo/akvo-lumen/issues{/number}","pulls_url":"https://api.github.com/repos/akvo/akvo-lumen/pulls{/number}","milestones_url":"https://api.github.com/repos/akvo/akvo-lumen/milestones{/number}","notifications_url":"https://api.github.com/repos/akvo/akvo-lumen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akvo/akvo-lumen/labels{/name}","releases_url":"https://api.github.com/repos/akvo/akvo-lumen/releases{/id}","deployments_url":"https://api.github.com/repos/akvo/akvo-lumen/deployments","created_at":"2015-10-19T11:25:53Z","updated_at":"2016-05-13T13:56:05Z","pushed_at":"2016-05-31T15:28:53Z","git_url":"git://github.com/akvo/akvo-lumen.git","ssh_url":"git@github.com:akvo/akvo-lumen.git","clone_url":"https://github.com/akvo/akvo-lumen.git","svn_url":"https://github.com/akvo/akvo-lumen","homepage":"http://akvo.org/akvo-lumen/","size":1996,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":30,"forks":1,"open_issues":30,"watchers":1,"default_branch":"develop"}},"base":{"label":"akvo:develop","ref":"develop","sha":"6545f3356e34345dd143e0d19a5123bd0cdcdfd6","user":{"login":"akvo","id":159843,"avatar_url":"https://avatars.githubusercontent.com/u/159843?v=3","gravatar_id":"","url":"https://api.github.com/users/akvo","html_url":"https://github.com/akvo","followers_url":"https://api.github.com/users/akvo/followers","following_url":"https://api.github.com/users/akvo/following{/other_user}","gists_url":"https://api.github.com/users/akvo/gists{/gist_id}","starred_url":"https://api.github.com/users/akvo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akvo/subscriptions","organizations_url":"https://api.github.com/users/akvo/orgs","repos_url":"https://api.github.com/users/akvo/repos","events_url":"https://api.github.com/users/akvo/events{/privacy}","received_events_url":"https://api.github.com/users/akvo/received_events","type":"Organization","site_admin":false},"repo":{"id":44529983,"name":"akvo-lumen","full_name":"akvo/akvo-lumen","owner":{"login":"akvo","id":159843,"avatar_url":"https://avatars.githubusercontent.com/u/159843?v=3","gravatar_id":"","url":"https://api.github.com/users/akvo","html_url":"https://github.com/akvo","followers_url":"https://api.github.com/users/akvo/followers","following_url":"https://api.github.com/users/akvo/following{/other_user}","gists_url":"https://api.github.com/users/akvo/gists{/gist_id}","starred_url":"https://api.github.com/users/akvo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akvo/subscriptions","organizations_url":"https://api.github.com/users/akvo/orgs","repos_url":"https://api.github.com/users/akvo/repos","events_url":"https://api.github.com/users/akvo/events{/privacy}","received_events_url":"https://api.github.com/users/akvo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akvo/akvo-lumen","description":"Akvo Lumen","fork":false,"url":"https://api.github.com/repos/akvo/akvo-lumen","forks_url":"https://api.github.com/repos/akvo/akvo-lumen/forks","keys_url":"https://api.github.com/repos/akvo/akvo-lumen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akvo/akvo-lumen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akvo/akvo-lumen/teams","hooks_url":"https://api.github.com/repos/akvo/akvo-lumen/hooks","issue_events_url":"https://api.github.com/repos/akvo/akvo-lumen/issues/events{/number}","events_url":"https://api.github.com/repos/akvo/akvo-lumen/events","assignees_url":"https://api.github.com/repos/akvo/akvo-lumen/assignees{/user}","branches_url":"https://api.github.com/repos/akvo/akvo-lumen/branches{/branch}","tags_url":"https://api.github.com/repos/akvo/akvo-lumen/tags","blobs_url":"https://api.github.com/repos/akvo/akvo-lumen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akvo/akvo-lumen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akvo/akvo-lumen/git/refs{/sha}","trees_url":"https://api.github.com/repos/akvo/akvo-lumen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akvo/akvo-lumen/statuses/{sha}","languages_url":"https://api.github.com/repos/akvo/akvo-lumen/languages","stargazers_url":"https://api.github.com/repos/akvo/akvo-lumen/stargazers","contributors_url":"https://api.github.com/repos/akvo/akvo-lumen/contributors","subscribers_url":"https://api.github.com/repos/akvo/akvo-lumen/subscribers","subscription_url":"https://api.github.com/repos/akvo/akvo-lumen/subscription","commits_url":"https://api.github.com/repos/akvo/akvo-lumen/commits{/sha}","git_commits_url":"https://api.github.com/repos/akvo/akvo-lumen/git/commits{/sha}","comments_url":"https://api.github.com/repos/akvo/akvo-lumen/comments{/number}","issue_comment_url":"https://api.github.com/repos/akvo/akvo-lumen/issues/comments{/number}","contents_url":"https://api.github.com/repos/akvo/akvo-lumen/contents/{+path}","compare_url":"https://api.github.com/repos/akvo/akvo-lumen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akvo/akvo-lumen/merges","archive_url":"https://api.github.com/repos/akvo/akvo-lumen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akvo/akvo-lumen/downloads","issues_url":"https://api.github.com/repos/akvo/akvo-lumen/issues{/number}","pulls_url":"https://api.github.com/repos/akvo/akvo-lumen/pulls{/number}","milestones_url":"https://api.github.com/repos/akvo/akvo-lumen/milestones{/number}","notifications_url":"https://api.github.com/repos/akvo/akvo-lumen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akvo/akvo-lumen/labels{/name}","releases_url":"https://api.github.com/repos/akvo/akvo-lumen/releases{/id}","deployments_url":"https://api.github.com/repos/akvo/akvo-lumen/deployments","created_at":"2015-10-19T11:25:53Z","updated_at":"2016-05-13T13:56:05Z","pushed_at":"2016-05-31T15:28:53Z","git_url":"git://github.com/akvo/akvo-lumen.git","ssh_url":"git@github.com:akvo/akvo-lumen.git","clone_url":"https://github.com/akvo/akvo-lumen.git","svn_url":"https://github.com/akvo/akvo-lumen","homepage":"http://akvo.org/akvo-lumen/","size":1996,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":30,"forks":1,"open_issues":30,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/akvo/akvo-lumen/pulls/184"},"html":{"href":"https://github.com/akvo/akvo-lumen/pull/184"},"issue":{"href":"https://api.github.com/repos/akvo/akvo-lumen/issues/184"},"comments":{"href":"https://api.github.com/repos/akvo/akvo-lumen/issues/184/comments"},"review_comments":{"href":"https://api.github.com/repos/akvo/akvo-lumen/pulls/184/comments"},"review_comment":{"href":"https://api.github.com/repos/akvo/akvo-lumen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akvo/akvo-lumen/pulls/184/commits"},"statuses":{"href":"https://api.github.com/repos/akvo/akvo-lumen/statuses/52738da02bbc0c4f1ab5d9d4ac87850113ab58ca"}}}}
{"actor":{"display_login":"gabemart"}}