fix: update API routes from /api/prompts to /api/trackers
This commit is contained in:
parent
0e5c60dab6
commit
7e9395ed6c
|
|
@ -37,7 +37,7 @@ type TrackerRespondRequest struct {
|
|||
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) {
|
||||
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) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
|
|
@ -173,16 +173,16 @@ func handleTrackerRespond(w http.ResponseWriter, r *http.Request) {
|
|||
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) {
|
||||
path := r.URL.Path
|
||||
|
||||
switch {
|
||||
case path == "/api/prompts" && r.Method == "GET":
|
||||
case path == "/api/trackers" && r.Method == "GET":
|
||||
handleTrackers(w, r)
|
||||
case path == "/api/prompts" && r.Method == "POST":
|
||||
case path == "/api/trackers" && r.Method == "POST":
|
||||
handleTrackerCreate(w, r)
|
||||
case path == "/api/prompts/respond":
|
||||
case path == "/api/trackers/respond":
|
||||
handleTrackerRespond(w, r)
|
||||
default:
|
||||
http.NotFound(w, r)
|
||||
|
|
|
|||
|
|
@ -52,12 +52,12 @@ func main() {
|
|||
http.HandleFunc("/api/access", handleAccess)
|
||||
http.HandleFunc("/api/audit", handleAudit)
|
||||
http.HandleFunc("/api/entries", handleEntries)
|
||||
http.HandleFunc("/api/prompts", handleTrackersRouter)
|
||||
http.HandleFunc("/api/prompts/", handleTrackersRouter)
|
||||
http.HandleFunc("/api/trackers", handleTrackersRouter)
|
||||
http.HandleFunc("/api/trackers/", handleTrackersRouter)
|
||||
// http.HandleFunc("/api/prompt/generate", handlePromptGenerate) // REMOVED: Deprecated
|
||||
|
||||
// Add the missing freeform handler
|
||||
http.HandleFunc("/api/prompts/freeform", handleFreeform)
|
||||
http.HandleFunc("/api/trackers/freeform", handleFreeform)
|
||||
|
||||
// V1 API (new design)
|
||||
RegisterV1Routes()
|
||||
|
|
|
|||
Loading…
Reference in New Issue