Skip to content
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

Allow batch endpoints to be ordered #960

Open
donaldgray opened this issue Feb 14, 2025 · 0 comments
Open

Allow batch endpoints to be ordered #960

donaldgray opened this issue Feb 14, 2025 · 0 comments
Labels
API https://dlcs-book.readthedocs.io/en/latest/ enhancement New feature or request

Comments

@donaldgray
Copy link
Member

donaldgray commented Feb 14, 2025

There are 3 endpoints that return details of batches, each of which has different default ordering:

  • /customers/{customerId}/queue/batches - Get all customer batches, ordered by batch Id ASC (earliest created first)
  • /customers/{customerId}/queue/active - Get customer batches that are incomplete and not superseded, ordered by database default (no specific ordering applied).
  • /customers/{customerId}/queue/recent - Get customer batches that are finished, ordered by finished DESC (last finished first)

These endpoints should be updated to handle ?orderBy and ?orderByDescending query parameters to allow consumer to specify ordering. Handling the following values as these allow sorting by finished and created order:

  • finished - order by "Finished" date. Note that Postgres treats null values as larger than non-null so orderByDescending=finished would return unfinished first by default. Is this expected? Or would it be confusing? (may be able to avoid with coalesce DateTime.Min but NULLS LAST doesn't look to be supported by npgsql)
  • id - order by the PK "batch", this is generated from a sequence so will be the order the rows were written.

Do we also want to allow ordering by counts?

  • count - order by the total number of items in batch
  • errors - order by total number of errors
  • completed - order by total number of completed assets

Any DB implications? Will we need new indexes for larger dbs?

@donaldgray donaldgray added API https://dlcs-book.readthedocs.io/en/latest/ enhancement New feature or request labels Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API https://dlcs-book.readthedocs.io/en/latest/ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant