Commit efa10c81 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Replace context with service in lib

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 4a1654ed
...@@ -21,7 +21,7 @@ module API ...@@ -21,7 +21,7 @@ module API
attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message] attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message]
branch_name = attrs.delete(:branch_name) branch_name = attrs.delete(:branch_name)
file_path = attrs.delete(:file_path) file_path = attrs.delete(:file_path)
result = ::Files::CreateContext.new(user_project, current_user, attrs, branch_name, file_path).execute result = ::Files::CreateService.new(user_project, current_user, attrs, branch_name, file_path).execute
if result[:status] == :success if result[:status] == :success
status(201) status(201)
...@@ -51,7 +51,7 @@ module API ...@@ -51,7 +51,7 @@ module API
attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message] attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message]
branch_name = attrs.delete(:branch_name) branch_name = attrs.delete(:branch_name)
file_path = attrs.delete(:file_path) file_path = attrs.delete(:file_path)
result = ::Files::UpdateContext.new(user_project, current_user, attrs, branch_name, file_path).execute result = ::Files::UpdateService.new(user_project, current_user, attrs, branch_name, file_path).execute
if result[:status] == :success if result[:status] == :success
status(200) status(200)
...@@ -81,7 +81,7 @@ module API ...@@ -81,7 +81,7 @@ module API
attrs = attributes_for_keys [:file_path, :branch_name, :commit_message] attrs = attributes_for_keys [:file_path, :branch_name, :commit_message]
branch_name = attrs.delete(:branch_name) branch_name = attrs.delete(:branch_name)
file_path = attrs.delete(:file_path) file_path = attrs.delete(:file_path)
result = ::Files::DeleteContext.new(user_project, current_user, attrs, branch_name, file_path).execute result = ::Files::DeleteService.new(user_project, current_user, attrs, branch_name, file_path).execute
if result[:status] == :success if result[:status] == :success
status(200) status(200)
......
...@@ -102,7 +102,7 @@ module API ...@@ -102,7 +102,7 @@ module API
:visibility_level, :visibility_level,
:import_url] :import_url]
attrs = map_public_to_visibility_level(attrs) attrs = map_public_to_visibility_level(attrs)
@project = ::Projects::CreateContext.new(current_user, attrs).execute @project = ::Projects::CreateService.new(current_user, attrs).execute
if @project.saved? if @project.saved?
present @project, with: Entities::Project present @project, with: Entities::Project
else else
...@@ -143,7 +143,7 @@ module API ...@@ -143,7 +143,7 @@ module API
:public, :public,
:visibility_level] :visibility_level]
attrs = map_public_to_visibility_level(attrs) attrs = map_public_to_visibility_level(attrs)
@project = ::Projects::CreateContext.new(user, attrs).execute @project = ::Projects::CreateService.new(user, attrs).execute
if @project.saved? if @project.saved?
present @project, with: Entities::Project present @project, with: Entities::Project
else else
......
...@@ -66,7 +66,7 @@ namespace :gitlab do ...@@ -66,7 +66,7 @@ namespace :gitlab do
project_params[:namespace_id] = group.id project_params[:namespace_id] = group.id
end end
project = Projects::CreateContext.new(user, project_params).execute project = Projects::CreateService.new(user, project_params).execute
if project.valid? if project.valid?
puts " * Created #{project.name} (#{repo_path})".green puts " * Created #{project.name} (#{repo_path})".green
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment