renewal-unlock: orders.renews_at lazy expiry + owner unlock notices (ntfy/sms channels, exempt from metering) — verified

This commit is contained in:
2026-08-10 10:10:50 +10:00
parent 8b5db410a3
commit 9d43403f6f
8 changed files with 141 additions and 33 deletions

View File

@@ -15,6 +15,7 @@ type Order struct {
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
Amount pgtype.Numeric `json:"amount"`
RenewsAt pgtype.Timestamptz `json:"renews_at"`
}
type Product struct {

View File

@@ -222,7 +222,7 @@ func (q *Queries) GetLatestScanByTag(ctx context.Context, tagID int64) (Scan, er
}
const getOrderByID = `-- name: GetOrderByID :one
SELECT id, account_id, status, created_at, updated_at, amount FROM orders WHERE id = $1
SELECT id, account_id, status, created_at, updated_at, amount, renews_at FROM orders WHERE id = $1
`
func (q *Queries) GetOrderByID(ctx context.Context, id int64) (Order, error) {
@@ -235,6 +235,7 @@ func (q *Queries) GetOrderByID(ctx context.Context, id int64) (Order, error) {
&i.CreatedAt,
&i.UpdatedAt,
&i.Amount,
&i.RenewsAt,
)
return i, err
}