- Schema: plans, orders subscription cols + plan_id + period_started_at, billing_events log, users.stripe_id + sms_credits, products.price_aud (db/schema.sql + Laravel migration, idempotent) - Laravel/Cashier: Billable User, checkout (annual sub + one-off SKUs with Managed Payments tax_code), webhook controller (signature-verified, idempotent, BILLING_ENABLED kill-switch), account tag transitions, nightly reconcile, Stripe portal link, PlanResource + billing dashboard - Go frontend: account-level gating (paid sub required), SMS pool (included 50/yr + credits, drawn after included), plan caps replace constants, 60s plan cache (credits fresh), 25-tag cap (plan max_tags) - BillingSeeder: personal plan + 3 SKUs + dev paid orders - Verified test-mode e2e: subscribe/paid/active/alerts, pool exhaust + credits resume, lapsed/suspended, cancelled/closed, recover/active, webhook idempotency, 25-cap, one-off SKUs, replacement, kill-switch, invalid signature 400
114 lines
4.4 KiB
Go
114 lines
4.4 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
|
|
package db
|
|
|
|
import (
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
type BillingEvent struct {
|
|
ID int64 `json:"id"`
|
|
StripeEventID string `json:"stripe_event_id"`
|
|
EventType string `json:"event_type"`
|
|
OrderID pgtype.Int8 `json:"order_id"`
|
|
Payload []byte `json:"payload"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type Order struct {
|
|
ID int64 `json:"id"`
|
|
AccountID pgtype.Int8 `json:"account_id"`
|
|
Status string `json:"status"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Amount pgtype.Numeric `json:"amount"`
|
|
RenewsAt pgtype.Timestamptz `json:"renews_at"`
|
|
StripeID pgtype.Text `json:"stripe_id"`
|
|
PmType pgtype.Text `json:"pm_type"`
|
|
PmLastFour pgtype.Text `json:"pm_last_four"`
|
|
TrialEndsAt pgtype.Timestamptz `json:"trial_ends_at"`
|
|
PlanID pgtype.Int8 `json:"plan_id"`
|
|
PeriodStartedAt pgtype.Timestamptz `json:"period_started_at"`
|
|
}
|
|
|
|
type Plan struct {
|
|
ID int64 `json:"id"`
|
|
PlanType string `json:"plan_type"`
|
|
Name string `json:"name"`
|
|
PriceAud pgtype.Numeric `json:"price_aud"`
|
|
BillingInterval string `json:"billing_interval"`
|
|
SmsIncluded int32 `json:"sms_included"`
|
|
MaxTags int32 `json:"max_tags"`
|
|
AlertsPerDay int32 `json:"alerts_per_day"`
|
|
AlertsPerHour int32 `json:"alerts_per_hour"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
}
|
|
|
|
type Product struct {
|
|
ID int64 `json:"id"`
|
|
Sku string `json:"sku"`
|
|
Name string `json:"name"`
|
|
ItemType pgtype.Text `json:"item_type"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
PhotoUrl pgtype.Text `json:"photo_url"`
|
|
PriceAud pgtype.Numeric `json:"price_aud"`
|
|
}
|
|
|
|
type Scan struct {
|
|
ID int64 `json:"id"`
|
|
TagID int64 `json:"tag_id"`
|
|
ScannedAt pgtype.Timestamptz `json:"scanned_at"`
|
|
Lat pgtype.Float8 `json:"lat"`
|
|
Lng pgtype.Float8 `json:"lng"`
|
|
LocationShared bool `json:"location_shared"`
|
|
ScannerPhone pgtype.Text `json:"scanner_phone"`
|
|
AlertSent bool `json:"alert_sent"`
|
|
Fingerprint pgtype.Text `json:"fingerprint"`
|
|
Ip pgtype.Text `json:"ip"`
|
|
}
|
|
|
|
type Tag struct {
|
|
ID int64 `json:"id"`
|
|
TagCode string `json:"tag_code"`
|
|
OwnerID pgtype.Int8 `json:"owner_id"`
|
|
Status string `json:"status"`
|
|
ItemType pgtype.Text `json:"item_type"`
|
|
Description pgtype.Text `json:"description"`
|
|
PhotoUrl pgtype.Text `json:"photo_url"`
|
|
Phone pgtype.Text `json:"phone"`
|
|
Address pgtype.Text `json:"address"`
|
|
Notes pgtype.Text `json:"notes"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
SmsEnabled bool `json:"sms_enabled"`
|
|
ProductID pgtype.Int8 `json:"product_id"`
|
|
OrderID pgtype.Int8 `json:"order_id"`
|
|
SmsAllocated int32 `json:"sms_allocated"`
|
|
SmsUsed int32 `json:"sms_used"`
|
|
SmsPeriodStart pgtype.Date `json:"sms_period_start"`
|
|
}
|
|
|
|
type UrlShortened struct {
|
|
Code string `json:"code"`
|
|
ScanID int64 `json:"scan_id"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
}
|
|
|
|
type User struct {
|
|
ID int64 `json:"id"`
|
|
Email string `json:"email"`
|
|
PasswordHash string `json:"password_hash"`
|
|
Name pgtype.Text `json:"name"`
|
|
Phone pgtype.Text `json:"phone"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
IsAdmin bool `json:"is_admin"`
|
|
RememberToken pgtype.Text `json:"remember_token"`
|
|
Paused bool `json:"paused"`
|
|
StripeID pgtype.Text `json:"stripe_id"`
|
|
SmsCredits int32 `json:"sms_credits"`
|
|
}
|