feat: Add GET endpoint /books
This commit is contained in:
parent
105ecd53df
commit
9c9f758daa
25
endpoints/books.get.py
Normal file
25
endpoints/books.get.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from core.auth import get_current_user_dummy
|
||||||
|
from core.database import fake_users_db
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.post("/login")
|
||||||
|
async def login_demo(
|
||||||
|
username: str = "demo",
|
||||||
|
password: str = "password"
|
||||||
|
):
|
||||||
|
"""Demo login endpoint"""
|
||||||
|
user = fake_users_db.get(username)
|
||||||
|
if not user or user["password"] != password:
|
||||||
|
raise HTTPException(status_code=400, detail="Invalid credentials")
|
||||||
|
|
||||||
|
return {
|
||||||
|
"message": "Login successful (demo)",
|
||||||
|
"user": username,
|
||||||
|
"token": "dummy_jwt_token_123",
|
||||||
|
"features": {
|
||||||
|
"rate_limit": 100,
|
||||||
|
"expires_in": 3600
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user