use default endpoints for version api

pull/7379/head
ulferts 5 years ago
parent 9e90d8c196
commit 01e86e29df
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 21
      lib/api/v3/versions/versions_api.rb

@ -33,14 +33,14 @@ module API
module Versions
class VersionsAPI < ::API::OpenProjectAPI
resources :versions do
get do
# the distinct(false) is added in order to allow ORDER BY LOWER(name)
# which would otherwise be invalid in postgresql
# SELECT DISTINCT, ORDER BY expressions must appear in select list
::API::V3::Utilities::ParamsToQuery.collection_response(Version.visible(current_user).distinct(false),
current_user,
params)
end
get &::API::V3::Utilities::Endpoints::Index.new(model: Version,
scope: -> {
# the distinct(false) is added in order to allow ORDER BY LOWER(name)
# which would otherwise be invalid in postgresql
# SELECT DISTINCT, ORDER BY expressions must appear in select list
Version.visible(current_user).distinct(false)
})
.mount
post &::API::V3::Utilities::Endpoints::Create.new(model: Version).mount
@ -67,10 +67,7 @@ module API
end
end
get do
VersionRepresenter.create(@version, current_user: current_user, embed_links: true)
end
get &::API::V3::Utilities::Endpoints::Show.new(model: Version).mount
patch &::API::V3::Utilities::Endpoints::Update.new(model: Version).mount
delete &::API::V3::Utilities::Endpoints::Delete.new(model: Version).mount

Loading…
Cancel
Save