all subscriptions

This commit is contained in:
2024-08-21 23:27:33 +02:00
parent f8ee76939e
commit 8fb1844dcd
6 changed files with 84 additions and 5 deletions

View File

@ -297,7 +297,7 @@ func (m *DBModel) UpdatePasswordForUser(u User, hash string) error {
return nil
}
func (m *DBModel) GetAllOrders() ([]*Order, error) {
func (m *DBModel) GetAllOrders(isRecurring bool) ([]*Order, error) {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
@ -315,12 +315,12 @@ func (m *DBModel) GetAllOrders() ([]*Order, error) {
LEFT JOIN transactions t on (o.transaction_id = t.id)
LEFT JOIN customers c on (o.customer_id = c.id)
WHERE
w.is_recurring = 0
w.is_recurring = ?
ORDER BY
o.created_at DESC
`
rows, err := m.DB.QueryContext(ctx, query)
rows, err := m.DB.QueryContext(ctx, query, isRecurring)
if err != nil {
return nil, err
}