|
|
|
@@ -5,16 +5,17 @@ class MarkFilesController < ApplicationController |
|
|
|
|
|
|
|
def index |
|
|
|
@files_result = Gitea::PullRequest::FilesService.call(@owner.login, @project.identifier, @pull_request.gitea_number, current_user&.gitea_token) |
|
|
|
|
|
|
|
MarkFile.bulk_insert(*%i[pull_request_id, file_path_sha file_path created_at updated_at]) do |worker| |
|
|
|
@files_result['Files'].echo do |file| |
|
|
|
worker.add(pull_request_id: @pull_request.id, file_path_sha: SecureRandom.uuid.gsub("-", ""), file_path: file['Name']) |
|
|
|
end |
|
|
|
end |
|
|
|
@mark_files = MarkFile.where(pull_request_id: @pull_request.id) |
|
|
|
end |
|
|
|
|
|
|
|
def create |
|
|
|
unless @pull_request.mark_files.present? |
|
|
|
MarkFile.bulk_insert(*%i[pull_request_id, file_path_sha file_path created_at updated_at]) do |worker| |
|
|
|
@files_result['Files'].each do |file| |
|
|
|
worker.add(pull_request_id: @pull_request.id, file_path_sha: SecureRandom.uuid.gsub("-", ""), file_path: file['Name']) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
private |
|
|
|
|