gitlab-org--gitlab-foss/app/services/applications/create_service.rb
Thong Kuah cc1ccbf83a Move non-controller code into dedicated service
This should help with code re-use when we create applications for group
level cluster next.

Change `find_or_initialize_by` to explicitly find or build the right
association based on the application name. The benefit here is that we
use the associations on @cluster rather than querying from the other
side of the association.
2018-10-15 11:07:47 +13:00

17 lines
427 B
Ruby

# frozen_string_literal: true
module Applications
class CreateService
# rubocop: disable CodeReuse/ActiveRecord
def initialize(current_user, params)
@current_user = current_user
@params = params.except(:ip_address)
end
# rubocop: enable CodeReuse/ActiveRecord
# EE would override and use `request` arg
def execute(request)
Doorkeeper::Application.create(@params)
end
end
end