[GH-ISSUE #1222] Admin plugin listUsers: add "total" property #8648

Closed
opened 2026-04-13 03:48:06 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @dergreg on GitHub (Jan 15, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1222

Is this suited for github?

  • Yes, this is suited for github

In my admin dashboard, I implemented a table to list all users and ban/unban or even remove them, using all the APIs the admin plugin offers.

It would be helpful to have a total count in the listUsers response to allow for a precise paging of the table and showing the total count of all users. Having a total allows for calculating the offset/limit properly.

Describe the solution you'd like

It would be helpful to have a total count in the listUsers response to allow for a precise paging of the table and showing the total count of all users. Having a total allows for calculating the offset/limit properly with "prev/next" buttons.

Describe alternatives you've considered

Paging with an unknown amount of users/pages that will simply disable the "Next" paging button when the last response returned less then limit users for a given offset.

Additional context

No response

Originally created by @dergreg on GitHub (Jan 15, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1222 ### Is this suited for github? - [X] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. In my admin dashboard, I implemented a table to list all users and ban/unban or even remove them, using all the APIs the admin plugin offers. It would be helpful to have a `total` count in the `listUsers` response to allow for a precise paging of the table and showing the total count of all users. Having a total allows for calculating the offset/limit properly. ### Describe the solution you'd like It would be helpful to have a `total` count in the `listUsers` response to allow for a precise paging of the table and showing the total count of all users. Having a total allows for calculating the offset/limit properly with "prev/next" buttons. ### Describe alternatives you've considered Paging with an unknown amount of users/pages that will simply disable the "Next" paging button when the last response returned less then `limit` users for a given offset. ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 03:48:06 -05:00
Author
Owner

@mmikhan commented on GitHub (Jan 19, 2025):

Agree, I also had the same issue and I had to count the total user manually for the manual pagination on TanStack table

<!-- gh-comment-id:2600821972 --> @mmikhan commented on GitHub (Jan 19, 2025): Agree, I also had the same issue and I had to count the total user manually for the manual pagination on TanStack table
Author
Owner

@dergreg commented on GitHub (Jan 20, 2025):

I took a deeper look into the implementation. I guess some kind of "count" method must be added to the adapter interface (and all implementing adapters) that return the total count of a given record type with an optional where clause provided

https://github.com/better-auth/better-auth/blob/main/packages/better-auth/src/types/adapter.ts#L38

<!-- gh-comment-id:2603284977 --> @dergreg commented on GitHub (Jan 20, 2025): I took a deeper look into the implementation. I guess some kind of "count" method must be added to the adapter interface (and all implementing adapters) that return the total count of a given record type with an optional where clause provided https://github.com/better-auth/better-auth/blob/main/packages/better-auth/src/types/adapter.ts#L38
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8648