Update code in endpoints/users/hashadproject-8ld3bk.post.py
This commit is contained in:
parent
83e6d4f8ca
commit
8bbc7f15c7
27
endpoints/users/hashadproject-8ld3bk.post.py
Normal file
27
endpoints/users/hashadproject-8ld3bk.post.py
Normal file
@ -0,0 +1,27 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from core.database import fake_users_db
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/users/hashadproject-8ld3bk")
|
||||
async def fetch_user_details(
|
||||
code_id: str
|
||||
):
|
||||
"""Fetch user details based on codeID"""
|
||||
user = fake_users_db.get(code_id)
|
||||
if not user:
|
||||
raise HTTPException(status_code=404, detail="User not found")
|
||||
|
||||
return {
|
||||
"message": "User details retrieved successfully",
|
||||
"data": {
|
||||
"user_id": user["id"],
|
||||
"username": code_id,
|
||||
"email": user["email"],
|
||||
"status": "active" if not user["disabled"] else "disabled"
|
||||
},
|
||||
"metadata": {
|
||||
"source": "demo_db",
|
||||
"timestamp": "2024-01-01T00:00:00Z"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user