diff --git a/api/api_v1.go b/api/api_v1.go index ae44073..94e8b5c 100644 --- a/api/api_v1.go +++ b/api/api_v1.go @@ -234,14 +234,7 @@ func v1Entries(w http.ResponseWriter, r *http.Request, dossierID string) { parentID := q.Get("parent") category := 0 if cat := q.Get("category"); cat != "" { - // Support both "genome" and "category004" formats - if strings.HasPrefix(cat, "category") { - // Parse "category004" -> 4 - fmt.Sscanf(cat, "category%d", &category) - } else { - // Parse name like "genome", "upload", etc. - category = lib.CategoryFromString[cat] - } + category = lib.CategoryFromString[cat] } filter := &lib.EntryFilter{ DossierID: dossierID, @@ -269,7 +262,7 @@ func v1Entries(w http.ResponseWriter, r *http.Request, dossierID string) { entry := map[string]any{ "id": e.EntryID, "parent_id": e.ParentID, - "category": lib.CategoryKey(e.Category), + "category": lib.CategoryName(e.Category), "type": e.Type, "summary": e.Summary, "ordinal": e.Ordinal, @@ -313,7 +306,7 @@ func v1Entry(w http.ResponseWriter, r *http.Request, dossierID, entryID string) entry := map[string]any{ "id": e.EntryID, "parent_id": e.ParentID, - "category": lib.CategoryKey(e.Category), + "category": lib.CategoryName(e.Category), "type": e.Type, "summary": e.Summary, "ordinal": e.Ordinal,