Commit ff6a6abe authored by Rajendra Kadam's avatar Rajendra Kadam

Use keys create_service to create ssh keys

parent ac4de842
......@@ -264,9 +264,9 @@ module API
user = User.find_by(id: params.delete(:id))
not_found!('User') unless user
key = user.keys.new(declared_params(include_missing: false))
key = ::Keys::CreateService.new(user, declared_params(include_missing: false)).execute
if key.save
if key.persisted?
present key, with: Entities::SSHKey
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