From c606572d0838baf6fe72fc8a4c97b614883a227c Mon Sep 17 00:00:00 2001 From: Serious-senpai <57554044+Serious-senpai@users.noreply.github.com> Date: Sat, 21 Sep 2024 18:57:31 +0700 Subject: [PATCH] Fix registration request query --- server/models/reg_request.py | 3 ++- server/routes/api/admin/reg_request.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/models/reg_request.py b/server/models/reg_request.py index 4d8bf31..6b36949 100644 --- a/server/models/reg_request.py +++ b/server/models/reg_request.py @@ -130,7 +130,8 @@ async def query(cls, *, offset: int) -> List[RegisterRequest]: """ SELECT * FROM register_queue ORDER BY request_id DESC - OFFSET ? FETCH ? ROWS ONLY + OFFSET ? ROWS + FETCH NEXT ? ROWS ONLY """, offset, DB_PAGINATION_QUERY, diff --git a/server/routes/api/admin/reg_request.py b/server/routes/api/admin/reg_request.py index 10a8e02..1d61ba8 100644 --- a/server/routes/api/admin/reg_request.py +++ b/server/routes/api/admin/reg_request.py @@ -12,13 +12,13 @@ @api_router.get( "/admin/reg_request", - name=f"Query a maximum of {DB_PAGINATION_QUERY} registration requests from the specified offset", + name="Query registration requests", tags=["admin", "query"], responses={status.HTTP_401_UNAUTHORIZED: {}}, status_code=status.HTTP_200_OK, ) async def admin_login(offset: int, headers: Annotated[Authorization, Header()]) -> List[RegisterRequest]: - """Verify administrator authorization data, return 204 on success, 403 on failure""" + f"""Query a maximum of {DB_PAGINATION_QUERY} registration requests from the specified offset""" if not await Database.instance.verify_admin(headers.username, headers.password): raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED)