subscriptions

package
v1.801.256 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package subscriptions is the fleet SUBSCRIPTION view (/v1/admin/subscriptions) — every tenant's plan subscription: customer/org, plan, status, monthly-normalized MRR, and the current-period start/renews. SuperAdmin only (core.Guard).

It reads the ONE shared warehouse (commerce.events) — the table the commerce analytics collector lands every subscription-lifecycle event in — over the SAME client (datastore.Query) the o11y/compute lenses use, with ZERO per-org fan-out: one GROUP BY resolves each subscription's LATEST lifecycle state (argMax by timestamp), so the whole fleet is one query, not N per-org commerce reads. Honest by construction: no datastore connected or the collector's table not provisioned yet → the real empty list, never a fabricated tenant. The MRR is the monthly-normalized figure the emitter already computed (cents). Optional ?org= scopes to one tenant, ?status= filters the LATEST status, ?limit= caps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Routes

func Routes(app cloud.Router, s *cloud.Service[core.State])

Routes registers the fleet subscription view (SuperAdmin only, cross-tenant).

func Subscriptions

func Subscriptions(s *cloud.Service[core.State], c *zip.Ctx) error

Subscriptions answers GET /v1/admin/subscriptions.

GET /v1/admin/subscriptions?org=&status=&limit=

Types

type SubscriptionRow

type SubscriptionRow struct {
	ID       string `json:"id"`
	Org      string `json:"org"`
	Display  string `json:"display"`
	User     string `json:"user"`
	Plan     string `json:"plan"`
	Status   string `json:"status"`
	MRRCents int64  `json:"mrrCents"`
	Started  string `json:"started"`
	Renews   string `json:"renews"`
}

SubscriptionRow is one row of GET /v1/admin/subscriptions — a tenant's subscription at a glance, tagged with its owning org. MRR is USD cents; timestamps are RFC3339 strings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL