From 0ade06efd6b5d16697497f8cf4c104a37e25926d Mon Sep 17 00:00:00 2001 From: No767 <73260931+No767@users.noreply.github.com> Date: Mon, 11 Nov 2024 00:32:59 -0800 Subject: [PATCH] Add back deleted route --- server/routes/user.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 server/routes/user.py diff --git a/server/routes/user.py b/server/routes/user.py new file mode 100644 index 0000000..9ffd7aa --- /dev/null +++ b/server/routes/user.py @@ -0,0 +1,27 @@ +from pydantic import BaseModel +from utils.request import RouteRequest +from utils.router import KanaeRouter + + +class NotFound(BaseModel): + error: str = "Resource not found" + + +class GetUser(BaseModel): + user: str + + +router = KanaeRouter(prefix="/users", tags=["Users"]) + + +@router.get( + "/get", + response_model=GetUser, + responses={200: {"model": GetUser}, 404: {"model": NotFound}}, + name="Get users", +) +@router.limiter.limit("1/minute") +async def get_users(request: RouteRequest) -> GetUser: + query = "SELECT 1;" + status = await request.app.pool.execute(query) + return GetUser(user=status)