fix: return category names instead of category keys in v1 API

Changed v1Entries and v1Entry to return category names ('genome', 'upload')
instead of keys ('category004', 'category005'). This makes the API consistent
and prevents MCP from passing back the wrong format.

Removed category004 format parsing since API no longer returns it.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
James 2026-02-09 14:50:20 -05:00
parent 21bd173d70
commit e8d0656fc6
1 changed files with 3 additions and 10 deletions

View File

@ -234,14 +234,7 @@ func v1Entries(w http.ResponseWriter, r *http.Request, dossierID string) {
parentID := q.Get("parent") parentID := q.Get("parent")
category := 0 category := 0
if cat := q.Get("category"); cat != "" { if cat := q.Get("category"); cat != "" {
// Support both "genome" and "category004" formats category = lib.CategoryFromString[cat]
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]
}
} }
filter := &lib.EntryFilter{ filter := &lib.EntryFilter{
DossierID: dossierID, DossierID: dossierID,
@ -269,7 +262,7 @@ func v1Entries(w http.ResponseWriter, r *http.Request, dossierID string) {
entry := map[string]any{ entry := map[string]any{
"id": e.EntryID, "id": e.EntryID,
"parent_id": e.ParentID, "parent_id": e.ParentID,
"category": lib.CategoryKey(e.Category), "category": lib.CategoryName(e.Category),
"type": e.Type, "type": e.Type,
"summary": e.Summary, "summary": e.Summary,
"ordinal": e.Ordinal, "ordinal": e.Ordinal,
@ -313,7 +306,7 @@ func v1Entry(w http.ResponseWriter, r *http.Request, dossierID, entryID string)
entry := map[string]any{ entry := map[string]any{
"id": e.EntryID, "id": e.EntryID,
"parent_id": e.ParentID, "parent_id": e.ParentID,
"category": lib.CategoryKey(e.Category), "category": lib.CategoryName(e.Category),
"type": e.Type, "type": e.Type,
"summary": e.Summary, "summary": e.Summary,
"ordinal": e.Ordinal, "ordinal": e.Ordinal,