24 lines
480 B
Ruby
24 lines
480 B
Ruby
module ProtectedBranches
|
|
class CreateService < ProtectedBranches::BaseService
|
|
def call
|
|
validate!
|
|
|
|
ProtectedBranch.transaction do
|
|
save_gitea_protected_branch!
|
|
save_protected_branch!
|
|
end
|
|
|
|
protected_branch
|
|
end
|
|
|
|
private
|
|
def protected_branch
|
|
@protected_branch ||= repository.protected_branches.new(protected_branch_params)
|
|
end
|
|
|
|
def save_protected_branch!
|
|
protected_branch.save
|
|
end
|
|
end
|
|
end
|