feat: add endpoint to list disabled users with cursor-based pagination#327
Open
francismars wants to merge 1 commit intopubky:mainfrom
Open
feat: add endpoint to list disabled users with cursor-based pagination#327francismars wants to merge 1 commit intopubky:mainfrom
francismars wants to merge 1 commit intopubky:mainfrom
Conversation
* Implemented `GET /users/disabled` route to retrieve disabled users. * Added pagination support using cursor for efficient data retrieval. * Updated `UserRepository` to include a method for fetching disabled users. * Added tests for the new endpoint and pagination functionality.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an admin endpoint in
pubky-homeserverto list disabled users with cursor pagination.GET /users/disabledto the admin protected router.API contract
Endpoint
GET /users/disabledAuth
Uses existing admin middleware (
X-Admin-Passwordheader).Query params
limit?: u16cursor?: string(z32 pubkey, non-inclusive)Response
{ "items": [{ "pubkey": "..." }], "next_cursor": "..." | null }Error behavior
400 Bad Request(Invalid cursor)Implementation details
pubky-homeserver/src/admin_server/app.rspubky-homeserver/src/admin_server/routes/disable_users.rspubky-homeserver/src/persistence/sql/entities/user.rsPagination behavior:
disabled = truepublic_keyascendingpublic_key > cursor)limit + 1fetch to determinenext_cursorTest plan
cargo fmtcargo check -p pubky-homeserver2 disabled,1 enabled)GET /users/disabled?limit=1returned one disabled user + non-nullnext_cursornext_cursor: null400