新增: 查询删除分支与普通分支
This commit is contained in:
parent
a644a65493
commit
feec49d4bd
|
@ -2,7 +2,7 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
|
|||
before_action :require_public_and_member_above, only: [:index, :all]
|
||||
|
||||
def index
|
||||
@result_object = Api::V1::Projects::Branches::ListService.call(@project, {name: params[:keyword], page: page, limit: limit}, current_user&.gitea_token)
|
||||
@result_object = Api::V1::Projects::Branches::ListService.call(@project, {name: params[:keyword], state: params[:state], page: page, limit: limit}, current_user&.gitea_token)
|
||||
end
|
||||
|
||||
def all
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Api::V1::Projects::Branches::ListService < ApplicationService
|
||||
|
||||
attr_accessor :project, :token, :owner, :repo, :name, :page, :limit
|
||||
attr_accessor :project, :token, :owner, :repo, :name, :state, :page, :limit
|
||||
attr_accessor :gitea_data, :gitea_repo_data
|
||||
|
||||
def initialize(project, params, token=nil)
|
||||
|
@ -9,6 +9,7 @@ class Api::V1::Projects::Branches::ListService < ApplicationService
|
|||
@repo = project&.identifier
|
||||
@token = token
|
||||
@name = params[:name]
|
||||
@state = params[:state]
|
||||
@page = params[:page]
|
||||
@limit = params[:limit]
|
||||
end
|
||||
|
@ -29,7 +30,8 @@ class Api::V1::Projects::Branches::ListService < ApplicationService
|
|||
limit: limit
|
||||
}
|
||||
params.merge!({name: name}) if name.present?
|
||||
|
||||
params.merge!({state: state}) if state.present?
|
||||
|
||||
params
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue