-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add support for giving back total count via header #31
base: main
Are you sure you want to change the base?
Conversation
d4c1089
to
44d016c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you'd be willing to flesh this out further to hit the other spots with count support and add documentation to the README, I'd be happy to merge this.
44d016c
to
9679bfe
Compare
Pull Request Test Coverage Report for Build 102
💛 - Coveralls |
Pull Request Test Coverage Report for Build 101
💛 - Coveralls |
hrm... in populate modelFull[options.associationAttr] is used to get the length but later modelFull is returned. Does it make sense to return the full object? I mean only the association (the array of items) is/should be populated. That way it's easier to work with the data, since just the array is returned. Esp since we also do pagination, that seems odd. Then it might make more sense to rewrite the query so it just uses the base object for the join but doesn't select anything from it. |
9679bfe
to
71f19ec
Compare
I have some ideas on populate: Currently it's only possible to populate one specific key. The user may want to populate some or all of them. And for a particular object. So it may make sense to provide a query parameter for find-by-id (or even find aswell) where the user can specify "*" or a comma-seperated list of association attributes to populate. |
This adds a new includeTotalCount flag that by default exposes the current range and total count as specified in content-range and a property totalCountHeader, which if set to anything other than 'content-range' will add a header that contains just the total number of elements
This is more or less an attempt to be compatible with whatever https://www.npmjs.com/package/ra-data-simple-rest expects as return value
Note: this is incomplete as it's missing support in other tandys with count support