From 6c723b0304271f7f4c1c04e242943b65654c906b Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 24 Aug 2024 22:30:04 -0500 Subject: [PATCH] Return 404 if market not paid --- server/router/handler/market.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/router/handler/market.go b/server/router/handler/market.go index 8238e9f..bcc88e3 100644 --- a/server/router/handler/market.go +++ b/server/router/handler/market.go @@ -99,9 +99,11 @@ func HandleMarket(sc context.Context) echo.HandlerFunc { if err = db.QueryRowContext(ctx, ""+ "SELECT m.id, m.question, m.description, m.created_at, m.end_date, "+ - "u.id, u.name, u.created_at, u.ln_pubkey, u.nostr_pubkey, msats "+ - "FROM markets m JOIN users u ON m.user_id = u.id "+ - "WHERE m.id = $1", id).Scan( + "u.id, u.name, u.created_at, u.ln_pubkey, u.nostr_pubkey, u.msats "+ + "FROM markets m "+ + "JOIN users u ON m.user_id = u.id "+ + "JOIN invoices i ON m.invoice_id = i.id "+ + "WHERE m.id = $1 AND i.confirmed_at IS NOT NULL", id).Scan( &m.Id, &m.Question, &m.Description, &m.CreatedAt, &m.EndDate, &u.Id, &u.Name, &u.CreatedAt, &u.LnPubkey, &u.NostrPubkey, &u.Msats); err != nil { if err == sql.ErrNoRows {