From 279560220d4061e6499984bc5f7603df3eabf4ea Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 19 Mar 2025 09:08:52 +0000 Subject: [PATCH] Update code in endpoints/api/v1/endpoint.post.py --- endpoints/api/v1/endpoint.post.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 endpoints/api/v1/endpoint.post.py diff --git a/endpoints/api/v1/endpoint.post.py b/endpoints/api/v1/endpoint.post.py new file mode 100644 index 0000000..73d21d9 --- /dev/null +++ b/endpoints/api/v1/endpoint.post.py @@ -0,0 +1,30 @@ +from fastapi import APIRouter, Depends, HTTPException +from core.database import fake_users_db + +router = APIRouter() + +@router.post("/login") +async def login( + username: str, + password: str +): + """User login endpoint""" + user = fake_users_db.get(username) + if not user or user["password"] != password: + raise HTTPException(status_code=400, detail="Invalid username or password") + + return { + "message": "Login successful", + "user_id": user["id"], + "username": username, + "token": f"demo_token_{username}", + "features": { + "rate_limit": 100, + "expires_in": 3600, + "permissions": ["read", "write"] + }, + "metadata": { + "last_login": "2024-01-01T00:00:00Z", + "session_type": "demo" + } + } \ No newline at end of file