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:
parent
21bd173d70
commit
e8d0656fc6
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue