Only fetch paid orders

This commit is contained in:
ekzyis 2023-11-27 02:46:48 +01:00
parent b82e5de63c
commit b2d8c089c9
1 changed files with 2 additions and 1 deletions

View File

@ -138,7 +138,8 @@ func (db *DB) FetchMarketOrders(marketId int64, orders *[]Order) error {
"SELECT o.id, share_id, o.pubkey, o.side, o.quantity, o.price, o.invoice_id, o.created_at, s.description, s.market_id " +
"FROM orders o " +
"JOIN shares s ON o.share_id = s.id " +
"WHERE s.market_id = $1 " +
"JOIN invoices i ON i.id = o.invoice_id " +
"WHERE s.market_id = $1 AND i.confirmed_at IS NOT NULL " +
"ORDER BY o.created_at DESC"
rows, err := db.Query(query, marketId)
if err != nil {