26 lines
648 B
Python
26 lines
648 B
Python
from fastapi import APIRouter, Depends, HTTPException
|
|
from core.database import fake_users_db
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/api/users")
|
|
async def get_users_handler():
|
|
"""Fetch all users from database"""
|
|
users = [
|
|
{
|
|
"id": data["id"],
|
|
"username": username,
|
|
"email": data["email"],
|
|
"disabled": data["disabled"]
|
|
}
|
|
for username, data in fake_users_db.items()
|
|
]
|
|
|
|
return {
|
|
"message": "Users retrieved successfully",
|
|
"data": users,
|
|
"metadata": {
|
|
"total_count": len(users),
|
|
"source": "demo_db"
|
|
}
|
|
} |