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

Loading…
Cancel
Save