BigW Consortium Gitlab

Commit 1b111b83 by tiagonbotelho

changes the usage of simpleprojectdetails to already implemented…

changes the usage of simpleprojectdetails to already implemented basicprojectsdetails and changes the url to a more reader friendly format
parent 4c43ba8b
......@@ -3,7 +3,7 @@
groupPath: "/api/:version/groups/:id.json"
namespacesPath: "/api/:version/namespaces.json"
groupProjectsPath: "/api/:version/groups/:id/projects.json"
projectsPath: "/api/:version/projects/simple.json"
projectsPath: "/api/:version/projects.json?format=simple"
labelsPath: "/api/:version/projects/:id/labels"
licensePath: "/api/:version/licenses/:key"
gitignorePath: "/api/:version/gitignores/:key"
......
......@@ -79,12 +79,6 @@ module API
expose :public_builds
end
class SimpleProject < Grape::Entity
expose :id
expose :name, :name_with_namespace
expose :http_url_to_repo
end
class ProjectMember < UserBasic
expose :access_level do |user, options|
options[:project].project_members.find_by(user_id: user.id).access_level
......@@ -334,7 +328,7 @@ module API
end
end
class SimpleProjectWithAccess < SimpleProject
class BasicProjectWithAccess < BasicProjectDetails
expose :permissions do
expose :project_access, using: Entities::ProjectAccess do |project, options|
project.project_members.find_by(user_id: options[:user].id)
......
......@@ -25,18 +25,11 @@ module API
@projects = current_user.authorized_projects
@projects = filter_projects(@projects)
@projects = paginate @projects
if params["format"]
present @projects, with: Entities::BasicProjectWithAccess, user: current_user
else
present @projects, with: Entities::ProjectWithAccess, user: current_user
end
# Get a simplified project list for authenticated user
#
# Example Request:
# GET /projects/simple
get '/simple' do
@projects = current_user.authorized_projects
@projects = filter_projects(@projects)
@projects = paginate @projects
present @projects, with: Entities::SimpleProjectWithAccess, user: current_user
end
# Get an owned projects list for authenticated user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment