mirror of
https://github.com/getAlby/lndhub.go.git
synced 2026-01-07 06:56:11 +01:00
write new func for finding payments
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/getAlby/lndhub.go/db/models"
|
||||
"github.com/getsentry/sentry-go"
|
||||
@@ -14,6 +15,18 @@ import (
|
||||
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
|
||||
)
|
||||
|
||||
func (svc *LndhubService) GetPendingPaymentsUntil(ctx context.Context, ts time.Time) ([]models.Invoice, error) {
|
||||
payments := []models.Invoice{}
|
||||
err := svc.DB.NewSelect().
|
||||
Model(&payments).
|
||||
Where("state = 'initialized'").
|
||||
Where("type = 'outgoing'").
|
||||
Where("r_hash != ''").
|
||||
Where("created_at >= (now() - interval '2 weeks') ").
|
||||
Scan(ctx)
|
||||
return payments, err
|
||||
}
|
||||
|
||||
func (svc *LndhubService) GetAllPendingPayments(ctx context.Context) ([]models.Invoice, error) {
|
||||
payments := []models.Invoice{}
|
||||
err := svc.DB.NewSelect().Model(&payments).Where("state = 'initialized'").Where("type = 'outgoing'").Where("r_hash != ''").Where("created_at >= (now() - interval '2 weeks') ").Scan(ctx)
|
||||
|
||||
Reference in New Issue
Block a user