Return 404 if market not paid

This commit is contained in:
ekzyis 2024-08-24 22:30:04 -05:00
parent 607e1007d0
commit 6c723b0304
1 changed files with 5 additions and 3 deletions

View File

@ -99,9 +99,11 @@ func HandleMarket(sc context.Context) echo.HandlerFunc {
if err = db.QueryRowContext(ctx, ""+ if err = db.QueryRowContext(ctx, ""+
"SELECT m.id, m.question, m.description, m.created_at, m.end_date, "+ "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 "+ "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 "+ "FROM markets m "+
"WHERE m.id = $1", id).Scan( "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, &m.Id, &m.Question, &m.Description, &m.CreatedAt, &m.EndDate,
&u.Id, &u.Name, &u.CreatedAt, &u.LnPubkey, &u.NostrPubkey, &u.Msats); err != nil { &u.Id, &u.Name, &u.CreatedAt, &u.LnPubkey, &u.NostrPubkey, &u.Msats); err != nil {
if err == sql.ErrNoRows { if err == sql.ErrNoRows {