Documentation
¶
Overview ¶
Package catalog is the HTTP surface for the platform product catalog — the CMS source-of-truth for a brand's OWN products (Models, Vector, KMS, …) that docs.<brand>, the console sidebar, and pricing derive from.
Two audiences, two auth models:
- PUBLIC read: GET /catalog returns the brand-scoped projection with no auth (it is public presentation + pricing data). Wired on the commerce public group so it serves the exact path GET /v1/commerce/catalog.
- PLATFORM-ADMIN write: create/update/delete/seed mutate the platform-global catalog (the "system" namespace, NOT a per-tenant org), so they gate on auth.IAMClaims.IsSuperAdmin() — a Hanzo platform admin, never an org-level admin. Wired on the /v1 bundle under /catalog/entries.
The catalog is platform-global: one store in the "system" namespace, scoped per requesting brand BY CATEGORY at projection time (matching @hanzo/products catalogForBrand). Entries are keyed by their globally-unique slug.
Index ¶
- Constants
- func AdminCatalog(c *zip.Ctx) error
- func AdminCatalogRoute(r zip.Router)
- func AdminRoute(r zip.Router, args ...zip.Handler)
- func CreateEntry(c *zip.Ctx) error
- func DeleteEntry(c *zip.Ctx) error
- func ListEntries(c *zip.Ctx) error
- func Public(c *zip.Ctx) error
- func PublicRoute(r zip.Router)
- func SeedCatalog(c *zip.Ctx) error
- func UpdateEntry(c *zip.Ctx) error
Constants ¶
const CatalogNamespace = "system"
CatalogNamespace is the platform-global namespace the catalog lives in — not a per-tenant org. Brand partitioning is by the entry's Brand field.
Variables ¶
This section is empty.
Functions ¶
func AdminCatalog ¶ added in v1.49.7
AdminCatalog returns the brand-scoped catalog projection WITH the administrative economics (costCents + marginPct) the public projection withholds — the margin surface admin.hanzo.ai administrates. owner=="admin" only (IsSuperAdmin); an org-level admin is refused 403, so upstream cost and margin never leak to a tenant. Brand from ?brand (default hanzo).
func AdminCatalogRoute ¶ added in v1.49.7
AdminCatalogRoute wires the owner=="admin" margin projection. Mount on an IAM-gated commerce group so it serves GET /v1/commerce/admin/catalog; the handler ALSO enforces IsSuperAdmin() (defense in depth).
func AdminRoute ¶
AdminRoute wires the platform-admin catalog CRUD + seed on the /v1 bundle.
func CreateEntry ¶
CreateEntry adds a catalog entry (platform admin).
func DeleteEntry ¶
DeleteEntry removes a catalog entry by slug (platform admin).
func ListEntries ¶
ListEntries returns the raw catalog entries (admin view — includes unpublished). Optional ?brand filter.
func Public ¶
Public returns the brand-scoped catalog projection. Public + cacheable. Brand from ?brand (default hanzo).
func PublicRoute ¶
PublicRoute wires the public, unauthenticated catalog projection. Mount on the commerce public group so it serves GET /v1/commerce/catalog.
func SeedCatalog ¶
SeedCatalog upserts the embedded Hanzo catalog seed (idempotent, non-destructive — never overwrites CMS edits). Platform admin only.
func UpdateEntry ¶
UpdateEntry edits a catalog entry by slug (platform admin). The slug identity is preserved; other fields are replaced from the body.
Types ¶
This section is empty.