feat(админка): карточка клиента и drawer

This commit is contained in:
anor
2026-11-06 21:44:07 +10:00
parent c7558f2772
commit 9c9da0f85f
11 changed files with 351 additions and 4 deletions
+45
View File
@@ -108,6 +108,51 @@ async def customers_list(request: Request, query: str = "", q: str = "", status:
raise HTTPException(503, str(e)) from e
@router.get("/customers/{email}")
async def customer_card(email: str, request: Request):
require_admin(request)
data = await asyncio.to_thread(customers.card, email)
if data is None:
raise HTTPException(404, "Клиент не найден")
return data
@router.get("/customers/{email}/dialogs")
async def customer_dialogs(email: str, request: Request):
require_admin(request)
data = await asyncio.to_thread(customers.dialogs, email)
if data is None:
raise HTTPException(404, "Клиент не найден")
return {"items": data}
@router.get("/customers/{email}/ledger")
async def customer_ledger(email: str, request: Request):
require_admin(request)
data = await asyncio.to_thread(customers.ledger, email)
if data is None:
raise HTTPException(404, "Клиент не найден")
return data
@router.get("/customers/{email}/files")
async def customer_files(email: str, request: Request):
require_admin(request)
data = await asyncio.to_thread(customers.files, email)
if data is None:
raise HTTPException(404, "Клиент не найден")
return {"items": data}
@router.get("/customers/{email}/history")
async def customer_history(email: str, request: Request):
require_admin(request)
data = await asyncio.to_thread(customers.history, email)
if data is None:
raise HTTPException(404, "Клиент не найден")
return {"items": data}
@router.get("/dashboard")
async def dashboard(request: Request):
user = require_admin(request)