Updates to intel and correlation
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import uuid
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
from typing import Dict, Optional
|
||||
from app.models import SystemCreate, SystemRecord
|
||||
from app.internal import firestore as fstore
|
||||
|
||||
@@ -12,6 +12,10 @@ class VocabularyTermBody(BaseModel):
|
||||
term: str
|
||||
|
||||
|
||||
class TenCodesBody(BaseModel):
|
||||
ten_codes: Dict[str, str]
|
||||
|
||||
|
||||
@router.get("")
|
||||
async def list_systems():
|
||||
return await fstore.collection_list("systems")
|
||||
@@ -50,6 +54,27 @@ async def delete_system(system_id: str):
|
||||
await fstore.doc_delete("systems", system_id)
|
||||
|
||||
|
||||
# ── Ten-codes endpoints ────────────────────────────────────────────────────────
|
||||
|
||||
@router.get("/{system_id}/ten-codes")
|
||||
async def get_ten_codes(system_id: str):
|
||||
"""Return the ten-code dictionary for a system."""
|
||||
system = await fstore.doc_get("systems", system_id)
|
||||
if not system:
|
||||
raise HTTPException(404, f"System '{system_id}' not found.")
|
||||
return {"ten_codes": system.get("ten_codes") or {}}
|
||||
|
||||
|
||||
@router.put("/{system_id}/ten-codes")
|
||||
async def update_ten_codes(system_id: str, body: TenCodesBody):
|
||||
"""Replace the ten-code dictionary for a system."""
|
||||
existing = await fstore.doc_get("systems", system_id)
|
||||
if not existing:
|
||||
raise HTTPException(404, f"System '{system_id}' not found.")
|
||||
await fstore.doc_update("systems", system_id, {"ten_codes": body.ten_codes})
|
||||
return {"ok": True, "ten_codes": body.ten_codes}
|
||||
|
||||
|
||||
# ── Vocabulary endpoints ───────────────────────────────────────────────────────
|
||||
|
||||
@router.get("/{system_id}/vocabulary")
|
||||
|
||||
Reference in New Issue
Block a user