From 6edba7f58873b53169cb988d5d99dc215f561b11 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Tue, 18 Mar 2025 18:55:40 +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..1009d0e --- /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 +from core.auth import get_current_user_dummy + +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": username, + "token": "jwt_token_" + username, + "features": { + "rate_limit": 100, + "expires_in": 3600, + "permissions": ["read", "write"] + }, + "metadata": { + "last_login": "2024-01-01T00:00:00Z", + "session_id": "sess_" + username + } + } \ No newline at end of file