Files
ubicloud/routes/project/inference_api_key.rb
Enes Cakir 1e565ee9f0 Update rubocop and standard versions
Offenses:

    routes/project/inference_api_key.rb:13:9: C: Style/ItAssignment: it is the default block parameter; consider another name.
            it = DB.transaction { ApiKey.create_inference_api_key(@project) }
            ^^
    routes/project/inference_api_key.rb:19:13: C: Style/ItAssignment: it is the default block parameter; consider another name.
            if (it = inference_api_key_ds.with_pk(UBID.to_uuid(ubid)))
                ^^
2025-01-17 10:58:37 +03:00

29 lines
872 B
Ruby

# frozen_string_literal: true
class Clover
hash_branch(:project_prefix, "inference-api-key") do |r|
r.web do
r.get true do
@inference_api_keys = Serializers::InferenceApiKey.serialize(inference_api_key_ds.all)
view "inference/api_key/index"
end
r.post true do
authorize("InferenceApiKey:create", @project.id)
iak = DB.transaction { ApiKey.create_inference_api_key(@project) }
flash["notice"] = "Created Inference API Key with id #{iak.ubid}"
r.redirect "#{@project.path}/inference-api-key"
end
r.delete String do |ubid|
if (iak = inference_api_key_ds.with_pk(UBID.to_uuid(ubid)))
authorize("InferenceApiKey:delete", iak.id)
iak.destroy
flash["notice"] = "Inference API Key deleted successfully"
end
204
end
end
end
end