feat: API routes — speakers, rooms, search, RAG
Full implementations replacing stubs: speakers CRUD with utterance count, rooms list + mute/unmute via pipeline, FTS5-based search, RAG /ask and /summary endpoints. 15 route tests (8 new) all passing; 35 total. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
def test_list_speakers_empty(api_client):
|
||||
resp = api_client.get("/api/speakers")
|
||||
assert resp.status_code == 200
|
||||
assert resp.json() == []
|
||||
|
||||
|
||||
def test_create_speaker(api_client):
|
||||
resp = api_client.post("/api/speakers", json={"name": "Alice"})
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert data["name"] == "Alice"
|
||||
assert "id" in data
|
||||
|
||||
|
||||
def test_list_speakers_includes_utterance_count(api_client, seeded_db):
|
||||
room = seeded_db.execute("SELECT id FROM rooms WHERE name='Kitchen'").fetchone()
|
||||
speaker = seeded_db.execute("SELECT id FROM speakers WHERE name='Jeremy'").fetchone()
|
||||
seeded_db.execute(
|
||||
"INSERT INTO utterances (room_id, speaker_id, transcript, match_status, start_time, end_time) VALUES (?,?,?,?,?,?)",
|
||||
(room["id"], speaker["id"], "hi", "known", "2026-01-01 10:00:00", "2026-01-01 10:00:01"),
|
||||
)
|
||||
seeded_db.commit()
|
||||
resp = api_client.get("/api/speakers")
|
||||
data = resp.json()
|
||||
jeremy = next(s for s in data if s["name"] == "Jeremy")
|
||||
assert jeremy["utterance_count"] == 1
|
||||
Reference in New Issue
Block a user