amphora icon indicating copy to clipboard operation
amphora copied to clipboard

Add db paginate

Open james-owen opened this issue 5 years ago • 0 comments

Sets us up for pagination to list endpoints like /_components/instances

  • Calls db.createReadStream() which has been modified in the storage module, for list requests
  • Adds prev and size query params to list requests
  • Checks whether prev matches up with where it's being requested, ie. a request to nymag.com/_components/ad/instances should be for something likenymag.com/_components/ad/instances/aaa, and drops prev if it's invalid, errors if it's not
  • Checks whether size is a number and within the configured maximum, errors if it's not a number

Requires https://github.com/clay/amphora-storage-postgres/pull/64 for pagination.

james-owen avatar Dec 03 '20 16:12 james-owen