ADD simple project api

This commit is contained in:
Jasder
2020-06-29 16:05:22 +08:00
parent 38746464a8
commit 1133517127
4 changed files with 43 additions and 3 deletions
+8 -1
View File
@@ -1,7 +1,8 @@
class ProjectsController < ApplicationController
include ApplicationHelper
include OperateProjectAbilityAble
before_action :require_login, except: %i[index branches group_type_list]
include ProjectsHelper
before_action :require_login, except: %i[index branches group_type_list simple]
before_action :find_project_with_id, only: %i[show branches update destroy fork_users praise_users watch_users]
before_action :authorizate_user_can_edit_project!, only: %i[update]
before_action :project_public?, only: %i[fork_users praise_users watch_user]
@@ -98,6 +99,12 @@ class ProjectsController < ApplicationController
@fork_users = paginate(fork_users)
end
def simple
project = Project.includes(:owner).select(:id, :name, :identifier, :user_id).find params[:id]
json_response(project)
end
private
def project_params
params.permit(:user_id, :name, :description, :repository_name,