OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/api/v3/activities/activities_api.rb

32 lines
682 B

module API
module V3
module Activities
class ActivitiesAPI < Grape::API
resources :activities do
params do
requires :id, desc: 'Activity id'
end
namespace ':id' do
before do
@activity = Journal.find(params[:id])
model = ::API::V3::Activities::ActivityModel.new(@activity)
@representer = ::API::V3::Activities::ActivityRepresenter.new(model)
end
get do
authorize(:view_project, context: @activity.journable.project)
@representer.to_json
end
end
end
end
end
end
end