{"action":"created","comment":{"url":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/comments/278231036","pull_request_review_id":230240264,"id":278231036,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI3ODIzMTAzNg==","diff_hunk":"@@ -0,0 +1,109 @@\n+package me.andrewda.utils\n+\n+import kotlinx.coroutines.GlobalScope\n+import kotlinx.coroutines.Job\n+import kotlinx.coroutines.launch\n+import org.jetbrains.exposed.dao.Entity\n+import org.jetbrains.exposed.dao.EntityID\n+import kotlin.reflect.full.memberProperties\n+\n+enum class ReadLevel {\n+    USER, SELF, ADMIN\n+}\n+\n+/**\n+ * Marks a field as readable in the API response.\n+ *\n+ * @param key the key to use in the response (defaults to the variable name)\n+ * @param readLevel the [ReadLevel] required to read this value\n+ * @param deep whether this field is a deep (performs a database query)\n+ */\n+annotation class Readable(\n+    val key: String = \"\",\n+    val readLevel: ReadLevel = ReadLevel.USER,\n+    val deep: Boolean = false\n+)\n+\n+/**\n+ * Gets the [ApiResponse] generated for the [Entity] given a specific [readLevel].\n+ *\n+ * @param readLevel the permission level at which the response should be generated\n+ * @return the generated [ApiResponse]\n+ */\n+fun Entity<*>.getApiResponse(readLevel: ReadLevel = ReadLevel.USER): ApiResponse {\n+    val result = mutableMapOf<String, Any?>()","path":"backend/src/main/kotlin/me/andrewda/utils/Models.kt","position":34,"original_position":34,"commit_id":"56633ea58be3240245847a776f4554b37cbedc93","original_commit_id":"56633ea58be3240245847a776f4554b37cbedc93","user":{"login":"JacksonCoder","id":19577865,"node_id":"MDQ6VXNlcjE5NTc3ODY1","avatar_url":"https://avatars0.githubusercontent.com/u/19577865?v=4","gravatar_id":"","url":"https://api.github.com/users/JacksonCoder","html_url":"https://github.com/JacksonCoder","followers_url":"https://api.github.com/users/JacksonCoder/followers","following_url":"https://api.github.com/users/JacksonCoder/following{/other_user}","gists_url":"https://api.github.com/users/JacksonCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/JacksonCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JacksonCoder/subscriptions","organizations_url":"https://api.github.com/users/JacksonCoder/orgs","repos_url":"https://api.github.com/users/JacksonCoder/repos","events_url":"https://api.github.com/users/JacksonCoder/events{/privacy}","received_events_url":"https://api.github.com/users/JacksonCoder/received_events","type":"User","site_admin":false},"body":"It's not immediately obvious that `mutableMapOf<String, Any?>()` makes an `ApiResponse`, so it might be better to make a function in utils called `makeResponse()` or something like that.","created_at":"2019-04-24T17:14:12Z","updated_at":"2019-04-24T17:15:29Z","html_url":"https://github.com/andrewda/ktor-react-starter/pull/9#discussion_r278231036","pull_request_url":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/9","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/comments/278231036"},"html":{"href":"https://github.com/andrewda/ktor-react-starter/pull/9#discussion_r278231036"},"pull_request":{"href":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/9","id":272967734,"node_id":"MDExOlB1bGxSZXF1ZXN0MjcyOTY3NzM0","html_url":"https://github.com/andrewda/ktor-react-starter/pull/9","diff_url":"https://github.com/andrewda/ktor-react-starter/pull/9.diff","patch_url":"https://github.com/andrewda/ktor-react-starter/pull/9.patch","issue_url":"https://api.github.com/repos/andrewda/ktor-react-starter/issues/9","number":9,"state":"open","locked":false,"title":"Generate API response using annotations","user":{"login":"andrewda","id":10191084,"node_id":"MDQ6VXNlcjEwMTkxMDg0","avatar_url":"https://avatars1.githubusercontent.com/u/10191084?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewda","html_url":"https://github.com/andrewda","followers_url":"https://api.github.com/users/andrewda/followers","following_url":"https://api.github.com/users/andrewda/following{/other_user}","gists_url":"https://api.github.com/users/andrewda/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewda/subscriptions","organizations_url":"https://api.github.com/users/andrewda/orgs","repos_url":"https://api.github.com/users/andrewda/repos","events_url":"https://api.github.com/users/andrewda/events{/privacy}","received_events_url":"https://api.github.com/users/andrewda/received_events","type":"User","site_admin":false},"body":"","created_at":"2019-04-24T04:06:32Z","updated_at":"2019-04-24T17:15:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b8893c546aae2d6432b2f4ef498d9532ba82fa2a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/9/commits","review_comments_url":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/9/comments","review_comment_url":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andrewda/ktor-react-starter/issues/9/comments","statuses_url":"https://api.github.com/repos/andrewda/ktor-react-starter/statuses/56633ea58be3240245847a776f4554b37cbedc93","head":{"label":"andrewda:api-reflection","ref":"api-reflection","sha":"56633ea58be3240245847a776f4554b37cbedc93","user":{"login":"andrewda","id":10191084,"node_id":"MDQ6VXNlcjEwMTkxMDg0","avatar_url":"https://avatars1.githubusercontent.com/u/10191084?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewda","html_url":"https://github.com/andrewda","followers_url":"https://api.github.com/users/andrewda/followers","following_url":"https://api.github.com/users/andrewda/following{/other_user}","gists_url":"https://api.github.com/users/andrewda/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewda/subscriptions","organizations_url":"https://api.github.com/users/andrewda/orgs","repos_url":"https://api.github.com/users/andrewda/repos","events_url":"https://api.github.com/users/andrewda/events{/privacy}","received_events_url":"https://api.github.com/users/andrewda/received_events","type":"User","site_admin":false},"repo":{"id":182185696,"node_id":"MDEwOlJlcG9zaXRvcnkxODIxODU2OTY=","name":"ktor-react-starter","full_name":"andrewda/ktor-react-starter","private":false,"owner":{"login":"andrewda","id":10191084,"node_id":"MDQ6VXNlcjEwMTkxMDg0","avatar_url":"https://avatars1.githubusercontent.com/u/10191084?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewda","html_url":"https://github.com/andrewda","followers_url":"https://api.github.com/users/andrewda/followers","following_url":"https://api.github.com/users/andrewda/following{/other_user}","gists_url":"https://api.github.com/users/andrewda/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewda/subscriptions","organizations_url":"https://api.github.com/users/andrewda/orgs","repos_url":"https://api.github.com/users/andrewda/repos","events_url":"https://api.github.com/users/andrewda/events{/privacy}","received_events_url":"https://api.github.com/users/andrewda/received_events","type":"User","site_admin":false},"html_url":"https://github.com/andrewda/ktor-react-starter","description":null,"fork":false,"url":"https://api.github.com/repos/andrewda/ktor-react-starter","forks_url":"https://api.github.com/repos/andrewda/ktor-react-starter/forks","keys_url":"https://api.github.com/repos/andrewda/ktor-react-starter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andrewda/ktor-react-starter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andrewda/ktor-react-starter/teams","hooks_url":"https://api.github.com/repos/andrewda/ktor-react-starter/hooks","issue_events_url":"https://api.github.com/repos/andrewda/ktor-react-starter/issues/events{/number}","events_url":"https://api.github.com/repos/andrewda/ktor-react-starter/events","assignees_url":"https://api.github.com/repos/andrewda/ktor-react-starter/assignees{/user}","branches_url":"https://api.github.com/repos/andrewda/ktor-react-starter/branches{/branch}","tags_url":"https://api.github.com/repos/andrewda/ktor-react-starter/tags","blobs_url":"https://api.github.com/repos/andrewda/ktor-react-starter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andrewda/ktor-react-starter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andrewda/ktor-react-starter/git/refs{/sha}","trees_url":"https://api.github.com/repos/andrewda/ktor-react-starter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andrewda/ktor-react-starter/statuses/{sha}","languages_url":"https://api.github.com/repos/andrewda/ktor-react-starter/languages","stargazers_url":"https://api.github.com/repos/andrewda/ktor-react-starter/stargazers","contributors_url":"https://api.github.com/repos/andrewda/ktor-react-starter/contributors","subscribers_url":"https://api.github.com/repos/andrewda/ktor-react-starter/subscribers","subscription_url":"https://api.github.com/repos/andrewda/ktor-react-starter/subscription","commits_url":"https://api.github.com/repos/andrewda/ktor-react-starter/commits{/sha}","git_commits_url":"https://api.github.com/repos/andrewda/ktor-react-starter/git/commits{/sha}","comments_url":"https://api.github.com/repos/andrewda/ktor-react-starter/comments{/number}","issue_comment_url":"https://api.github.com/repos/andrewda/ktor-react-starter/issues/comments{/number}","contents_url":"https://api.github.com/repos/andrewda/ktor-react-starter/contents/{+path}","compare_url":"https://api.github.com/repos/andrewda/ktor-react-starter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andrewda/ktor-react-starter/merges","archive_url":"https://api.github.com/repos/andrewda/ktor-react-starter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andrewda/ktor-react-starter/downloads","issues_url":"https://api.github.com/repos/andrewda/ktor-react-starter/issues{/number}","pulls_url":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls{/number}","milestones_url":"https://api.github.com/repos/andrewda/ktor-react-starter/milestones{/number}","notifications_url":"https://api.github.com/repos/andrewda/ktor-react-starter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andrewda/ktor-react-starter/labels{/name}","releases_url":"https://api.github.com/repos/andrewda/ktor-react-starter/releases{/id}","deployments_url":"https://api.github.com/repos/andrewda/ktor-react-starter/deployments","created_at":"2019-04-19T02:08:52Z","updated_at":"2019-04-24T00:57:38Z","pushed_at":"2019-04-24T04:12:17Z","git_url":"git://github.com/andrewda/ktor-react-starter.git","ssh_url":"git@github.com:andrewda/ktor-react-starter.git","clone_url":"https://github.com/andrewda/ktor-react-starter.git","svn_url":"https://github.com/andrewda/ktor-react-starter","homepage":null,"size":268,"stargazers_count":4,"watchers_count":4,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":5,"watchers":4,"default_branch":"master"}},"base":{"label":"andrewda:master","ref":"master","sha":"c28cbb3e0f758d9300f4686ce200c37b3fffac27","user":{"login":"andrewda","id":10191084,"node_id":"MDQ6VXNlcjEwMTkxMDg0","avatar_url":"https://avatars1.githubusercontent.com/u/10191084?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewda","html_url":"https://github.com/andrewda","followers_url":"https://api.github.com/users/andrewda/followers","following_url":"https://api.github.com/users/andrewda/following{/other_user}","gists_url":"https://api.github.com/users/andrewda/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewda/subscriptions","organizations_url":"https://api.github.com/users/andrewda/orgs","repos_url":"https://api.github.com/users/andrewda/repos","events_url":"https://api.github.com/users/andrewda/events{/privacy}","received_events_url":"https://api.github.com/users/andrewda/received_events","type":"User","site_admin":false},"repo":{"id":182185696,"node_id":"MDEwOlJlcG9zaXRvcnkxODIxODU2OTY=","name":"ktor-react-starter","full_name":"andrewda/ktor-react-starter","private":false,"owner":{"login":"andrewda","id":10191084,"node_id":"MDQ6VXNlcjEwMTkxMDg0","avatar_url":"https://avatars1.githubusercontent.com/u/10191084?v=4","gravatar_id":"","url":"https://api.github.com/users/andrewda","html_url":"https://github.com/andrewda","followers_url":"https://api.github.com/users/andrewda/followers","following_url":"https://api.github.com/users/andrewda/following{/other_user}","gists_url":"https://api.github.com/users/andrewda/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewda/subscriptions","organizations_url":"https://api.github.com/users/andrewda/orgs","repos_url":"https://api.github.com/users/andrewda/repos","events_url":"https://api.github.com/users/andrewda/events{/privacy}","received_events_url":"https://api.github.com/users/andrewda/received_events","type":"User","site_admin":false},"html_url":"https://github.com/andrewda/ktor-react-starter","description":null,"fork":false,"url":"https://api.github.com/repos/andrewda/ktor-react-starter","forks_url":"https://api.github.com/repos/andrewda/ktor-react-starter/forks","keys_url":"https://api.github.com/repos/andrewda/ktor-react-starter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andrewda/ktor-react-starter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andrewda/ktor-react-starter/teams","hooks_url":"https://api.github.com/repos/andrewda/ktor-react-starter/hooks","issue_events_url":"https://api.github.com/repos/andrewda/ktor-react-starter/issues/events{/number}","events_url":"https://api.github.com/repos/andrewda/ktor-react-starter/events","assignees_url":"https://api.github.com/repos/andrewda/ktor-react-starter/assignees{/user}","branches_url":"https://api.github.com/repos/andrewda/ktor-react-starter/branches{/branch}","tags_url":"https://api.github.com/repos/andrewda/ktor-react-starter/tags","blobs_url":"https://api.github.com/repos/andrewda/ktor-react-starter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andrewda/ktor-react-starter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andrewda/ktor-react-starter/git/refs{/sha}","trees_url":"https://api.github.com/repos/andrewda/ktor-react-starter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andrewda/ktor-react-starter/statuses/{sha}","languages_url":"https://api.github.com/repos/andrewda/ktor-react-starter/languages","stargazers_url":"https://api.github.com/repos/andrewda/ktor-react-starter/stargazers","contributors_url":"https://api.github.com/repos/andrewda/ktor-react-starter/contributors","subscribers_url":"https://api.github.com/repos/andrewda/ktor-react-starter/subscribers","subscription_url":"https://api.github.com/repos/andrewda/ktor-react-starter/subscription","commits_url":"https://api.github.com/repos/andrewda/ktor-react-starter/commits{/sha}","git_commits_url":"https://api.github.com/repos/andrewda/ktor-react-starter/git/commits{/sha}","comments_url":"https://api.github.com/repos/andrewda/ktor-react-starter/comments{/number}","issue_comment_url":"https://api.github.com/repos/andrewda/ktor-react-starter/issues/comments{/number}","contents_url":"https://api.github.com/repos/andrewda/ktor-react-starter/contents/{+path}","compare_url":"https://api.github.com/repos/andrewda/ktor-react-starter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andrewda/ktor-react-starter/merges","archive_url":"https://api.github.com/repos/andrewda/ktor-react-starter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andrewda/ktor-react-starter/downloads","issues_url":"https://api.github.com/repos/andrewda/ktor-react-starter/issues{/number}","pulls_url":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls{/number}","milestones_url":"https://api.github.com/repos/andrewda/ktor-react-starter/milestones{/number}","notifications_url":"https://api.github.com/repos/andrewda/ktor-react-starter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andrewda/ktor-react-starter/labels{/name}","releases_url":"https://api.github.com/repos/andrewda/ktor-react-starter/releases{/id}","deployments_url":"https://api.github.com/repos/andrewda/ktor-react-starter/deployments","created_at":"2019-04-19T02:08:52Z","updated_at":"2019-04-24T00:57:38Z","pushed_at":"2019-04-24T04:12:17Z","git_url":"git://github.com/andrewda/ktor-react-starter.git","ssh_url":"git@github.com:andrewda/ktor-react-starter.git","clone_url":"https://github.com/andrewda/ktor-react-starter.git","svn_url":"https://github.com/andrewda/ktor-react-starter","homepage":null,"size":268,"stargazers_count":4,"watchers_count":4,"language":"Kotlin","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":5,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/9"},"html":{"href":"https://github.com/andrewda/ktor-react-starter/pull/9"},"issue":{"href":"https://api.github.com/repos/andrewda/ktor-react-starter/issues/9"},"comments":{"href":"https://api.github.com/repos/andrewda/ktor-react-starter/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andrewda/ktor-react-starter/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/andrewda/ktor-react-starter/statuses/56633ea58be3240245847a776f4554b37cbedc93"}},"author_association":"OWNER"}}
{"actor":{"display_login":"JacksonCoder"}}