新增: 合并请求文件变更列表拆解

This commit is contained in:
2024-11-07 16:45:40 +08:00
parent 6e40112138
commit fe971495cd
3 changed files with 22 additions and 1 deletions
@@ -6,13 +6,21 @@ class Api::V1::Projects::Pulls::PullsController < Api::V1::BaseController
@pulls = kaminari_paginate(@pulls)
end
before_action :load_pull_request, only: [:show]
before_action :load_pull_request, only: [:show, :files]
def show
@result_object = Api::V1::Projects::Pulls::GetService.call(@project, @pull_request, current_user&.gitea_token)
@last_review = @pull_request.reviews.order(created_at: :desc).take
end
def files
if params[:filepath].present?
@result_object = $gitea_hat_client.get_repos_pulls_files_by_owner_repo_index_filepath(@project&.owner.login, @project&.identifier, @pull_request.gitea_number, params[:filepath], {query: {token: current_user&.gitea_token}})
else
@result_object = $gitea_client.get_repos_pulls_files_by_owner_repo_index(@project&.owner.login, @project&.identifier, @pull_request.gitea_number, {query: {token: current_user&.gitea_token, page: page, limit: limit}})
end
end
private
def query_params
params.permit(:status, :keyword, :priority_id, :issue_tag_id, :version_id, :reviewer_id, :sort_by, :sort_direction)