Use UpdateRunnerService to update runner in API:

TODO: Add tests to make sure controllers and API
would tick the queue.
This commit is contained in:
Lin Jen-Shin 2017-02-08 22:29:44 +08:00
parent 80bc66596a
commit c1a37c6032
1 changed files with 2 additions and 1 deletions

View File

@ -60,8 +60,9 @@ module API
put ':id' do
runner = get_runner(params.delete(:id))
authenticate_update_runner!(runner)
update_service = Ci::UpdateRunnerService.new(runner)
if runner.update(declared_params(include_missing: false))
if update_service.update(declared_params(include_missing: false))
present runner, with: Entities::RunnerDetails, current_user: current_user
else
render_validation_error!(runner)