forked from Gitlink/forgeplus
Update get simpe project api
This commit is contained in:
parent
e671071420
commit
062a47d889
|
@ -100,8 +100,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def simple
|
||||
project = Project.includes(:owner).select(:id, :name, :identifier, :user_id).find params[:id]
|
||||
|
||||
project = Project.includes(:owner, :repository).select(:id, :name, :identifier, :user_id, :project_type).find params[:id]
|
||||
json_response(project)
|
||||
end
|
||||
|
||||
|
|
|
@ -29,7 +29,17 @@ module ProjectsHelper
|
|||
end
|
||||
|
||||
def json_response(project)
|
||||
json = {
|
||||
repo = project.repository
|
||||
tmp_json = {}
|
||||
unless project.common?
|
||||
tmp_json = tmp_json.merge({
|
||||
mirror_status: repo.mirror_status,
|
||||
mirror_num: repo.mirror_num,
|
||||
first_sync: repo.first_sync?
|
||||
})
|
||||
end
|
||||
|
||||
tmp_json = tmp_json.merge({
|
||||
identifier: project.identifier,
|
||||
name: project.name,
|
||||
id: project.id,
|
||||
|
@ -38,7 +48,7 @@ module ProjectsHelper
|
|||
name: project.owner.real_name,
|
||||
image_url: url_to_avatar(project.owner)
|
||||
}
|
||||
}
|
||||
render json: json
|
||||
}).compact
|
||||
render json: tmp_json
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue