From 8c62428556284d362a757ae58167e7f3c78a5e3f Mon Sep 17 00:00:00 2001 From: Patrick Britton Date: Tue, 17 Feb 2026 16:24:24 -0600 Subject: [PATCH] fix: waitlist handler handles int id, add alter migration for existing waitlist table Co-Authored-By: Claude Sonnet 4.6 --- go-backend/internal/handlers/admin_handler.go | 5 +++-- go-backend/migrations/20260218_waitlist_alter.sql | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 go-backend/migrations/20260218_waitlist_alter.sql diff --git a/go-backend/internal/handlers/admin_handler.go b/go-backend/internal/handlers/admin_handler.go index fe3c6d0..810d244 100644 --- a/go-backend/internal/handlers/admin_handler.go +++ b/go-backend/internal/handlers/admin_handler.go @@ -4443,12 +4443,13 @@ func (h *AdminHandler) AdminListWaitlist(c *gin.Context) { var entries []gin.H for rows.Next() { - var id, email string + var id any // int or uuid depending on schema + var email string var name, referralCode, invitedBy, wlStatus, notes *string var createdAt, updatedAt time.Time if err := rows.Scan(&id, &email, &name, &referralCode, &invitedBy, &wlStatus, ¬es, &createdAt, &updatedAt); err == nil { entries = append(entries, gin.H{ - "id": id, "email": email, "name": name, + "id": fmt.Sprintf("%v", id), "email": email, "name": name, "referral_code": referralCode, "invited_by": invitedBy, "status": wlStatus, "notes": notes, "created_at": createdAt, "updated_at": updatedAt, diff --git a/go-backend/migrations/20260218_waitlist_alter.sql b/go-backend/migrations/20260218_waitlist_alter.sql new file mode 100644 index 0000000..769cd2f --- /dev/null +++ b/go-backend/migrations/20260218_waitlist_alter.sql @@ -0,0 +1,12 @@ +-- Alter existing waitlist table to add missing columns + +ALTER TABLE waitlist + ADD COLUMN IF NOT EXISTS referral_code text, + ADD COLUMN IF NOT EXISTS invited_by text, + ADD COLUMN IF NOT EXISTS status text NOT NULL DEFAULT 'pending', + ADD COLUMN IF NOT EXISTS notes text, + ADD COLUMN IF NOT EXISTS name text, + ADD COLUMN IF NOT EXISTS updated_at timestamptz NOT NULL DEFAULT now(); + +CREATE INDEX IF NOT EXISTS idx_waitlist_status ON waitlist(status); +CREATE INDEX IF NOT EXISTS idx_waitlist_created ON waitlist(created_at DESC);