Commit c855e61a authored by Rajendra Kadam's avatar Rajendra Kadam

Use GpgKeys::CreateService when a user creates gpg keys for themselves via the API

parent 318d5541
......@@ -792,9 +792,9 @@ module API
requires :key, type: String, desc: 'The new GPG key'
end
post 'gpg_keys' do
key = current_user.gpg_keys.new(declared_params)
key = ::GpgKeys::CreateService.new(current_user, declared_params(include_missing: false)).execute
if key.save
if key.persisted?
present key, with: Entities::GpgKey
else
render_validation_error!(key)
......
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