Commit bba2b10e authored by Nihad Abbasov's avatar Nihad Abbasov

properly paginate project events in API

parent 7277280d
...@@ -95,10 +95,7 @@ module API ...@@ -95,10 +95,7 @@ module API
# Example Request: # Example Request:
# GET /projects/:id/events # GET /projects/:id/events
get ":id/events" do get ":id/events" do
limit = (params[:per_page] || 20).to_i events = paginate user_project.events.recent
offset = (params[:page] || 0).to_i * limit
events = user_project.events.recent.limit(limit).offset(offset)
present events, with: Entities::Event present events, with: Entities::Event
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment