|
|
@ -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 |
|
|
|
|
|
|
|
|
|
|
|