{"action":"created","comment":{"url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/comments/67767622","id":67767622,"diff_hunk":"@@ -0,0 +1,36 @@\n+'use strict';\n+const Joi = require('joi');\n+const DataModel = require('screwdriver-data-model');\n+\n+const ListModel = Joi.array().items(DataModel.job.get);\n+\n+module.exports = (datastore) => ({\n+    method: 'GET',\n+    path: '/jobs',\n+    config: {\n+        description: 'Get jobs with pagination',\n+        notes: 'Returns all jobs records',\n+        tags: ['api', 'jobs'],\n+        handler: (request, reply) => {\n+            const config = {\n+                table: 'jobs',\n+                params: {},\n+                paginate: {\n+                    page: request.query.page,\n+                    count: request.query.count\n+                }\n+            };\n+\n+            datastore.scan(config, reply);\n+        },\n+        response: {\n+            schema: ListModel\n+        },\n+        validate: {\n+            query: {\n+                page: Joi.number().integer().default(1),\n+                count: Joi.number().integer().default(50)","path":"lib/list.js","position":32,"original_position":32,"commit_id":"acdf58fcd7273dee6bfa8cd2be9e2554ce033a9c","original_commit_id":"acdf58fcd7273dee6bfa8cd2be9e2554ce033a9c","user":{"login":"d2lam","id":3401924,"avatar_url":"https://avatars.githubusercontent.com/u/3401924?v=3","gravatar_id":"","url":"https://api.github.com/users/d2lam","html_url":"https://github.com/d2lam","followers_url":"https://api.github.com/users/d2lam/followers","following_url":"https://api.github.com/users/d2lam/following{/other_user}","gists_url":"https://api.github.com/users/d2lam/gists{/gist_id}","starred_url":"https://api.github.com/users/d2lam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d2lam/subscriptions","organizations_url":"https://api.github.com/users/d2lam/orgs","repos_url":"https://api.github.com/users/d2lam/repos","events_url":"https://api.github.com/users/d2lam/events{/privacy}","received_events_url":"https://api.github.com/users/d2lam/received_events","type":"User","site_admin":false},"body":"Yeah I think moving to data-model would be cleaner. \r\n\r\nAdding upper limit makes sense (why would we have lower limit?). My concern is we need to look at the combination of count & page together (probably page*count). Otherwise, let's say if we set upper limit for page = 100 because we want to fail if user requests page=100 and count=1000. But user can request page=100, count=1 (which is not bad at all) and it still fails. ","created_at":"2016-06-20T21:13:54Z","updated_at":"2016-06-20T21:13:54Z","html_url":"https://github.com/screwdriver-cd/plugin-jobs/pull/2#discussion_r67767622","pull_request_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/comments/67767622"},"html":{"href":"https://github.com/screwdriver-cd/plugin-jobs/pull/2#discussion_r67767622"},"pull_request":{"href":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/2","id":74304918,"html_url":"https://github.com/screwdriver-cd/plugin-jobs/pull/2","diff_url":"https://github.com/screwdriver-cd/plugin-jobs/pull/2.diff","patch_url":"https://github.com/screwdriver-cd/plugin-jobs/pull/2.patch","issue_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/issues/2","number":2,"state":"open","locked":false,"title":"Add routes for get, list, and update jobs","user":{"login":"d2lam","id":3401924,"avatar_url":"https://avatars.githubusercontent.com/u/3401924?v=3","gravatar_id":"","url":"https://api.github.com/users/d2lam","html_url":"https://github.com/d2lam","followers_url":"https://api.github.com/users/d2lam/followers","following_url":"https://api.github.com/users/d2lam/following{/other_user}","gists_url":"https://api.github.com/users/d2lam/gists{/gist_id}","starred_url":"https://api.github.com/users/d2lam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d2lam/subscriptions","organizations_url":"https://api.github.com/users/d2lam/orgs","repos_url":"https://api.github.com/users/d2lam/repos","events_url":"https://api.github.com/users/d2lam/events{/privacy}","received_events_url":"https://api.github.com/users/d2lam/received_events","type":"User","site_admin":false},"body":"- list\r\n- save\r\n- get","created_at":"2016-06-17T21:03:25Z","updated_at":"2016-06-20T21:13:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"20fafe66d072dd388568d650961991364f9cdda7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/2/commits","review_comments_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/2/comments","review_comment_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/issues/2/comments","statuses_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/statuses/acdf58fcd7273dee6bfa8cd2be9e2554ce033a9c","head":{"label":"screwdriver-cd:plugin","ref":"plugin","sha":"acdf58fcd7273dee6bfa8cd2be9e2554ce033a9c","user":{"login":"screwdriver-cd","id":19417863,"avatar_url":"https://avatars.githubusercontent.com/u/19417863?v=3","gravatar_id":"","url":"https://api.github.com/users/screwdriver-cd","html_url":"https://github.com/screwdriver-cd","followers_url":"https://api.github.com/users/screwdriver-cd/followers","following_url":"https://api.github.com/users/screwdriver-cd/following{/other_user}","gists_url":"https://api.github.com/users/screwdriver-cd/gists{/gist_id}","starred_url":"https://api.github.com/users/screwdriver-cd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/screwdriver-cd/subscriptions","organizations_url":"https://api.github.com/users/screwdriver-cd/orgs","repos_url":"https://api.github.com/users/screwdriver-cd/repos","events_url":"https://api.github.com/users/screwdriver-cd/events{/privacy}","received_events_url":"https://api.github.com/users/screwdriver-cd/received_events","type":"Organization","site_admin":false},"repo":{"id":61393534,"name":"plugin-jobs","full_name":"screwdriver-cd/plugin-jobs","owner":{"login":"screwdriver-cd","id":19417863,"avatar_url":"https://avatars.githubusercontent.com/u/19417863?v=3","gravatar_id":"","url":"https://api.github.com/users/screwdriver-cd","html_url":"https://github.com/screwdriver-cd","followers_url":"https://api.github.com/users/screwdriver-cd/followers","following_url":"https://api.github.com/users/screwdriver-cd/following{/other_user}","gists_url":"https://api.github.com/users/screwdriver-cd/gists{/gist_id}","starred_url":"https://api.github.com/users/screwdriver-cd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/screwdriver-cd/subscriptions","organizations_url":"https://api.github.com/users/screwdriver-cd/orgs","repos_url":"https://api.github.com/users/screwdriver-cd/repos","events_url":"https://api.github.com/users/screwdriver-cd/events{/privacy}","received_events_url":"https://api.github.com/users/screwdriver-cd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/screwdriver-cd/plugin-jobs","description":"Hapi.js plugin for getting Jobs data in the Screwdriver V3 API","fork":false,"url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs","forks_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/forks","keys_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/teams","hooks_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/hooks","issue_events_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/issues/events{/number}","events_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/events","assignees_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/assignees{/user}","branches_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/branches{/branch}","tags_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/tags","blobs_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/git/refs{/sha}","trees_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/statuses/{sha}","languages_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/languages","stargazers_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/stargazers","contributors_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/contributors","subscribers_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/subscribers","subscription_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/subscription","commits_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/commits{/sha}","git_commits_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/git/commits{/sha}","comments_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/comments{/number}","issue_comment_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/issues/comments{/number}","contents_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/contents/{+path}","compare_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/merges","archive_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/downloads","issues_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/issues{/number}","pulls_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls{/number}","milestones_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/milestones{/number}","notifications_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/labels{/name}","releases_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/releases{/id}","deployments_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/deployments","created_at":"2016-06-17T18:15:43Z","updated_at":"2016-06-17T20:33:48Z","pushed_at":"2016-06-20T18:32:53Z","git_url":"git://github.com/screwdriver-cd/plugin-jobs.git","ssh_url":"git@github.com:screwdriver-cd/plugin-jobs.git","clone_url":"https://github.com/screwdriver-cd/plugin-jobs.git","svn_url":"https://github.com/screwdriver-cd/plugin-jobs","homepage":"https://app.wercker.com/#applications/57643e6fa79f5ea83006e239","size":10,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"screwdriver-cd:master","ref":"master","sha":"549af1377271bce04e1b60b24db34bec83ae9fc5","user":{"login":"screwdriver-cd","id":19417863,"avatar_url":"https://avatars.githubusercontent.com/u/19417863?v=3","gravatar_id":"","url":"https://api.github.com/users/screwdriver-cd","html_url":"https://github.com/screwdriver-cd","followers_url":"https://api.github.com/users/screwdriver-cd/followers","following_url":"https://api.github.com/users/screwdriver-cd/following{/other_user}","gists_url":"https://api.github.com/users/screwdriver-cd/gists{/gist_id}","starred_url":"https://api.github.com/users/screwdriver-cd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/screwdriver-cd/subscriptions","organizations_url":"https://api.github.com/users/screwdriver-cd/orgs","repos_url":"https://api.github.com/users/screwdriver-cd/repos","events_url":"https://api.github.com/users/screwdriver-cd/events{/privacy}","received_events_url":"https://api.github.com/users/screwdriver-cd/received_events","type":"Organization","site_admin":false},"repo":{"id":61393534,"name":"plugin-jobs","full_name":"screwdriver-cd/plugin-jobs","owner":{"login":"screwdriver-cd","id":19417863,"avatar_url":"https://avatars.githubusercontent.com/u/19417863?v=3","gravatar_id":"","url":"https://api.github.com/users/screwdriver-cd","html_url":"https://github.com/screwdriver-cd","followers_url":"https://api.github.com/users/screwdriver-cd/followers","following_url":"https://api.github.com/users/screwdriver-cd/following{/other_user}","gists_url":"https://api.github.com/users/screwdriver-cd/gists{/gist_id}","starred_url":"https://api.github.com/users/screwdriver-cd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/screwdriver-cd/subscriptions","organizations_url":"https://api.github.com/users/screwdriver-cd/orgs","repos_url":"https://api.github.com/users/screwdriver-cd/repos","events_url":"https://api.github.com/users/screwdriver-cd/events{/privacy}","received_events_url":"https://api.github.com/users/screwdriver-cd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/screwdriver-cd/plugin-jobs","description":"Hapi.js plugin for getting Jobs data in the Screwdriver V3 API","fork":false,"url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs","forks_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/forks","keys_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/teams","hooks_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/hooks","issue_events_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/issues/events{/number}","events_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/events","assignees_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/assignees{/user}","branches_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/branches{/branch}","tags_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/tags","blobs_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/git/refs{/sha}","trees_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/statuses/{sha}","languages_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/languages","stargazers_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/stargazers","contributors_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/contributors","subscribers_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/subscribers","subscription_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/subscription","commits_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/commits{/sha}","git_commits_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/git/commits{/sha}","comments_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/comments{/number}","issue_comment_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/issues/comments{/number}","contents_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/contents/{+path}","compare_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/merges","archive_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/downloads","issues_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/issues{/number}","pulls_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls{/number}","milestones_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/milestones{/number}","notifications_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/labels{/name}","releases_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/releases{/id}","deployments_url":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/deployments","created_at":"2016-06-17T18:15:43Z","updated_at":"2016-06-17T20:33:48Z","pushed_at":"2016-06-20T18:32:53Z","git_url":"git://github.com/screwdriver-cd/plugin-jobs.git","ssh_url":"git@github.com:screwdriver-cd/plugin-jobs.git","clone_url":"https://github.com/screwdriver-cd/plugin-jobs.git","svn_url":"https://github.com/screwdriver-cd/plugin-jobs","homepage":"https://app.wercker.com/#applications/57643e6fa79f5ea83006e239","size":10,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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/screwdriver-cd/plugin-jobs/pulls/2"},"html":{"href":"https://github.com/screwdriver-cd/plugin-jobs/pull/2"},"issue":{"href":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/issues/2"},"comments":{"href":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/screwdriver-cd/plugin-jobs/statuses/acdf58fcd7273dee6bfa8cd2be9e2554ce033a9c"}}}}
{"actor":{"display_login":"d2lam"}}