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

Retrieve winningBids from separate endpoint #539

Open
georgiana-b opened this issue Jul 19, 2020 · 2 comments
Open

Retrieve winningBids from separate endpoint #539

georgiana-b opened this issue Jul 19, 2020 · 2 comments

Comments

@georgiana-b
Copy link
Member

The list of winningBids was removed from the node, edge and cluster details payload (/networks/{networkID}/nodes/{nodeID}, /networks/{networkID}/edges/{edgeID}/ ) because it was slowing things down significantly for nodes with many tenders.

Instead I created 3 new endpoints where the bids can be retrieved in a paginated way to avoid long and heavy requests:

  • /networks/{networkID}/nodes/{nodeID}/bids - to retrieve the tenders of an actor
  • /networks/{networkID}/clusters/{clusterID}/bids - to retrieve the tenders of a cluster
  • /networks/{networkID}/edges/{edgeID}/bids - to retrieve the tenders of an edge

All the 3 endpoints support 2 parameters for pagination:

  • limit - how many tenders should be returned per page
  • page - number of the page, should be increased as you load results until the response is empty

To load the first 10 results of a node, for example you can make the following request:

GET /networks/{networkID}/nodes/{nodeID}/bids?limit=10&page=1

Then to load the next 10 results you would do

GET /networks/{networkID}/nodes/{nodeID}/bids?limit=10&page=2

and so on until you retrieve all the results.

You can tell that you've reached the last page by the fact that the number of results is < limit. If you go past the page with the last set of results, on the next pages after that you will just get an empty array.

@georgiana-b
Copy link
Member Author

@ca1yps0 I added some more details to the bid results, as we discussed.

So the paginated results on /node/{nodeID}/bids, edge/{edgeId}/bids /cluster/{clusterID}/bids now look like this:

{
  "page": "{number of the current page}",
  "resultsPerPage": "{current number of results to be returned per page}",
  "totalResults": "{total number of results}",
  "totalPages": "{number of pages with results}",
  "bids": [{array of bids exactly as they looked like before}]
}

Let me know if anything.

@georgiana-b
Copy link
Member Author

We also decided to allow the user to set the limit for how many things to load on the page themselves, from a dropdown with 3 options: 5, 10 and 50.

The bids will come directly ordered by the amount from the backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant