-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination links #104
Comments
Created a PR for this #107. |
Even though the PR is merged, there is still one outstanding issue with it. I'll paste what I wrote on the PR:
def links(data, conn, %{cursor: cursor}) do
%{
next: url_for_pagination(data, conn, %{cursor: cursor})
}
end
render(conn, "index.json", %{data: %{collection: collection, pagination: pagination}})
def encode_data(view, data, conn, query_includes) when is_list(data) do
Enum.map_reduce(data, [], fn d, acc ->
{to_include, encoded_data} = encode_data(view, d, conn, query_includes)
{to_include, acc ++ [encoded_data]}
end)
end
|
I have the code ready for this, that I've been running, but wanted to get your take on it first. Please let me know how to proceed. |
@zamith how about opening a PR? We can always close the PR if it's decided not to merge. |
Is this supposed to work? If so, how do you add pagination links? I've enabled
I'm passing pagination parameters to Scrivener which returns a page/size/total data which I should pass back to the view somehow, but didn't find any hint in the docs on how to do this. The |
As far as I could tell the QueryParser will correctly parse pagination data, but there is not way to then add pagination links (
next
,prev
,first
and/orlast
) to the links object at the collection level, as per the JSON:API spec.Am I missing something or is it really a feature that is missing? If so, would you be willing to take a PR on that?
The text was updated successfully, but these errors were encountered: