Add operator write endpoints for the pricing catalog

CatalogController gains platform-admin-gated writes: create a plan,
create a draft version (with its plan items, transactionally), publish
a version, create an addon — plus a plan-detail endpoint exposing every
version. Pricing stays versioned: create_version always makes a new
draft, publish retires the prior active version, existing subscriptions
are untouched. The Catalog context functions already existed; this just
exposes them over HTTP.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-21 12:21:29 +10:00
parent e1f0aedcf7
commit 34fd811e91
3 changed files with 218 additions and 37 deletions

View File

@@ -27,7 +27,12 @@ defmodule ArcadiaCloudWeb.Router do
post "/drift/:id/accept", DriftController, :accept
get "/catalog/plans", CatalogController, :plans
get "/catalog/plans/:id", CatalogController, :show
post "/catalog/plans", CatalogController, :create_plan
post "/catalog/plans/:plan_id/versions", CatalogController, :create_version
post "/catalog/versions/:id/publish", CatalogController, :publish_version
get "/catalog/addons", CatalogController, :addons
post "/catalog/addons", CatalogController, :create_addon
post "/quote", QuoteController, :create