Update code in endpoints/api/users.post.py
This commit is contained in:
parent
665292674e
commit
7511f15e33
26
endpoints/api/users.post.py
Normal file
26
endpoints/api/users.post.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user