catalog

package
v1.49.17 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 8 Imported by: 0

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

View Source
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

func AdminCatalog(c *zip.Ctx) error

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

func AdminCatalogRoute(r zip.Router)

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

func AdminRoute(r zip.Router, args ...zip.Handler)

AdminRoute wires the platform-admin catalog CRUD + seed on the /v1 bundle.

func CreateEntry

func CreateEntry(c *zip.Ctx) error

CreateEntry adds a catalog entry (platform admin).

func DeleteEntry

func DeleteEntry(c *zip.Ctx) error

DeleteEntry removes a catalog entry by slug (platform admin).

func ListEntries

func ListEntries(c *zip.Ctx) error

ListEntries returns the raw catalog entries (admin view — includes unpublished). Optional ?brand filter.

func Public

func Public(c *zip.Ctx) error

Public returns the brand-scoped catalog projection. Public + cacheable. Brand from ?brand (default hanzo).

func PublicRoute

func PublicRoute(r zip.Router)

PublicRoute wires the public, unauthenticated catalog projection. Mount on the commerce public group so it serves GET /v1/commerce/catalog.

func SeedCatalog

func SeedCatalog(c *zip.Ctx) error

SeedCatalog upserts the embedded Hanzo catalog seed (idempotent, non-destructive — never overwrites CMS edits). Platform admin only.

func UpdateEntry

func UpdateEntry(c *zip.Ctx) error

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.

Jump to

Keyboard shortcuts

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