PhilanthropyDataCommons / service

A project for collecting and serving public information associated with grant applications
GNU Affero General Public License v3.0
8 stars 2 forks source link

Think about bundle counts / totals #895

Open slifty opened 7 months ago

slifty commented 7 months ago

Several of our endpoints that return collections return a Bundle which includes a total number of entries (not just the amount returned). As we begin to add things like filters and user authentication this total is going to start to get a little confusing.

Currently it returns the true total number of entries in the database, NOT the total that would be available based on the filters provided. For instance, this would expose the total number of bulk uploads across ALL users, rather than just the total number of uploads for a given user.

I think this is probably an incorrect implementation.

reefdog commented 7 months ago

Ohh, that's a good point. So if I call a bundle endpoint with a filter, I can dictate how many results I want per page, and I can see the total number of entities in the table (excluding my filter), but I can't know if there are more results that match my filter than the _count that I indicated.

Yes this would be a good addition. To be honest I was confused by the total attribute the first time I saw it. I assumed it was basically a proxy for entries.length (which it obviously isn't). Not that that's the point here, but just as a note.

So theoretically there are four relevant totals: