fix: waitlist handler handles int id, add alter migration for existing waitlist table

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Patrick Britton 2026-02-17 16:24:24 -06:00
parent e06b7252c4
commit 8c62428556
2 changed files with 15 additions and 2 deletions

View file

@ -4443,12 +4443,13 @@ func (h *AdminHandler) AdminListWaitlist(c *gin.Context) {
var entries []gin.H var entries []gin.H
for rows.Next() { 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 name, referralCode, invitedBy, wlStatus, notes *string
var createdAt, updatedAt time.Time var createdAt, updatedAt time.Time
if err := rows.Scan(&id, &email, &name, &referralCode, &invitedBy, &wlStatus, &notes, &createdAt, &updatedAt); err == nil { if err := rows.Scan(&id, &email, &name, &referralCode, &invitedBy, &wlStatus, &notes, &createdAt, &updatedAt); err == nil {
entries = append(entries, gin.H{ 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, "referral_code": referralCode, "invited_by": invitedBy,
"status": wlStatus, "notes": notes, "status": wlStatus, "notes": notes,
"created_at": createdAt, "updated_at": updatedAt, "created_at": createdAt, "updated_at": updatedAt,

View file

@ -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);