diff options
author | Kevin Houdebert <kevin@qwazerty.eu> | 2014-09-07 07:28:44 +0200 |
---|---|---|
committer | Kevin Houdebert <kevin@qwazerty.eu> | 2014-09-07 07:28:44 +0200 |
commit | d80da81422b38a731cc214f7fde3a6bbee41ca67 (patch) | |
tree | 55440a15c80aec51a8dba2398d1769810ea54fd1 | |
parent | d0a08e7dc3b40db1d0827678c07306b21973af8c (diff) | |
download | gitlab-ci-d80da81422b38a731cc214f7fde3a6bbee41ca67.tar.gz |
Add pagination to project API
-rw-r--r-- | lib/api/projects.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index dad783f..5f4bfcf 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -9,7 +9,9 @@ module API # Example Request: # GET /projects get do - gitlab_projects = Project.from_gitlab(current_user, nil, nil, :authorized) + gitlab_projects = Project.from_gitlab( + current_user, params[:page], params[:per_page], :authorized + ) ids = gitlab_projects.map { |project| project.id } projects = Project.where("gitlab_id IN (?)", ids).load @@ -21,7 +23,9 @@ module API # Example Request: # GET /projects/owned get "owned" do - gitlab_projects = Project.from_gitlab(current_user, nil, nil, :owned) + gitlab_projects = Project.from_gitlab( + current_user, params[:page], params[:per_page], :owned + ) ids = gitlab_projects.map { |project| project.id } projects = Project.where("gitlab_id IN (?)", ids).load |