Introduce DB migrations for ladder and pool-attachment tables and an audit log for provision transitions. Make product_type nullable and add lifecycle_status plus a product_kinds view. Implement Transition and ReapplyDefaultsForPool primitives, SQLC queries/models, webhook and Temporal workflow integration, and accompanying unit/integration tests.
166 lines
6.4 KiB
Go
166 lines
6.4 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.29.0
|
|
|
|
package billing
|
|
|
|
import (
|
|
"database/sql"
|
|
"encoding/json"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/sqlc-dev/pqtype"
|
|
)
|
|
|
|
type Account struct {
|
|
BillingAccountID string `json:"billing_account_id"`
|
|
OrgID string `json:"org_id"`
|
|
Name string `json:"name"`
|
|
Status string `json:"status"`
|
|
Metadata json.RawMessage `json:"metadata"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type Invoice struct {
|
|
InvoiceID string `json:"invoice_id"`
|
|
BillingAccountID string `json:"billing_account_id"`
|
|
SubscriptionID uuid.NullUUID `json:"subscription_id"`
|
|
Status string `json:"status"`
|
|
AmountDue int32 `json:"amount_due"`
|
|
AmountPaid int32 `json:"amount_paid"`
|
|
Currency string `json:"currency"`
|
|
PeriodStart sql.NullTime `json:"period_start"`
|
|
PeriodEnd sql.NullTime `json:"period_end"`
|
|
DueDate sql.NullTime `json:"due_date"`
|
|
PaidAt sql.NullTime `json:"paid_at"`
|
|
VoidedAt sql.NullTime `json:"voided_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type InvoiceLineItem struct {
|
|
LineItemID string `json:"line_item_id"`
|
|
InvoiceID string `json:"invoice_id"`
|
|
SubscriptionItemID uuid.NullUUID `json:"subscription_item_id"`
|
|
PriceID string `json:"price_id"`
|
|
Amount int32 `json:"amount"`
|
|
Currency string `json:"currency"`
|
|
Description sql.NullString `json:"description"`
|
|
Quantity int32 `json:"quantity"`
|
|
PeriodStart sql.NullTime `json:"period_start"`
|
|
PeriodEnd sql.NullTime `json:"period_end"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type Payment struct {
|
|
PaymentID string `json:"payment_id"`
|
|
InvoiceID string `json:"invoice_id"`
|
|
BillingAccountID string `json:"billing_account_id"`
|
|
PaymentMethodID uuid.NullUUID `json:"payment_method_id"`
|
|
Amount int32 `json:"amount"`
|
|
Currency string `json:"currency"`
|
|
Status string `json:"status"`
|
|
FailedAt sql.NullTime `json:"failed_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type PaymentMethod struct {
|
|
PaymentMethodID string `json:"payment_method_id"`
|
|
BillingAccountID string `json:"billing_account_id"`
|
|
PmType string `json:"pm_type"`
|
|
CardBrand sql.NullString `json:"card_brand"`
|
|
CardLast4 sql.NullString `json:"card_last4"`
|
|
CardExpMonth sql.NullInt32 `json:"card_exp_month"`
|
|
CardExpYear sql.NullInt32 `json:"card_exp_year"`
|
|
Funding sql.NullString `json:"funding"`
|
|
IsDefault bool `json:"is_default"`
|
|
DetachedAt sql.NullTime `json:"detached_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type PlanLadder struct {
|
|
PlanLadderID string `json:"plan_ladder_id"`
|
|
LadderKey string `json:"ladder_key"`
|
|
Name string `json:"name"`
|
|
Description sql.NullString `json:"description"`
|
|
IsActive bool `json:"is_active"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type PlanLadderTier struct {
|
|
PlanLadderID string `json:"plan_ladder_id"`
|
|
ProductID string `json:"product_id"`
|
|
Rank int32 `json:"rank"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type Price struct {
|
|
PriceID string `json:"price_id"`
|
|
ProductID string `json:"product_id"`
|
|
Currency string `json:"currency"`
|
|
UnitAmount int32 `json:"unit_amount"`
|
|
RecurringInterval sql.NullString `json:"recurring_interval"`
|
|
TrialPeriodDays sql.NullInt32 `json:"trial_period_days"`
|
|
IsActive bool `json:"is_active"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type Product struct {
|
|
ProductID string `json:"product_id"`
|
|
Name string `json:"name"`
|
|
Description sql.NullString `json:"description"`
|
|
ProductType sql.NullString `json:"product_type"`
|
|
Metadata pqtype.NullRawMessage `json:"metadata"`
|
|
IsActive bool `json:"is_active"`
|
|
IsPublic bool `json:"is_public"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
EntitlementSetID uuid.NullUUID `json:"entitlement_set_id"`
|
|
LifecycleStatus string `json:"lifecycle_status"`
|
|
}
|
|
|
|
type ProductKind struct {
|
|
ProductID string `json:"product_id"`
|
|
ProductKind sql.NullString `json:"product_kind"`
|
|
}
|
|
|
|
type Subscription struct {
|
|
SubscriptionID string `json:"subscription_id"`
|
|
BillingAccountID string `json:"billing_account_id"`
|
|
Status string `json:"status"`
|
|
CurrentPeriodStart sql.NullTime `json:"current_period_start"`
|
|
CurrentPeriodEnd sql.NullTime `json:"current_period_end"`
|
|
CancelAtPeriodEnd bool `json:"cancel_at_period_end"`
|
|
CanceledAt sql.NullTime `json:"canceled_at"`
|
|
EndedAt sql.NullTime `json:"ended_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type SubscriptionChange struct {
|
|
ChangeID string `json:"change_id"`
|
|
SubscriptionID string `json:"subscription_id"`
|
|
PreviousStatus sql.NullString `json:"previous_status"`
|
|
NewStatus string `json:"new_status"`
|
|
StripeEventID string `json:"stripe_event_id"`
|
|
ChangedAt time.Time `json:"changed_at"`
|
|
}
|
|
|
|
type SubscriptionItem struct {
|
|
SubscriptionItemID string `json:"subscription_item_id"`
|
|
SubscriptionID string `json:"subscription_id"`
|
|
ProductID string `json:"product_id"`
|
|
PriceID string `json:"price_id"`
|
|
Quantity int32 `json:"quantity"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|