Initial commit — DRB server stack
Includes c2-core (FastAPI/MQTT/Firestore), discord-bot (slash commands), frontend (Next.js admin UI), and mosquitto config.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from fastapi import APIRouter, HTTPException, Query
|
||||
from typing import Optional
|
||||
from app.internal import firestore as fstore
|
||||
|
||||
router = APIRouter(prefix="/calls", tags=["calls"])
|
||||
|
||||
|
||||
@router.get("")
|
||||
async def list_calls(
|
||||
node_id: Optional[str] = Query(None),
|
||||
status: Optional[str] = Query(None),
|
||||
system_id: Optional[str] = Query(None),
|
||||
):
|
||||
filters = {}
|
||||
if node_id:
|
||||
filters["node_id"] = node_id
|
||||
if status:
|
||||
filters["status"] = status
|
||||
if system_id:
|
||||
filters["system_id"] = system_id
|
||||
return await fstore.collection_list("calls", **filters)
|
||||
|
||||
|
||||
@router.get("/{call_id}")
|
||||
async def get_call(call_id: str):
|
||||
call = await fstore.doc_get("calls", call_id)
|
||||
if not call:
|
||||
raise HTTPException(404, f"Call '{call_id}' not found.")
|
||||
return call
|
||||
Reference in New Issue
Block a user