Update code in endpoints/Outliners-Staffs.post.py
This commit is contained in:
parent
63e3211070
commit
4a93c64a1b
@ -0,0 +1,34 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from core.database import fake_users_db
|
||||
import uuid
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/Outliners-Staffs")
|
||||
async def outliners_staffs_handler(
|
||||
name: str = "staff_name",
|
||||
role: str = "staff_role",
|
||||
department: str = "department"
|
||||
):
|
||||
"""Create new outliner staff entry"""
|
||||
staff_id = str(uuid.uuid4())
|
||||
|
||||
staff_entry = {
|
||||
"id": staff_id,
|
||||
"name": name,
|
||||
"role": role,
|
||||
"department": department,
|
||||
"status": "active"
|
||||
}
|
||||
|
||||
fake_users_db[staff_id] = staff_entry
|
||||
|
||||
return {
|
||||
"message": "Staff member created successfully",
|
||||
"staff_id": staff_id,
|
||||
"data": staff_entry,
|
||||
"metadata": {
|
||||
"created_at": "demo_timestamp",
|
||||
"department_count": len([s for s in fake_users_db.values() if isinstance(s, dict) and s.get("department") == department])
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user