From 13cf7a7e2d2404ddf4b655e2f4181b6e620d2493 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Thu, 5 Mar 2026 15:41:56 +0000 Subject: [PATCH] Add fake leads listing Just to get JavaScript to stop complaining. --- api/lead.go | 11 +++++++++++ api/routes.go | 1 + 2 files changed, 12 insertions(+) diff --git a/api/lead.go b/api/lead.go index 2b36e87a..c9fad0c8 100644 --- a/api/lead.go +++ b/api/lead.go @@ -15,7 +15,18 @@ type formLeads struct { type createdLead struct { ID int `json:"id"` } +type contentListLead struct { + Leads []lead `json:"leads"` +} +type lead struct { + ID int32 `json:"id"` +} +func listLead(ctx context.Context, r *http.Request, org *models.Organization, user *models.User) (*contentListLead, *nhttp.ErrorWithStatus) { + return &contentListLead{ + Leads: make([]lead, 0), + }, nil +} func postLeads(ctx context.Context, r *http.Request, org *models.Organization, user *models.User, f formLeads) (*createdLead, *nhttp.ErrorWithStatus) { log.Info().Ints("signal ids", f.SignalIDs).Msg("fake post leads") return &createdLead{ diff --git a/api/routes.go b/api/routes.go index 3771d238..66fa62fd 100644 --- a/api/routes.go +++ b/api/routes.go @@ -19,6 +19,7 @@ func AddRoutes(r chi.Router) { r.Method("POST", "/audio/{uuid}/content", auth.NewEnsureAuth(apiAudioContentPost)) r.Method("POST", "/image/{uuid}", auth.NewEnsureAuth(apiImagePost)) r.Method("POST", "/image/{uuid}/content", auth.NewEnsureAuth(apiImageContentPost)) + r.Method("GET", "/leads", authenticatedHandlerJSON(listLead)) r.Method("POST", "/leads", authenticatedHandlerJSONPost(postLeads)) // Unauthenticated endpoints