init project

This commit is contained in:
Jasder
2020-03-09 00:40:16 +08:00
commit 2937b2a94d
6549 changed files with 7215173 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
class ContentsController < ApplicationController
before_action :find_user, :find_repository
before_action :require_login, only: %i[create update_file delete_file]
def create
interactor = Gitea::CreateFileInteractor.call(current_user, content_params)
if interactor.success?
@file = interactor.result
else
render_error(interactor.error)
end
end
def update_file
interactor = Gitea::UpdateFileInteractor.call(current_user, params)
if interactor.success?
@file = interactor.result
else
render_error(interactor.error)
end
end
def delete_file
interactor = Gitea::DeleteFileInteractor.call(current_user, params)
if interactor.success?
@file = interactor.result
else
render_error(interactor.error)
end
end
private
def content_params
params.permit(:login, :repo_identifier, :filepath, :branch, :content, :message, :new_branch)
end
end