Skip to content

[FR] Pagination - Not enough context #35

@steviehol

Description

@steviehol

Issues

The current pagination interface/classes do not accept enough parameters to create proper links

Details

Since the paginator is attached to a Serializer, the Paginator constructor can only accept the object or an Array of objects. However, to correctly use page-based pagination, you need the current query params supplied to a request to be available as well as a metaValue total.

Ex. (Articles Collection has 85 records)
GET /articles?page[number]=1&page[size]=10 Should fetch the first ten articles and serialize them. The resulting pagination links should be

{
    first: '/articles?page[number]=1$page[size]=10',
    last: '/articles?page[number]=8&page[size]=10',
    next: 'articles?page[number]=2&page[size]=10',
    prev: null
}

Notice how the information here is only derivable given the request query params. In addition, a total needs to be supplied in some way to the serializer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions