feat(admin): product catalog editor #231

Merged
developer merged 1 commits from feature/e7-catalog-editor into development 2026-07-10 03:26:27 +00:00
Owner

Second slice of the admin / reports / catalog work (PR1 #230 = the finance panel).

Catalog editor (/_gm/catalog)

The console gains a product editor — the source of truth for the catalog:

  • create / edit a product: title, atom composition (chips / hints / no-ads days / tournament),
    and per-rail prices (RUB via direct, VOTE via vk, XTR via telegram, CHIP for a value);
  • Archive / Unarchive — reuses the existing product.active; archived products are hidden from
    players but still credit an in-flight payment and can be granted (PR3);
  • Delete only a never-transacted product; an order or ledger reference forces archive-only
    (the FK orders/ledger → product RESTRICT is the DB backstop, surfaced as a clean message).

Shape validation on activation (a pure, unit-tested validateProduct): a pack (the chips
atom ⇒ a money price per rail, chips-only) or a value (no chips ⇒ a single CHIP price); a
tournament-bearing product is composable (a draft/template) but never sellable until the
tournament stage. An archived draft may be incomplete.

Backend

payments.AdminCatalog / CreateProduct / UpdateProduct / SetProductActive / DeleteProduct +
the store CRUD (one tx for create/update). No wire/edge changes — server-rendered console only.

Tests

  • TestValidateProduct — pack / value / tournament / duplicate / bad-shape (15 cases).
  • TestConsoleCatalogEditor — CSRF-guarded create; create + edit a value; refuse an invalid active
    pack; archive hides it; delete a clean product; refuse deleting a transacted one.
  • Full backend unit + integration green; build/vet/gofmt clean.
Second slice of the admin / reports / catalog work (PR1 #230 = the finance panel). ## Catalog editor (`/_gm/catalog`) The console gains a product editor — the **source of truth** for the catalog: - **create / edit** a product: title, atom composition (chips / hints / no-ads days / tournament), and per-rail prices (RUB via direct, VOTE via vk, XTR via telegram, CHIP for a value); - **Archive / Unarchive** — reuses the existing `product.active`; archived products are hidden from players but still credit an in-flight payment and can be granted (PR3); - **Delete** only a **never-transacted** product; an order or ledger reference forces archive-only (the FK `orders/ledger → product` RESTRICT is the DB backstop, surfaced as a clean message). **Shape validation on activation** (a pure, unit-tested `validateProduct`): a **pack** (the `chips` atom ⇒ a money price per rail, chips-only) or a **value** (no chips ⇒ a single CHIP price); a `tournament`-bearing product is composable (a draft/template) but never sellable until the tournament stage. An archived draft may be incomplete. ## Backend `payments.AdminCatalog / CreateProduct / UpdateProduct / SetProductActive / DeleteProduct` + the store CRUD (one tx for create/update). No wire/edge changes — server-rendered console only. ## Tests - `TestValidateProduct` — pack / value / tournament / duplicate / bad-shape (15 cases). - `TestConsoleCatalogEditor` — CSRF-guarded create; create + edit a value; refuse an invalid active pack; archive hides it; delete a clean product; refuse deleting a transacted one. - Full backend unit + integration green; build/vet/gofmt clean.
developer added 1 commit 2026-07-10 03:19:10 +00:00
feat(admin): product catalog editor
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 24s
CI / ui (pull_request) Has been skipped
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m53s
0036b55618
The /_gm console gains a Catalog editor — the source of truth for products.
Create / edit / archive-unarchive products, their atom composition and per-rail
prices (RUB via direct / VOTE via vk / XTR via telegram / CHIP value), and
hard-delete only a never-transacted product (an order or ledger reference forces
archive-only, backed by the FK RESTRICT). The archived flag reuses the existing
product.active. Activation revalidates the sellable shape — a pack (the chips
atom ⇒ a money price per rail, chips-only) or a value (no chips ⇒ a CHIP price);
a tournament-bearing product is composable but never sellable yet.

Backed by payments AdminCatalog / CreateProduct / UpdateProduct /
SetProductActive / DeleteProduct + a pure validateProduct.

Tests: validateProduct (pack / value / tournament / duplicate / shape); the
console editor end to end (create, edit, archive, delete-if-clean, refuse a
transacted delete).
owner approved these changes 2026-07-10 03:26:17 +00:00
developer merged commit c3eecf16b3 into development 2026-07-10 03:26:27 +00:00
developer deleted branch feature/e7-catalog-editor 2026-07-10 03:26:27 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: developer/scrabble-game#231