diff --git a/pkg/arvo/app/link-server-hook.hoon b/pkg/arvo/app/link-server-hook.hoon index c634d4a6e..f5bb1ca82 100644 --- a/pkg/arvo/app/link-server-hook.hoon +++ b/pkg/arvo/app/link-server-hook.hoon @@ -239,8 +239,9 @@ ++ page-size 25 ++ get-paginated |* [l=(list) p=(unit @ud)] - ^- [pages=@ud page=_l] - :- +((div (lent l) page-size)) + ^- [total=@ud pages=@ud page=_l] + :+ (lent l) + +((div (lent l) page-size)) ?~ p l %+ scag page-size %+ slag (mul u.p page-size) @@ -248,16 +249,19 @@ :: ++ page-to-json =, enjs:format - |* [[total-pages=@ud page=(list)] item-to-json=$-(* json)] + |* $: [total-items=@ud total-pages=@ud page=(list)] + item-to-json=$-(* json) + == ^- json %- pairs - :~ 'total-pages'^(numb total-pages) + :~ 'total-items'^(numb total-items) + 'total-pages'^(numb total-pages) 'page'^a+(turn page item-to-json) == :: ++ get-submissions |= [=path p=(unit @ud)] - ^- [@ud submissions] + ^- [@ud @ud submissions] =- (get-paginated - p) .^ submissions %gx @@ -270,7 +274,7 @@ :: ++ get-local-pages |= [=path p=(unit @ud)] - ^- [@ud pages] + ^- [@ud @ud pages] =- (get-paginated - p) .^ pages %gx @@ -283,7 +287,7 @@ :: ++ get-discussions |= [=path p=(unit @ud)] - ^- [@ud comments] + ^- [@ud @ud comments] =- (get-paginated - p) .^ comments %gx