2020-07-13 14:09:16 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module ServiceDeskSettings
|
|
|
|
class UpdateService < BaseService
|
|
|
|
def execute
|
|
|
|
settings = ServiceDeskSetting.safe_find_or_create_by!(project_id: project.id)
|
|
|
|
|
2020-08-12 17:09:54 -04:00
|
|
|
params[:project_key] = nil if params[:project_key].blank?
|
|
|
|
|
2020-07-13 14:09:16 -04:00
|
|
|
if settings.update(params)
|
|
|
|
success
|
|
|
|
else
|
|
|
|
error(settings.errors.full_messages.to_sentence)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|