fix: update API routes from /api/prompts to /api/trackers

This commit is contained in:
James 2026-02-09 11:26:09 -05:00
parent 0e5c60dab6
commit 7e9395ed6c
2 changed files with 9 additions and 9 deletions

View File

@ -37,7 +37,7 @@ type TrackerRespondRequest struct {
Action string `json:"action"` // "respond", "skip", "dismiss" Action string `json:"action"` // "respond", "skip", "dismiss"
} }
// GET /api/prompts?dossier=X // GET /api/trackers?dossier=X
func handleTrackers(w http.ResponseWriter, r *http.Request) { func handleTrackers(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -116,7 +116,7 @@ func handleTrackers(w http.ResponseWriter, r *http.Request) {
} }
// POST /api/prompts/respond // POST /api/trackers/respond
func handleTrackerRespond(w http.ResponseWriter, r *http.Request) { func handleTrackerRespond(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
@ -173,16 +173,16 @@ func handleTrackerRespond(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(result) json.NewEncoder(w).Encode(result)
} }
// Router for /api/prompts and /api/prompts/* // Router for /api/trackers and /api/trackers/*
func handleTrackersRouter(w http.ResponseWriter, r *http.Request) { func handleTrackersRouter(w http.ResponseWriter, r *http.Request) {
path := r.URL.Path path := r.URL.Path
switch { switch {
case path == "/api/prompts" && r.Method == "GET": case path == "/api/trackers" && r.Method == "GET":
handleTrackers(w, r) handleTrackers(w, r)
case path == "/api/prompts" && r.Method == "POST": case path == "/api/trackers" && r.Method == "POST":
handleTrackerCreate(w, r) handleTrackerCreate(w, r)
case path == "/api/prompts/respond": case path == "/api/trackers/respond":
handleTrackerRespond(w, r) handleTrackerRespond(w, r)
default: default:
http.NotFound(w, r) http.NotFound(w, r)

View File

@ -52,12 +52,12 @@ func main() {
http.HandleFunc("/api/access", handleAccess) http.HandleFunc("/api/access", handleAccess)
http.HandleFunc("/api/audit", handleAudit) http.HandleFunc("/api/audit", handleAudit)
http.HandleFunc("/api/entries", handleEntries) http.HandleFunc("/api/entries", handleEntries)
http.HandleFunc("/api/prompts", handleTrackersRouter) http.HandleFunc("/api/trackers", handleTrackersRouter)
http.HandleFunc("/api/prompts/", handleTrackersRouter) http.HandleFunc("/api/trackers/", handleTrackersRouter)
// http.HandleFunc("/api/prompt/generate", handlePromptGenerate) // REMOVED: Deprecated // http.HandleFunc("/api/prompt/generate", handlePromptGenerate) // REMOVED: Deprecated
// Add the missing freeform handler // Add the missing freeform handler
http.HandleFunc("/api/prompts/freeform", handleFreeform) http.HandleFunc("/api/trackers/freeform", handleFreeform)
// V1 API (new design) // V1 API (new design)
RegisterV1Routes() RegisterV1Routes()