You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
766 B
32 lines
766 B
5 years ago
|
class ContentsController < ApplicationController
|
||
|
before_action :find_user, :find_repository
|
||
|
before_action :require_login, only: %i[create]
|
||
|
|
||
|
def create
|
||
|
# request_params = {user: @user, repo_name: @repo.identifier, filepath: params[:filepath]}
|
||
|
logger.info "current_user ----> #{current_user.login}"
|
||
|
@user = current_user
|
||
|
interactor = Gitea::CreateFileInteractor.call(@user, content_params)
|
||
|
if interactor.success?
|
||
|
@file = interactor.result
|
||
|
logger.info "@file ========> #{@file}"
|
||
|
else
|
||
|
render_error(interactor.error)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def update_file
|
||
|
|
||
|
end
|
||
|
|
||
|
def delete_file
|
||
|
|
||
|
end
|
||
|
|
||
|
private
|
||
|
def content_params
|
||
|
params.permit(:login, :repo_identifier, :filepath, :branch, :content, :message, :new_branch)
|
||
|
end
|
||
|
|
||
|
end
|