2019-05-18 00:54:41 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
2020-07-28 23:09:34 +05:30
|
|
|
class ProjectEvents < Grape::API::Instance
|
2019-05-18 00:54:41 +05:30
|
|
|
include PaginationParams
|
|
|
|
include APIGuard
|
|
|
|
helpers ::API::Helpers::EventsHelpers
|
|
|
|
|
|
|
|
params do
|
|
|
|
requires :id, type: String, desc: 'The ID of a project'
|
|
|
|
end
|
|
|
|
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
|
|
|
|
desc "List a Project's visible events" do
|
|
|
|
success Entities::Event
|
|
|
|
end
|
|
|
|
params do
|
|
|
|
use :pagination
|
|
|
|
use :event_filter_params
|
|
|
|
use :sort_params
|
|
|
|
end
|
|
|
|
|
|
|
|
get ":id/events" do
|
|
|
|
events = find_events(user_project)
|
|
|
|
|
|
|
|
present_events(events)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|