diff --git a/backend/app/api/v1/routes_glossaries.py b/backend/app/api/v1/routes_glossaries.py index 5eaf993..2f53979 100644 --- a/backend/app/api/v1/routes_glossaries.py +++ b/backend/app/api/v1/routes_glossaries.py @@ -137,7 +137,7 @@ async def list_terms( terms, total = await svc.get_terms_page(vid, search=search, page=page, page_size=page_size) return { - "terms": [{"source_term": t.source_term, "translations": t.translations} for t in terms], + "terms": [{"source_term": t["source_term"], "translations": t["translations"]} for t in terms], "total": total, "page": page, "page_size": page_size, diff --git a/backend/app/services/glossary_service.py b/backend/app/services/glossary_service.py index 5c96742..18d7b39 100644 --- a/backend/app/services/glossary_service.py +++ b/backend/app/services/glossary_service.py @@ -713,7 +713,7 @@ async def get_terms_page( search: str | None = None, page: int = 1, page_size: int = 50, -) -> tuple[list[GlossaryTerm], int]: +) -> tuple[list[dict], int]: """Returns (terms, total_count) for paginated UI preview.""" db = await get_database() query: dict = {"version_id": version_id} @@ -732,5 +732,7 @@ async def get_terms_page( terms = [] for d in docs: d["_id"] = str(d["_id"]) - terms.append(GlossaryTerm.model_validate(d)) + # Only source_term + translations are projected — build a minimal dict + # rather than validating against GlossaryTerm (which requires more fields) + terms.append({"_id": d["_id"], "source_term": d.get("source_term", ""), "translations": d.get("translations", {})}) return terms, total