Fix pagination issue in API

The limit, offset and total_count were not handled properly.

Fixes #11
This commit is contained in:
Stephane Poss 2025-10-02 11:47:35 +02:00 committed by GitHub
parent cddd20e0a5
commit 7c3100e648
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,6 @@
api.dmsf do
api.array :dmsf_nodes, api_meta(total_count: @query.dmsf_nodes(offset: @offset, limit: @limit).count) do
api.array :dmsf_nodes, api_meta(:total_count => @query.dmsf_nodes().count, :limit => @limit, :offset => @offset) do
@query.dmsf_nodes(offset: @offset, limit: @limit).each do |node|
api.node do
api.id node.id
@ -25,4 +25,4 @@ api.dmsf do
end
end
end
end