docs: v3.1 gap analysis + delivery plan; add DI seams to 9 admin gateways
Adds InjectionToken + factory for Orders, Products, Users, Transactions, Monitoring, Moderation (mirrors existing Categories/Dashboard pattern) and repoints their facades plus the derived Analytics/Customers facades and admin-order-watcher off the mock LocalGateway class directly. No behavior change today - still resolves to the mock - but a real backend can now be bound per domain with zero facade edits. Docs: full gap analysis of Product Plan v3.1 against current repo state, and a phased delivery plan (10 phases, 34 sprints, 5 tracks) breaking every identified gap into scoped, sequenced work. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
461
docs/PRODUCT-PLAN-v3.1-DELIVERY-PLAN.md
Normal file
461
docs/PRODUCT-PLAN-v3.1-DELIVERY-PLAN.md
Normal file
@@ -0,0 +1,461 @@
|
|||||||
|
# Product Plan v3.1 — Delivery Plan (Phases → Sprints → Todos)
|
||||||
|
|
||||||
|
Companion to [PRODUCT-PLAN-v3.1-GAP-ANALYSIS.md](PRODUCT-PLAN-v3.1-GAP-ANALYSIS.md). Every gap identified there is assigned here exactly once.
|
||||||
|
|
||||||
|
**No calendar dates.** The plan itself (§12) refuses invented dates and fixes *sequence + exit criteria* instead. This document does the same. Sprints are ordered units of work, not two-week promises. Sizes are relative: **S** / **M** / **L** / **XL**.
|
||||||
|
|
||||||
|
**Ownership tags:** `[FE]` this repo · `[BE]` backend/platform service · `[BOTH]` coordinated contract change · `[DEC]` decision, no code.
|
||||||
|
|
||||||
|
**Deviation from the plan's own order, and why:** the plan sequences P0-C (external ingestion) before P0-D (catalog integrity). We swap them. External order ingestion maps `externalSKU → internal offer` (§5.1), and `Offer` does not exist yet — ingestion has nothing to map onto until the Product/Offer split ships. Everything else follows the plan's ordering.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase map
|
||||||
|
|
||||||
|
| Phase | Name | Plan ref | Gate |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **0** | Unblock & seams | — | Decisions answered; every admin domain swappable |
|
||||||
|
| **1** | Money & payment truth | P0-A, §2.3 §3.3 §3.8 §7 | An order total is explainable from data |
|
||||||
|
| **2** | Orders canonical + notifications | P0-B, §2.8 §2.10 §3.5 | Paid order appears and notifies without refresh |
|
||||||
|
| **3** | Catalog integrity + fulfillment | P0-D, §2.1 §2.4 §3.6 | Any published offer is genuinely buyable and fulfillable |
|
||||||
|
| **4** | External order ingestion | P0-C, §5 §3.7 | External purchase lands in Orders, no duplicates |
|
||||||
|
| **🚦** | **PRODUCTION LAUNCH GATE** | §3 LAUNCH BLOCKERS, §13.2 | All P0 closed and evidenced |
|
||||||
|
| **5** | Seller Portal | P1-A, §2.2 | Seller runs own offers and orders in scoped UI |
|
||||||
|
| **6** | Server cart + checkout session | P1-B, §2.5 §2.6 | Client price never trusted; repeat-safe |
|
||||||
|
| **7** | Payments hardening + reconciliation | P1-C, §2.7 §7.3 | Internal vs provider matched, mismatches visible |
|
||||||
|
| **8** | Identity & messaging | §2.9 §3.4 §14 | VK/MAX/Telegram linked; bot collects delivery |
|
||||||
|
| **9** | Tenant registry, domains, releases | P2-A, §4.3 §8 | New marketplace launched with no hardcode |
|
||||||
|
| **10** | Tenant content modules (Gorbushka) | P2-B, §11 | Content tenant on same runtime/backoffice |
|
||||||
|
|
||||||
|
**Parallel tracks** (start early, run across phases): **A** Analytics pipeline · **S** Security/RBAC/audit · **Q** QA & E2E · **N** API namespace migration · **Z** Pre-existing repo debt.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 0 — Unblock & seams
|
||||||
|
|
||||||
|
Nothing downstream can be honestly estimated until this closes. Two sprints: one is other people answering questions, one is work we can do today with no answers.
|
||||||
|
|
||||||
|
### Sprint 0.1 — Decisions `[DEC]`
|
||||||
|
|
||||||
|
Blocking. Escalate as a single list, not one at a time.
|
||||||
|
|
||||||
|
- [ ] **Backend ownership.** Platform API, Workers, Integration Hub, Domain Automation — our team or a service team? Everything `[BE]` below is unassigned until answered.
|
||||||
|
- [ ] **Unfreeze the payment chain.** `BACKEND-API-REFERENCE.md §7` marks it do-not-modify. Phases 1, 6 and 7 are unbuildable otherwise.
|
||||||
|
- [ ] **Name the external marketplaces** for §5 connectors (Ozon / Wildberries / Yandex Market / Avito / other). Each is a separate connector; Phase 4 cannot be sized without the list.
|
||||||
|
- [ ] **FX rate source** — which provider, and does the backend return converted prices or serve rates? Plan §2.3 implies backend-converted.
|
||||||
|
- [ ] **§14 vs. approved email/phone OTP spec** — VK ID first, or finish OTP first?
|
||||||
|
- [ ] **Multi-seller orders: unified or split?** Open in three of our own documents. Blocks Phase 3 and Phase 5 data model.
|
||||||
|
- [ ] **Reproduce or retract the "fixed 5-second payment" claim (§3.2).** Not present in this codebase.
|
||||||
|
- [ ] **API namespace migration (§9.3)** — migrate before new endpoints, or accept two conventions? Cost rises every phase this is deferred.
|
||||||
|
- [ ] **Document version** — file says v3.1, version block says 3.0. Which is canonical?
|
||||||
|
|
||||||
|
**Exit:** all nine answered in writing.
|
||||||
|
|
||||||
|
### Sprint 0.2 — Seams and type reconciliation `[FE]` — runs regardless of answers
|
||||||
|
|
||||||
|
- [ ] Add DI tokens to the 9 admin domains that have none: Orders, Products, Users, Transactions, Monitoring, Moderation (+ derived Customers, Analytics). **M** — hard prerequisite for every `[BE]` swap in Phases 1–7.
|
||||||
|
- [ ] Reconcile `AdminRole` — defined twice with unrelated shapes (auth string-union vs. Users-page display interface). **S**
|
||||||
|
- [ ] Reconcile the two `Category` types, both fed by the same `/category` response, both in use. **S**
|
||||||
|
- [ ] Resolve `SellerConfig` (bootstrap) vs. `Seller`/`SellerBranding` (domain) — pick one or document the mapping. Blocks Phase 5. **S**
|
||||||
|
- [ ] Build the feature-flag / capability-guard service an existing ADR already promises; migrate the hand-rolled `sellerManagement.enabled` check onto it. **S**
|
||||||
|
- [ ] Build the centralized error-handling layer (`core/error-handling/`, `core/interceptors/` are `.gitkeep`-only today): error-envelope interceptor + 429 handling. **M** `[BOTH]` — envelope shape needs backend agreement.
|
||||||
|
- [ ] Fix `toAuthErrorShape()` to read a body-level code, not HTTP status alone — the built "session expired" / "invalid signature" screens are currently dead UI. **S**
|
||||||
|
- [ ] Bind mock implementations to `PRODUCT_DATA_PROVIDER` and `CATEGORY_REPOSITORY`, or delete the dead mock branch. Today both silently ignore `useMockData`. **S**
|
||||||
|
|
||||||
|
**Exit:** any admin domain can be pointed at a real backend by swapping one provider.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 1 — Money & payment truth (P0-A)
|
||||||
|
|
||||||
|
Closes §3.3 and §3.8, and half of the §13.1 acceptance table. The single highest-value phase: it is what makes totals explainable to a bank.
|
||||||
|
|
||||||
|
### Sprint 1.1 — Money model `[BOTH]`
|
||||||
|
|
||||||
|
- [ ] `Money = { amountMinor: int, currency }` end to end. Kill float arithmetic in `CurrencyRatesService.convert()`. **L**
|
||||||
|
- [ ] Currency minor-units + rounding rules table (RUB/USD/EUR/AMD at minimum). **M**
|
||||||
|
- [ ] Delete browser-owned rates: remove `currencyRates.v1` from `localStorage` and the hardcoded `DEFAULT_RATES` fallbacks (`USD: 0.011`, `AMD: 4.3`). **S**
|
||||||
|
- [ ] Remove the admin-typed rate editor from Admin Settings once a real source exists. **S**
|
||||||
|
|
||||||
|
### Sprint 1.2 — FX quote + rate source `[BE]` + `[FE]`
|
||||||
|
|
||||||
|
- [ ] `FxQuote { base, quote, rate, source, observedAt, expiresAt, quoteId }` entity + endpoint. **M**
|
||||||
|
- [ ] Rate-source adapter behind an interface; concrete provider pluggable (§7.1). **M**
|
||||||
|
- [ ] Stale/outlier quote rules; checkout **blocks** or uses an explicitly configured fallback. **M**
|
||||||
|
- [ ] `PriceBook`: offer base currency + allowed display/checkout currencies per tenant. **M**
|
||||||
|
|
||||||
|
### Sprint 1.3 — Price snapshot + server-authoritative amount `[BOTH]` — needs the freeze lifted
|
||||||
|
|
||||||
|
- [ ] `PriceSnapshot { offerId, amount, currency, fxQuoteId, capturedAt }`, immutable. **L**
|
||||||
|
- [ ] Server computes and validates the charged amount. Stop trusting `CartPaymentRequest.amount` and the per-item `price[]` array from the browser. **L** — the plan's §2.5 headline requirement.
|
||||||
|
- [ ] Old orders never recalculated when a rate updates. **S**
|
||||||
|
- [ ] Backoffice "total formula" panel: lines × qty − discounts + delivery + fees, plus the FX quote used (§7.2). **M**
|
||||||
|
- [ ] `PriceHistory` on offer price and stock, with author/source (§2.1). **M**
|
||||||
|
|
||||||
|
### Sprint 1.4 — Payment timeline `[BE]` + `[FE]`
|
||||||
|
|
||||||
|
- [ ] Explicit state machines: `PaymentIntent` (created→pending→authorized/paid→failed/cancelled), `Payment` (received→confirmed→captured/settled→refunded), `Order` (pending_payment→paid→processing→fulfilled). **L**
|
||||||
|
- [ ] Persist `provider event id`, `provider timestamp`, `receivedAt`, `processedAt` per transition. **M**
|
||||||
|
- [ ] Webhook entrypoint with signature verification + idempotency (§2.7). **L**
|
||||||
|
- [ ] Idempotency keys on checkout, payment and order creation. Zero `idempot*` exists today. **M**
|
||||||
|
- [ ] Replace client-polled status signals with server truth; keep polling only as a UI fallback. **M**
|
||||||
|
- [ ] Keep the current honest behaviour: no artificial delay. Already compliant — protect it with a test. **S**
|
||||||
|
|
||||||
|
**Exit criteria (plan's own):** currency converts correctly; payment timeline reconstructable from provider events; every total explainable from `SKU/qty/delivery/discount/FX`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 2 — Orders canonical + notifications (P0-B)
|
||||||
|
|
||||||
|
### Sprint 2.1 — Canonical order model `[BOTH]`
|
||||||
|
|
||||||
|
- [ ] `Order` header: `marketplaceId, source, customer, currency, subtotal, discounts, delivery, total, paymentStatus, orderStatus`. **L**
|
||||||
|
- [ ] `OrderLine` with `offerId, sellerId, skuSnapshot, titleSnapshot, qty, unitPriceMinor, lineTotalMinor, priceSnapshotId`. **M**
|
||||||
|
- [ ] `OrderEvent` timeline: created, paid, seller notified, accepted, fulfilled, cancelled, refunded (§2.8). Closes our own "Real order audit trail" TODO. **M**
|
||||||
|
- [ ] Real `AdminOrdersApiGateway` replacing the 24-row static seed with no create path. **L** `[BE]`
|
||||||
|
- [ ] Admin order actions: assign, resend notification, replay sync, cancel/refund by permission, comment, export. **M**
|
||||||
|
- [ ] `OrderContactSnapshot` — name/contacts frozen at order time, immune to later profile edits (§2.9). **S**
|
||||||
|
|
||||||
|
### Sprint 2.2 — Event bus + Notification Center `[BE]` + `[FE]`
|
||||||
|
|
||||||
|
- [ ] Platform event bus emitting `order.created`, `order.paid`, `payment.failed`, `webhook.error`, `stock.low`, `oversell`, `refund.requested/completed`, `external_order.imported`. **L**
|
||||||
|
- [ ] `Notification` entity: `unread/read`, `severity`, `marketplaceId`, entity type/id, **deep link**. **M**
|
||||||
|
- [ ] `DeliveryAttempt` log per external channel — a Telegram/email failure must never lose the internal notification (§2.10). **M**
|
||||||
|
- [ ] Backoffice Notifications section: unread queue, incidents, filter by marketplace and event type. Missing entirely from our nav today. **M**
|
||||||
|
- [ ] Repoint `AdminOrderWatcherService` from polling to the event stream. Feature is already built and inert — this is what switches it on. **S**
|
||||||
|
|
||||||
|
**Exit:** a paid order appears in backoffice without manual refresh, with deep link and seller/source.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 3 — Catalog integrity + fulfillment (P0-D)
|
||||||
|
|
||||||
|
Biggest structural change in the whole programme. Everything about multi-seller commerce hangs off it.
|
||||||
|
|
||||||
|
### Sprint 3.1 — Product / Offer split `[BOTH]`
|
||||||
|
|
||||||
|
- [ ] Introduce `Offer/Listing { id, marketplaceId, sellerId, variantId, sellerSku, priceMinor, currency, stockPolicy, status, publishedAt }`. **XL** — does not exist in any form today.
|
||||||
|
- [ ] Move price, stock, currency and status off `Product` onto `Offer`. **L**
|
||||||
|
- [ ] Formalise `Product` / `Variant` / `SKU` / `Category` (with `attributesSchema`, SEO) as content-only. **L**
|
||||||
|
- [ ] Unify the admin mock product domain with the live storefront `Item` domain — two unrelated shapes today. **L**
|
||||||
|
- [ ] Offer lookup in backoffice by internal SKU, seller SKU, product ID or external mapping (§2.1 "готово, когда"). **M**
|
||||||
|
|
||||||
|
### Sprint 3.2 — Lifecycle, import, inventory `[BOTH]`
|
||||||
|
|
||||||
|
- [ ] `draft → moderation → published → paused/archived` for both product and offer; wire the existing mock Moderation module to it. **M**
|
||||||
|
- [ ] Bulk import CSV/API: required-field validation, **error preview before apply**. Nothing exists (current "bulk" is Admin Categories edit actions only). **L**
|
||||||
|
- [ ] `InventoryRecord`: `available` / `reserved` / `sold` counted separately. **L**
|
||||||
|
- [ ] Reservations at checkout or pre-payment per strategy, with TTL. **M**
|
||||||
|
- [ ] Idempotent upsert for seller feed stock updates; repeat webhook must not double-decrement. **M**
|
||||||
|
- [ ] Oversell → dedicated incident queue, never silently hidden (§2.4). **M**
|
||||||
|
|
||||||
|
### Sprint 3.3 — Fulfillment + executability `[BOTH]`
|
||||||
|
|
||||||
|
- [ ] `Fulfillment` entity: manual / warehouse / pickup / digital; `status, assignedTo, issuedAt/shippedAt`, evidence where applicable. One `fulfil*` reference exists in the entire codebase today. **L**
|
||||||
|
- [ ] Publish-time executability validation — an offer that cannot actually be fulfilled cannot be published (§3.6). **M**
|
||||||
|
- [ ] Explicit test proving there is **no** inspector-detection branch anywhere: same production flow for every buyer (§3.6, §10.2, §13.2 last item). **S**
|
||||||
|
- [ ] Multi-seller cart grouping by seller and fulfillment rules — currently undefined behaviour (§2.5). **M** — blocked on the unified-vs-split decision in Sprint 0.1.
|
||||||
|
|
||||||
|
**Exit:** any published, available offer really passes order → fulfillment.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 4 — External order ingestion (P0-C)
|
||||||
|
|
||||||
|
Zero percent built today. Sized per connector; Sprint 4.2 repeats for each marketplace named in Sprint 0.1.
|
||||||
|
|
||||||
|
### Sprint 4.1 — Connector framework `[BE]`
|
||||||
|
|
||||||
|
- [ ] `Connector` + `ConnectorCredentialRef` in secret storage, scoped per marketplace/seller. **M**
|
||||||
|
- [ ] Inbound: webhook where the provider supports it, polling fallback with cursor/since. **L**
|
||||||
|
- [ ] `RawExternalEvent` — persist the raw payload before parsing, for traceability. **S**
|
||||||
|
- [ ] Normalizer: external payload → canonical `ExternalOrderEvent` → internal `Order`. **L**
|
||||||
|
- [ ] `ExternalOrderMapping`: `externalSellerId / externalProductId / externalSKU → internal seller/offer`. **L**
|
||||||
|
- [ ] Idempotency on `source + externalOrderId/eventId`; a repeat must not create a duplicate order. **M**
|
||||||
|
- [ ] Exponential retry, `DeadLetter`, manual replay from backoffice. **M**
|
||||||
|
- [ ] **Unmatched queue** for events with no SKU mapping. **M**
|
||||||
|
- [ ] Status/fulfillment push back to the external marketplace where its API allows (§5.2 step 8). **M**
|
||||||
|
|
||||||
|
### Sprint 4.2 — Per-connector implementation `[BE]` — ×N
|
||||||
|
|
||||||
|
- [ ] One sprint per named marketplace: auth, endpoint mapping, rate limits, sandbox verification. **L each**
|
||||||
|
|
||||||
|
### Sprint 4.3 — Connector observability `[FE]` + `[BE]`
|
||||||
|
|
||||||
|
- [ ] Backoffice **Integrations** section (missing from our nav): connectors, payment providers, FX sources, messaging. **M**
|
||||||
|
- [ ] Per-connector health: last success, lag, errors, rate limit, backlog, unmatched mapping. **M**
|
||||||
|
- [ ] Trace id on every connector error, visible in backoffice (§5.2 SLA). **S**
|
||||||
|
- [ ] SLA instrumentation: webhook 99% under 60s; polling ≤ interval + 60s; **0** duplicate orders. **M**
|
||||||
|
|
||||||
|
**Exit:** an external purchase creates/updates an order automatically, never duplicates, and notifies the responsible manager.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚦 PRODUCTION LAUNCH GATE
|
||||||
|
|
||||||
|
Per §3 "LAUNCH BLOCKERS" and the §13.2 checklist. Do not schedule a launch before every line is green **and evidenced by a test, not an assertion**.
|
||||||
|
|
||||||
|
- [ ] All P0 closed and confirmed by tests
|
||||||
|
- [ ] Production analytics collecting real events (Track A)
|
||||||
|
- [ ] Catalog contains only genuinely available/publishable offers
|
||||||
|
- [ ] Seller permissions verified (Phase 5 or enforced-empty)
|
||||||
|
- [ ] cart → checkout → payment → order end-to-end smoke passed
|
||||||
|
- [ ] Webhook signatures, idempotency, retry verified
|
||||||
|
- [ ] External connector reconciliation passed
|
||||||
|
- [ ] FX source live, stale-quote policy verified
|
||||||
|
- [ ] Notification delivery + fallback verified
|
||||||
|
- [ ] Refund flow + reconciliation smoke passed
|
||||||
|
- [ ] Domains/SSL/health checks green (Phase 9)
|
||||||
|
- [ ] Backup/rollback exists
|
||||||
|
- [ ] Audit enabled (Track S)
|
||||||
|
- [ ] **No branch anywhere alters commerce flow based on who the buyer appears to be**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 5 — Seller Portal (P1-A)
|
||||||
|
|
||||||
|
A placeholder page with a `false` flag and zero backend bytes today. Note: the enabled code path has **never been exercised even once** — every prior verification ran with the flag at its real value.
|
||||||
|
|
||||||
|
### Sprint 5.1 — Seller foundation `[BOTH]`
|
||||||
|
- [ ] `SellerOrganization`, `SellerUser`, `SellerMarketplaceMembership`, `SellerIntegration`. **L**
|
||||||
|
- [ ] Onboarding: organisation, credentials/profile, contacts, marketplace applications, moderation status. **L**
|
||||||
|
- [ ] Backoffice **Sellers** section (missing from nav): organisations, applications, roles, status, listings, integration health. **L**
|
||||||
|
|
||||||
|
### Sprint 5.2 — Seller working surfaces `[FE]` + `[BE]`
|
||||||
|
- [ ] Catalog: create/edit products & offers, media, attributes, submit for moderation, bulk import. **L**
|
||||||
|
- [ ] Prices & Stock: mass edit, API/feed sync, change history, sync errors. **L**
|
||||||
|
- [ ] Orders: new, confirm, pick/issue/ship, cancel, return, SLA, comments. **L**
|
||||||
|
- [ ] Finance: accruals, commissions, refunds, settlement/payout register, report export. **L**
|
||||||
|
- [ ] Team: `SELLER_OWNER`, `SELLER_CATALOG_MANAGER`, `SELLER_ORDER_MANAGER`, `SELLER_FINANCE_VIEWER`, `SELLER_VIEWER`. **M**
|
||||||
|
- [ ] Integrations: API credentials, webhook/feed status, external SKU mapping, sync logs. **M**
|
||||||
|
|
||||||
|
### Sprint 5.3 — Seller isolation `[BE]` + `[Q]`
|
||||||
|
- [ ] A seller cannot see another seller's products, orders, customers, finance or API keys — enforced backend-side, tested. **M**
|
||||||
|
- [ ] Bank/payment detail changes: step-up auth + audit event + approval when maker/checker is on. **M**
|
||||||
|
- [ ] Seller staff permissions verified backend-side regardless of UI visibility. **M**
|
||||||
|
- [ ] First-ever fixture test of the seller-management enabled state. **S**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 6 — Server cart + checkout session (P1-B)
|
||||||
|
|
||||||
|
Partly pulled forward into Sprint 1.3 (server-authoritative amount). This phase completes the move.
|
||||||
|
|
||||||
|
### Sprint 6.1 — Server cart `[BOTH]`
|
||||||
|
- [ ] `Cart` / `CartLine` server-side, keyed on `offerId`. Replaces `localStorage` + Telegram CloudStorage. **L**
|
||||||
|
- [ ] Idempotent add/update/remove; quantity validated against stock and seller rules. **M**
|
||||||
|
- [ ] Price-refresh: cart surfaces price changes before checkout and requires explicit confirmation when the total moved. **M**
|
||||||
|
- [ ] Guest cart via session token; authenticated cart bound to customer account. **M**
|
||||||
|
- [ ] Expiration: inactive carts cleared, reservations released on TTL. **S**
|
||||||
|
|
||||||
|
### Sprint 6.2 — Checkout session `[BOTH]`
|
||||||
|
- [ ] `CheckoutSession` entity. `features/website/checkout/` is an empty directory today; checkout lives in a 751-line cart popup. **XL**
|
||||||
|
- [ ] Server re-validates offers and stock at checkout start. **M**
|
||||||
|
- [ ] Contact requirements enforced by tenant policy: email and/or phone verifiable (§2.6 step 4). **M**
|
||||||
|
- [ ] Clear total breakdown shown to the customer. **M**
|
||||||
|
- [ ] `PaymentIntent` via provider adapter; repeat click must not create a second intent. **M**
|
||||||
|
- [ ] Guest-checkout on/off per tenant policy (§6.2). **S**
|
||||||
|
- [ ] `DeliveryOption` entity. **M**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 7 — Payments hardening + reconciliation (P1-C)
|
||||||
|
|
||||||
|
### Sprint 7.1 — Refunds `[BOTH]`
|
||||||
|
- [ ] `Refund` as a first-class operation with reason, actor and order-line linkage. `requestRefund(id)` is a mock method today. **L**
|
||||||
|
- [ ] Partial refunds; `refunded / partially_refunded` states. **M**
|
||||||
|
|
||||||
|
### Sprint 7.2 — Reconciliation `[BE]` + `[FE]`
|
||||||
|
- [ ] `ReconciliationRecord`; match on `providerPaymentId` / merchant reference / amount+currency fallback (§7.3). **L** — zero `reconcil*` in the codebase today.
|
||||||
|
- [ ] Classify: unmatched, duplicate, amount mismatch, status mismatch. **M**
|
||||||
|
- [ ] Backoffice **Payments & Finance** section (missing from nav): payments, refunds, reconciliation queue, unmatched events, settlements. **L**
|
||||||
|
- [ ] Controlled resolution with full audit trail. **M**
|
||||||
|
- [ ] Settlements / payout register. **L** — zero `settlement*` today.
|
||||||
|
|
||||||
|
### Sprint 7.3 — Provider breadth `[DEC]` + `[BOTH]`
|
||||||
|
- [ ] Decide additional providers beyond the current QR/card flow (wallets, BNPL) — open business question. **DEC**
|
||||||
|
- [ ] Provider adapter interface so a new provider is a plug-in, not a rewrite. **M**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 8 — Identity & messaging (§2.9, §3.4, §14)
|
||||||
|
|
||||||
|
Order inside this phase depends on the Sprint 0.1 decision (VK ID first vs. OTP first).
|
||||||
|
|
||||||
|
### Sprint 8.1 — Customer identity core `[BOTH]`
|
||||||
|
- [ ] `Customer`, `ExternalIdentity`, `ContactMethod`, `Verification`, `Consent`. **L**
|
||||||
|
- [ ] Telegram demoted from sole identity to one provider among several. **M**
|
||||||
|
- [ ] `emailVerifiedAt` / `phoneVerifiedAt` / `telegramLinkedAt`. **S**
|
||||||
|
- [ ] Backoffice **Customers** on real data: profiles, verified contacts, orders, consent. **M**
|
||||||
|
- [ ] Sensitive profile changes logged. **S**
|
||||||
|
|
||||||
|
### Sprint 8.2 — Email/phone OTP `[BOTH]`
|
||||||
|
- [ ] Implement the approved [email/phone login spec](superpowers/specs/2026-08-15-email-phone-login-design.md). **L**
|
||||||
|
- [ ] Position it as recovery/fallback per v3.1 §14, not as the primary path. **S**
|
||||||
|
|
||||||
|
### Sprint 8.3 — VK ID `[BOTH]` — new in v3.1
|
||||||
|
- [ ] OAuth 2.1/PKCE completed **backend-side**; link external identity to `Customer`. **L**
|
||||||
|
- [ ] VK ID as the primary storefront social login. **M**
|
||||||
|
- [ ] Repeat login must never create a duplicate customer. **M**
|
||||||
|
- [ ] Identity-conflict handling → controlled resolution, never overwrite an existing binding (§14.3). **M**
|
||||||
|
|
||||||
|
### Sprint 8.4 — MAX + Telegram bot channels `[BOTH]` — new in v3.1
|
||||||
|
- [ ] `ContactChannel`, `BotConversationBinding`, `MessagingConsent`. **L**
|
||||||
|
- [ ] MAX bot-assisted linking: one-time code, TTL, single-use, bound to marketplace + browser session. **L**
|
||||||
|
- [ ] Provider secrets never reach the frontend; all bot updates handled idempotently. **M**
|
||||||
|
- [ ] Bot adapters (VK / MAX / Telegram) normalised into one `MessagingEvent` keyed to `orderId`. **L**
|
||||||
|
|
||||||
|
### Sprint 8.5 — Notification Orchestrator + delivery conversation `[BE]` — new in v3.1
|
||||||
|
- [ ] Orchestrator routes `order.paid` to the customer's chosen channel; the backoffice notification always fires regardless. **L**
|
||||||
|
- [ ] Channel choice in checkout ("where should we send confirmation?"), recorded in `OrderContactSnapshot`; linking flow must not lose the cart or checkout session. **M**
|
||||||
|
- [ ] Delivery Conversation State Machine: `not_started → awaiting_customer → details_received → manager_assigned/auto_confirmed → shipment_planned → completed`. **L**
|
||||||
|
- [ ] Bot collects city/address/recipient/phone/time window/comment; backend validates and snapshots into the order. **L**
|
||||||
|
- [ ] **The bot must never change financial statuses** — delivery fields only, via Delivery Service. **M**
|
||||||
|
- [ ] Follow-up rules per tenant; after N attempts hand off to a manager, no infinite spam. **M**
|
||||||
|
- [ ] Manager handoff view: message history, current conversation state, accept handoff. **M**
|
||||||
|
- [ ] Messenger unavailability creates a `DeliveryAttempt` error and triggers fallback — never blocks the order. **M**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 9 — Tenant registry, domains, releases (P2-A)
|
||||||
|
|
||||||
|
### Sprint 9.1 — Marketplace Registry `[BOTH]`
|
||||||
|
- [ ] `Marketplace`, `MarketplaceDomain`, `MarketplaceFeatureSet`, `MarketplaceRevision`. **L**
|
||||||
|
- [ ] Backoffice **Marketplaces** section (missing from nav): registry, type, status, domains, currencies, feature set, responsible manager. **L**
|
||||||
|
- [ ] Onboarding wizard, all 8 steps of §4.3 (card → feature set → domains → design → roles → integrations → staging + smoke → production launch). **XL**
|
||||||
|
- [ ] Lifecycle state machine `draft → configured → content_ready → domains_planned → staging_live → qa_passed → production_ready → live → paused/archived`, **showing which blocker prevents the next transition**. **L**
|
||||||
|
- [ ] Marketplace dashboard (§4.2): GMV, paid orders, conversion, payment failure rate, orders needing action, seller moderation queue, low stock, unmatched events, integration health, domain/SSL/release status. **L**
|
||||||
|
- [ ] Re-scope the [super-admin Phase 1 design](superpowers/specs/superuser.md) against this — it overlaps registry and audit. **M**
|
||||||
|
- [ ] Consolidate `MarketplaceRef` vs. `TenantConfig` if a third marketplace-shaped type appears. **S**
|
||||||
|
|
||||||
|
### Sprint 9.2 — Domain automation `[BE]`
|
||||||
|
- [ ] Hostinger DNS integration, all 7 endpoints from §8.2. Zero references exist today. **L**
|
||||||
|
- [ ] Read current zone → snapshot/rollback payload → build and validate plan → apply only after production approval. **L**
|
||||||
|
- [ ] **Never touch MX/SPF/DKIM/DMARC/CAA** without a separate task. **S**
|
||||||
|
- [ ] Propagation, SSL and health verification; mark domain active only after checks pass. **M**
|
||||||
|
- [ ] Backoffice **Domains & Releases** section (missing from nav). **M**
|
||||||
|
|
||||||
|
### Sprint 9.3 — Publish model `[BOTH]`
|
||||||
|
- [ ] `draft → validation → preview → publish` with immutable published revisions; rollback creates a new revision (§8.3). **L**
|
||||||
|
- [ ] Real builder persistence — today `apiEndpoints.builder` is an empty placeholder and "publish" only promotes a `localStorage` signal. **L**
|
||||||
|
- [ ] CMS/static pages get a real backend write path (currently in-memory bootstrap only). **L**
|
||||||
|
- [ ] Enforce that orders/payments/inventory ledger are **not** part of a content revision and never roll back with the storefront. **S**
|
||||||
|
- [ ] Tenant resolution hardening: verified Host server-side, unknown Host → 404 with **no fallback tenant** (§6.1). **M**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 10 — Tenant content modules (P2-B, Gorbushka)
|
||||||
|
|
||||||
|
Only after Commerce Core is real. The plan is explicit that Gorbushka does not define the architecture.
|
||||||
|
|
||||||
|
### Sprint 10.1 — Directory content entities `[BOTH]`
|
||||||
|
- [ ] `Shop`, `ShopCategory`, `Service`, `Floor`, `SchemePin`, `RentListing`, `News/Promo`, `StaticPage`, `Lead`, `MallSettings`. Only static pages exist today. **XL**
|
||||||
|
- [ ] Every entity carries `marketplaceId`, audit, and publish/preview flow. **M**
|
||||||
|
- [ ] Mall scheme / floors / pins UI. **L**
|
||||||
|
- [ ] Rent listings + lead capture. **M**
|
||||||
|
|
||||||
|
### Sprint 10.2 — Gorbushka tenant config `[FE]`
|
||||||
|
- [ ] Feature set per §11.1: CMS, shops, services, scheme, rent, news, SEO/media/domains **on**; catalog / seller portal / commerce **platform-ready but off**. **M**
|
||||||
|
- [ ] Prove commerce can be switched on later without touching backend or storefront code. **M**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Parallel tracks
|
||||||
|
|
||||||
|
### Track A — Analytics pipeline (P1-D, §3.1 §6.3)
|
||||||
|
|
||||||
|
**Start at Phase 1, not last.** Longest lead time in the programme, and it is a P0 in the plan's own §3. There is no tracking infrastructure at all today — this is not a missing endpoint.
|
||||||
|
|
||||||
|
- [ ] **A1** Server-side event logging spine. **XL** `[BE]`
|
||||||
|
- [ ] **A2** Traffic events: `session_started`, `page_view`, source/utm/referrer, unique users/sessions. **M**
|
||||||
|
- [ ] **A3** Catalog events: `search`, `category_view`, `product_view`, `seller_view`. **M**
|
||||||
|
- [ ] **A4** Commerce events: `add_to_cart`, `cart_view`, `checkout_started`, `payment_started`, `payment_success/failed`, `order_created`. **M**
|
||||||
|
- [ ] **A5** Operations metrics: `order_paid_to_notification` latency, fulfillment time, connector lag, payment webhook lag. **M**
|
||||||
|
- [ ] **A6** Quality metrics: frontend/backend errors, checkout validation failures, FX stale-rate blocks. **M**
|
||||||
|
- [ ] **A7** Real funnel dashboard in backoffice, replacing the mock-composed Analytics facade. **L**
|
||||||
|
- [ ] **A8** **Synthetic traffic technically separated** from production analytics — staging/test only, never presented as real visits (§3.1, §6.3). **M**
|
||||||
|
- [ ] **A9** Real product view counts — the shipped "Views" column always renders `0`. Either bridge to the live storefront `Item.visits` or serve it from the real Products backend. **S**
|
||||||
|
- [ ] **A10** Post-launch monitoring set (§13.3): checkout conversion, payment success/failure, webhook lag, order-notification lag, connector lag, FX quote age, unmatched reconciliation, stuck fulfillment. **L**
|
||||||
|
- [ ] **A11** Trending search terms endpoint — `loadTrending()` is a stub returning `of(null)`. **S**
|
||||||
|
|
||||||
|
### Track S — Security, RBAC, audit (§4.4, §10)
|
||||||
|
|
||||||
|
**Gate on Phase 5 and on the launch gate.** Today the role model is decorative: types exist, nothing gates any button, page or action. Anyone who authenticates has full access.
|
||||||
|
|
||||||
|
- [ ] **S1** Enforce RBAC backend-side with tenant scope on every request. **L**
|
||||||
|
- [ ] **S2** Implement the 17 roles across 3 scopes (5 platform / 7 marketplace / 5 seller). **L**
|
||||||
|
- [ ] **S3** Frontend permission guards on routes and actions — currently zero. **M**
|
||||||
|
- [ ] **S4** Audit log covering permissions, seller changes, catalog moderation, price, payment/refund, manual order actions, integrations, production launch. `audit` appears only as mock display fields today. **L**
|
||||||
|
- [ ] **S5** Backoffice **Audit & Security** section (missing from nav): role changes, sensitive actions, login/security events, exports. **M**
|
||||||
|
- [ ] **S6** Step-up authentication for sensitive financial actions. **M**
|
||||||
|
- [ ] **S7** Rate limits and abuse controls on storefront/auth/provider endpoints; client-side 429 handling (zero today). **M**
|
||||||
|
- [ ] **S8** Secret storage for provider/connector credentials, scoped per marketplace/seller. **M**
|
||||||
|
- [ ] **S9** PII minimisation: store only necessary customer data, restrict access and export. **M**
|
||||||
|
- [ ] **S10** Ed25519 admin auth backend — wired client-side, 404s today. Decide: build it, or drop it for the plan's conventional RBAC. **DEC** + **L**
|
||||||
|
- [ ] **S11** HttpOnly session cookie (existing frontend-blocked TODO). **M**
|
||||||
|
|
||||||
|
### Track Q — QA & E2E (§13)
|
||||||
|
|
||||||
|
The plan's entire Definition of Done is end-to-end. We have **zero** E2E tests and ~32% statement / ~19% branch coverage across 11 spec files.
|
||||||
|
|
||||||
|
- [ ] **Q1** Stand up an E2E harness (Playwright or equivalent) — none exists. **L**
|
||||||
|
- [ ] **Q2** Solve automated admin login; several past "verified live" claims were code-inspection only because `/edit` and `/backoffice` need Telegram login. **M**
|
||||||
|
- [ ] **Q3** E2E: full §13.1 acceptance path — seller → catalog → storefront → cart → checkout → payment → order → notification → fulfillment. **XL**
|
||||||
|
- [ ] **Q4** E2E: currency switch recalculates by FX quote — explicitly, `160 RUB` must not become `160 USD/AMD`. **M**
|
||||||
|
- [ ] **Q5** E2E: repeat webhook and double-click create exactly one order. **M**
|
||||||
|
- [ ] **Q6** E2E: external marketplace purchase imports and notifies. **M**
|
||||||
|
- [ ] **Q7** Facade tests for cart/checkout, moderation, Orders, Products, Users, Transactions, Monitoring — the domains about to get real backends carry the most regression risk with the least coverage. **L**
|
||||||
|
- [ ] **Q8** Regression pattern for reactive flag/config reads that must track `bootstrapRevision()` — this bug class already bit us once and was invisible until specifically hunted. **S**
|
||||||
|
- [ ] **Q9** Set a justified coverage floor and a CI gate. Deliberately unset today. **M**
|
||||||
|
- [ ] **Q10** One real screen-reader pass (NVDA/VoiceOver). Never performed on this codebase — every accessibility claim to date is automated tree inspection only. **M**
|
||||||
|
|
||||||
|
### Track N — API namespace migration (§9.3)
|
||||||
|
|
||||||
|
Cheapest now, more expensive every phase. Decision in Sprint 0.1.
|
||||||
|
|
||||||
|
- [ ] **N1** Adopt `/api/v2/storefront/*`, `/api/admin/v2/*`, `/api/seller/v1/*`, `/api/identity/v1/*`, `/api/providers/v1/*`, `/api/integrations/v1/*`. **L** `[BOTH]`
|
||||||
|
- [ ] **N2** Migrate today's flat unversioned endpoints (`/cart`, `/orders`, `/items`, `/category`, `/searchitems`) plus the separate `qrApiUrl` host. **L**
|
||||||
|
- [ ] **N3** Agree the structured error envelope; today no interceptor reads error bodies at all. **M** (implementation lands in Sprint 0.2)
|
||||||
|
|
||||||
|
### Track Z — Pre-existing repo debt
|
||||||
|
|
||||||
|
Not in the plan, but real. Fold into whichever phase touches the same surface.
|
||||||
|
|
||||||
|
- [ ] **Z1** Dark-mode selector does nothing — nothing reads `data-theme-mode`. **S**
|
||||||
|
- [ ] **Z2** "Site Layout" selector has no effect — `layout.type` is edited but never read. **S**
|
||||||
|
- [ ] **Z3** Footer "Contacts" link has no content behind it. **S**
|
||||||
|
- [ ] **Z4** `SeoService.setItemMeta()` exists but is **never called** — product pages ship only site-wide meta. **S**
|
||||||
|
- [ ] **Z5** `og:locale` hardcoded to `ru_RU` regardless of active locale. **S**
|
||||||
|
- [ ] **Z6** No JSON-LD structured data, no sitemap generation. **M**
|
||||||
|
- [ ] **Z7** Hardcoded Russian payment-description fallback (`'Покупка на Маркетплейсе'`) in a multi-tenant product. **S**
|
||||||
|
- [ ] **Z8** Brand colours fail WCAG AA — `--border-color` at 1.24–1.42:1 against a 3:1 requirement; status colours fail 4.5:1 as text. **Needs theme-owner sign-off, not just a code fix.** **M**
|
||||||
|
- [ ] **Z9** Literal hex `#cdd6d5` in `stars.component.scss:10` with no token behind it. **S**
|
||||||
|
- [ ] **Z10** Two large lazy chunks unaddressed: `project-editor` (~1.0 MB), `catalog-container` (~330–375 kB). Profile under real backend latency, not instant mock responses. **M**
|
||||||
|
- [ ] **Z11** `navigation.header` is editable in the builder with zero runtime consumer — needs a product decision, not a wiring fix. **DEC**
|
||||||
|
- [ ] **Z12** `catalog.navigationMode` renders a deliberate placeholder; the mega-menu / carousel / left-nav variants it implies do not exist. **DEC**
|
||||||
|
- [ ] **Z13** `sellerId` typed as bare `string` instead of the `UUID` alias used elsewhere. **S**
|
||||||
|
- [ ] **Z14** No shared breadcrumb component; the only breadcrumb logic is a local signal in the catalog container. **S**
|
||||||
|
- [ ] **Z15** Duplicate search models under two module paths. **S**
|
||||||
|
- [ ] **Z16** Consolidate the eight cross-linked Seller Management documents — at least three independently restate the same undecided unified-vs-split orders question. Do this **before** Phase 5 starts. **M**
|
||||||
|
- [ ] **Z17** Angular 22 upgrade — researched, not started; needs a dependency fix and a Node bump. **Its own dedicated session, never bundled with feature work.** **M**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Critical path
|
||||||
|
|
||||||
|
```
|
||||||
|
Sprint 0.1 (decisions)
|
||||||
|
└─> Sprint 0.2 (seams)
|
||||||
|
└─> Phase 1 (money truth) ──────────────┐
|
||||||
|
└─> Phase 2 (orders + notif) │
|
||||||
|
└─> Phase 3 (offer split) │
|
||||||
|
└─> Phase 4 (external ingestion)
|
||||||
|
└─> 🚦 LAUNCH GATE
|
||||||
|
Track A (analytics) ── starts at Phase 1, gates the launch ──┘
|
||||||
|
Track S (RBAC/audit) ── starts at Phase 2, gates the launch ──┘
|
||||||
|
Track Q (E2E) ── starts at Phase 1, evidences the gate ┘
|
||||||
|
```
|
||||||
|
|
||||||
|
Phases 5–10 all sit behind the launch gate and can be resequenced by business priority. Phases 1–4 cannot.
|
||||||
|
|
||||||
|
**Single hardest dependency:** Phase 1 Sprint 1.3 needs the payment chain unfrozen. If that answer is "no", the programme stops at Sprint 0.2 and the plan's P0s cannot be delivered — that outcome should go back to them in writing, not be worked around.
|
||||||
277
docs/PRODUCT-PLAN-v3.1-GAP-ANALYSIS.md
Normal file
277
docs/PRODUCT-PLAN-v3.1-GAP-ANALYSIS.md
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
# Product Plan v3.1 — What They Want vs. What We Have
|
||||||
|
|
||||||
|
**Source:** `Marketplaces-Platform-Product-Plan-v3.1.pdf` (27 pages, RU). Version block inside still reads `3.0 / 17 августа 2026` — the filename says v3.1. Section 14 is the v3.1 addition (appended after the document's own conclusion).
|
||||||
|
|
||||||
|
**Our side, as verified in this repo:** Angular frontend only (426 `.ts` files). Sources for "what we have": [BACKEND-API-REFERENCE.md](../BACKEND-API-REFERENCE.md), [GAPS-AND-IMPROVEMENTS.md](../GAPS-AND-IMPROVEMENTS.md), and direct source inspection.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. What they are actually asking for
|
||||||
|
|
||||||
|
One sentence: **stop building storefronts, build a platform** — a single multi-tenant commerce core where launching a new marketplace is a configuration act, not an engineering project.
|
||||||
|
|
||||||
|
Their own acceptance bar (§"ГЛАВНЫЙ КРИТЕРИЙ" and §13):
|
||||||
|
|
||||||
|
> A real product walks the whole path: seller → catalog → storefront → cart → checkout → payment → order → notification → fulfillment → reconciliation.
|
||||||
|
|
||||||
|
Three things the document is really about, under the product language:
|
||||||
|
|
||||||
|
1. **They do not trust our numbers.** Traffic counters, payment timings, order totals and currency amounts are all called out as unexplainable. §10.2 says it outright: don't fix appearance, fix the data.
|
||||||
|
2. **They suspect demo behaviour in production.** "No fixed 5-second payment", "no synthetic traffic in production analytics", "no special branch for banks/inspectors" (§3.2, §3.1, §3.6, §10.2, and again in the launch checklist). This is an audit/compliance posture, not a feature request — a bank or NSPK is checking this platform.
|
||||||
|
3. **Commerce Core is no longer optional.** In v3.0 language, Catalog/Seller Portal/Cart/Checkout/Payments/Orders stopped being "a possible extension" and became mandatory platform modules. Gorbushka is demoted to "one tenant scenario" (§11) — it does not define the architecture.
|
||||||
|
|
||||||
|
**Launch blockers they define (§3, "LAUNCH BLOCKERS"):** all P0s — money/FX, payment timeline, notifications, external order ingestion, price traceability, guaranteed fulfillability of published offers.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. What is new in v3.1 vs v3.0
|
||||||
|
|
||||||
|
Everything in **§14 "Customer Identity и коммуникация после покупки"** (pages 26–27). Nothing else in the document is marked as changed.
|
||||||
|
|
||||||
|
| New in v3.1 | Detail | Our state |
|
||||||
|
|---|---|---|
|
||||||
|
| **VK ID as primary social login** | Backend completes OAuth 2.1/PKCE, links external identity to `Customer` | Zero. No `vk` reference anywhere in source; one `oauth` reference total. |
|
||||||
|
| **MAX messenger bot** | Bot-assisted account linking via one-time code; official MAX Bot API | Zero. |
|
||||||
|
| **Telegram demoted** | Kept, but as *one* identity provider among several | Today Telegram is the **only** login for both customers and admins. |
|
||||||
|
| **Notification Orchestrator** | Routes `order.paid` to the customer's chosen channel; backoffice notification always fires even if the messenger is down | Zero. |
|
||||||
|
| **Delivery Conversation State Machine** | `not_started → awaiting_customer → details_received → manager_assigned/auto_confirmed → shipment_planned → completed`, bot collects delivery details, manager handoff | Zero. |
|
||||||
|
| **Channel choice in checkout** | "Where should we send confirmation?" — VK / MAX / Telegram / email-SMS fallback, recorded in `OrderContactSnapshot` | Zero. |
|
||||||
|
| **`ExternalIdentity` / `ContactChannel` / `BotConversationBinding` / `MessagingConsent`** | Four new entities | Zero. |
|
||||||
|
|
||||||
|
**Manager note:** §14 partially collides with our approved [email/phone OTP login spec](superpowers/specs/2026-08-15-email-phone-login-design.md). v3.1 keeps email/phone but reduces them to *recovery/fallback* when a messenger is unavailable. Our in-flight work is still valid, but its priority drops below VK ID. Needs a call before that spec is implemented.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. The differences — detailed
|
||||||
|
|
||||||
|
Legend: ✅ have · 🟡 partial / mock only · ❌ missing · ⚠️ conflicts with something we already decided.
|
||||||
|
|
||||||
|
### 3.1 Platform components (§1.1) — 8 named components, we have 2
|
||||||
|
|
||||||
|
| Plan component | Our state |
|
||||||
|
|---|---|
|
||||||
|
| Storefront Runtime | ✅ Bootstrap-driven, tenant-configured, no per-project fork. This is our strongest match to the plan. |
|
||||||
|
| Platform Backoffice | 🟡 14 admin modules exist, but only **Categories** has a real HTTP backend. 9 of 11 admin domains inject their mock gateway directly — no DI seam to swap at all. |
|
||||||
|
| Platform API | 🟡 Storefront catalog/search/cart-payment are live; everything admin-side is mock. |
|
||||||
|
| Seller Portal | ❌ A static placeholder page, feature flag `false` by default, zero backend bytes, zero `HttpClient` reference. |
|
||||||
|
| Workers / Event Processing | ❌ Nothing. No event bus, no retry, no dead-letter. |
|
||||||
|
| Integration Hub | ❌ Nothing. Zero `reconcil*`, zero `idempot*` in the whole codebase. |
|
||||||
|
| Domain Automation | ❌ Nothing. Zero `hostinger` references — the plan's §8.2 lists seven Hostinger DNS endpoints we have never touched. |
|
||||||
|
| Marketplace Registry / Launch Center | ❌ Nothing shipped. Closest thing is our unshipped [super-admin Phase 1 design](superpowers/specs/superuser.md), which covers cross-tenant *viewing* but not registry/feature-set/launch. |
|
||||||
|
|
||||||
|
### 3.2 Catalog model (§2.1) — the biggest structural gap
|
||||||
|
|
||||||
|
The plan's core catalog idea is a **two-layer split**: `Product` (content card) vs. `Offer/Listing` (the seller's commercial proposition, which owns price, stock, currency, status). Order lines then snapshot the offer.
|
||||||
|
|
||||||
|
| Plan entity | Our state |
|
||||||
|
|---|---|
|
||||||
|
| `Product` / `Variant` / `SKU` | 🟡 Exists as admin mock + a separate live storefront `Item` domain. Two unrelated `Category` types, both fed by the same response, both in use. |
|
||||||
|
| `Offer / Listing` | ❌ Does not exist. Price and stock hang off the product. Multi-seller pricing on one product card is not expressible. |
|
||||||
|
| `PriceSnapshot` | ❌ Does not exist. |
|
||||||
|
| `InventoryRecord` (available/reserved/sold) | ❌ Does not exist. No reservations, no TTL, no oversell queue. |
|
||||||
|
| `PriceHistory` | ❌ Does not exist. |
|
||||||
|
| Draft → moderation → published → paused/archived | 🟡 An admin Moderation module exists, on mock data. |
|
||||||
|
| Bulk import CSV/API with pre-apply error preview | ❌ Only bulk *edit* actions inside Admin Categories. No import pipeline. |
|
||||||
|
| "Storefront search/filters run on published data, not local mock arrays" | ⚠️ Directly aimed at us. `PRODUCT_DATA_PROVIDER` and `CATEGORY_REPOSITORY` silently always resolve to the real API — but Search, wishlist/compare, cart contents and CMS are entirely `localStorage`. |
|
||||||
|
|
||||||
|
### 3.3 Money, FX and price traceability (§2.3, §3.3, §3.8, §7)
|
||||||
|
|
||||||
|
This is where the plan is most explicit, and where we most clearly do the forbidden thing.
|
||||||
|
|
||||||
|
| Plan requirement | Our state |
|
||||||
|
|---|---|
|
||||||
|
| `Money = amountMinor + currency`, **no float for money math** | ⚠️ We use plain `number` prices and float division/multiplication in `CurrencyRatesService.convert()`. |
|
||||||
|
| Rates come from a configurable **external source** with `source`, `rate`, `timestamp`, `TTL` | ⚠️ Rates are **hand-typed by an admin** into Admin Settings and stored in **browser `localStorage`** (`currencyRates.v1`), with hardcoded fallbacks (`USD: 0.011`, `AMD: 4.3`). They never update and drift from market. |
|
||||||
|
| `FxQuote { base, quote, rate, source, observedAt, expiresAt, quoteId }` | ❌ Does not exist. |
|
||||||
|
| Stale-quote control blocks checkout | ❌ Does not exist. |
|
||||||
|
| Checkout writes an immutable price snapshot; old orders never recalculated | ❌ Does not exist. |
|
||||||
|
| `PriceBook` (base currency + allowed display/checkout currencies) | ❌ Does not exist. |
|
||||||
|
| Backoffice shows the total formula: lines × qty − discounts + delivery + fees, plus the FX quote used | ❌ Does not exist. |
|
||||||
|
| Reconciliation of internal orders vs. provider transactions | ❌ Does not exist (`reconcil*` = 0 hits repo-wide). |
|
||||||
|
|
||||||
|
**Nuance worth telling them:** their §3.3 complaint is *"switching RUB/USD/AMD keeps the same number"*. Our storefront **does** convert the displayed number. Their real, unstated problem is the one our own [§12.7](../BACKEND-API-REFERENCE.md) already flagged: the **charged** amount is computed client-side in RUB and posted to `/cart` as `amount`, so bank settlement totals don't reconcile against order counts. We agree with the plan here — we raised it first.
|
||||||
|
|
||||||
|
### 3.4 Cart and Checkout (§2.5, §2.6) — ⚠️ head-on conflict with a frozen system
|
||||||
|
|
||||||
|
| Plan requirement | Our state |
|
||||||
|
|---|---|
|
||||||
|
| Cart is **server-side**, keyed on `offerId` | ⚠️ Cart is `localStorage` + Telegram CloudStorage. There is no backend cart at all. |
|
||||||
|
| "Client never sends a trusted price to the server" | ⚠️ `CartPaymentRequest` sends `amount`, `currency`, and a per-item `price` array from the browser. This is exactly the pattern the plan forbids. |
|
||||||
|
| Checkout is a **server session** producing a price snapshot + contact snapshot | ❌ Checkout is an inline popup in `pages/cart/cart.component.ts` (751 lines). `features/website/checkout/` is an empty directory. |
|
||||||
|
| Idempotent order creation keyed on the payment | ❌ `/orders` is called fire-and-forget after payment success. Zero `idempot*` in the codebase. |
|
||||||
|
| Backend re-validates offers/stock at checkout | ❌ No stock concept exists to validate. |
|
||||||
|
| Multi-seller cart grouped by seller and fulfillment rules | ❌ Undefined behaviour — already flagged in our own gaps doc. |
|
||||||
|
| No duplicate payment intents on double-click | 🟡 Popup state guards the UI; nothing server-side. |
|
||||||
|
|
||||||
|
**Blocker:** [BACKEND-API-REFERENCE.md §7](../BACKEND-API-REFERENCE.md) states *"Payments are frozen — this call chain is explicitly out of scope for changes."* The plan's P0-A and P0-C cannot be delivered without unfreezing it. **This needs an explicit decision from whoever froze it.**
|
||||||
|
|
||||||
|
### 3.5 Payments (§2.7, §3.2)
|
||||||
|
|
||||||
|
| Plan requirement | Our state |
|
||||||
|
|---|---|
|
||||||
|
| Explicit state machines: `PaymentIntent` / `Payment` / `Order` | ❌ None. Payment status is a client-side signal with values `creating/waiting/success/timeout/error`. |
|
||||||
|
| Webhook signature verification + idempotency | ❌ None. `webhook` appears only as a display field in the admin **monitoring mock**. |
|
||||||
|
| Store `provider event id`, `provider timestamp`, `receivedAt`, `processedAt` | ❌ None. |
|
||||||
|
| "No artificial fixed delays" | ✅ **We already comply.** We poll real provider status (`/qr/dynamic/{partnerId}/{qrId}`, `/card/{partnerId}/{orderId}`) on an interval bounded by the QR TTL. There is no 5-second timer in this codebase. |
|
||||||
|
| Refunds as a first-class operation with reason/actor/order-line link | ❌ `requestRefund(id)` exists only as a mock gateway method. |
|
||||||
|
| Reconciliation queue | ❌ None. |
|
||||||
|
|
||||||
|
**Ask them:** §3.2 describes a fixed 5-second payment. We cannot reproduce it here. Either they observed a different build/environment, or they inferred it from the *admin* mock data. Worth pinning down before we spend P0 budget on a problem that may not be ours.
|
||||||
|
|
||||||
|
### 3.6 Orders and Fulfillment (§2.8, §3.6)
|
||||||
|
|
||||||
|
| Plan requirement | Our state |
|
||||||
|
|---|---|
|
||||||
|
| Canonical `Order` regardless of source (storefront / external marketplace / backoffice / API partner) | ❌ Admin Orders is a **static 24-row in-memory seed with no create path**, and no DI token to swap it. |
|
||||||
|
| `OrderLine` with SKU/title/price snapshots | ❌ |
|
||||||
|
| `Source mapping` (`externalMarketplace`, `externalOrderId`, `connectorId`) | ❌ |
|
||||||
|
| `Fulfillment` (manual / warehouse / pickup / digital) with evidence | ❌ One `fulfil*` hit in the entire codebase. |
|
||||||
|
| `Timeline` of all order events | ❌ Already logged as our own frontend-blocked TODO ("Real order audit trail"). |
|
||||||
|
| Admin actions: assign, resend notification, replay sync, cancel/refund by permission | ❌ |
|
||||||
|
| **No special branch for inspectors — any published, available product must be genuinely buyable and fulfillable** | ❌ We have no publish-time executability validation and no fulfillment flow, so we cannot currently *prove* compliance either way. |
|
||||||
|
|
||||||
|
### 3.7 Customer identity (§2.9, §3.4, §14)
|
||||||
|
|
||||||
|
| Plan requirement | Our state |
|
||||||
|
|---|---|
|
||||||
|
| `Customer` + multiple `ExternalIdentity` + verified `ContactMethod` | ❌ Telegram user is effectively the customer identity. |
|
||||||
|
| `emailVerifiedAt` / `phoneVerifiedAt` / `telegramLinkedAt` | ❌ |
|
||||||
|
| Order contact snapshot, immutable after order creation | ❌ |
|
||||||
|
| Email/phone OTP | 🟡 **Designed, not built** — spec approved 2026-08-15. |
|
||||||
|
| VK ID / MAX | ❌ New in v3.1, nothing exists. |
|
||||||
|
| Guest checkout toggled by tenant policy | ❌ |
|
||||||
|
|
||||||
|
### 3.8 Notifications (§2.10, §3.5)
|
||||||
|
|
||||||
|
| Plan requirement | Our state |
|
||||||
|
|---|---|
|
||||||
|
| Platform event bus emitting `order.created` / `order.paid` / `payment.failed` / `webhook.error` / `stock.low` / `oversell` / `refund.*` / `external_order.imported` | ❌ |
|
||||||
|
| Notification with `unread/read`, `severity`, `marketplaceId`, entity type/id, **deep link** | 🟡 `AdminOrderWatcherService` polls for new orders and toasts/badges the admin — the right shape, wrong data source. |
|
||||||
|
| Unread counter + filter by marketplace / event type in backoffice | 🟡 Partial (counter yes, marketplace filter no). |
|
||||||
|
| External channel delivery status logged; a Telegram/email failure must not lose the internal notification | ❌ |
|
||||||
|
|
||||||
|
**Status:** the notification feature is built and **functionally inert** — it polls the mock Orders gateway, which has no create path, so no new order can ever appear. It starts working the day Orders gets a real backend, with no further frontend change.
|
||||||
|
|
||||||
|
### 3.9 Analytics (§3.1, §6.3)
|
||||||
|
|
||||||
|
| Plan requirement | Our state |
|
||||||
|
|---|---|
|
||||||
|
| Server-side event logging: `session_started`, `page_view`, `product_view`, `add_to_cart`, `checkout_started`, `payment_started/success/failed`, `order_created` | ❌ **No tracking pipeline exists at all.** Not a missing endpoint — missing infrastructure. Our own docs rate it the single largest remaining backend effort. |
|
||||||
|
| Operational metrics: notification latency, fulfillment time, connector lag, webhook lag | ❌ |
|
||||||
|
| Quality metrics: frontend/backend errors, checkout validation failures, FX stale blocks | ❌ |
|
||||||
|
| Real funnel in backoffice | ❌ Admin Analytics composes five mock gateways and has no data source. |
|
||||||
|
| Synthetic traffic technically separated from production analytics | ⚠️ Cannot comply — there is no production analytics to separate it from. |
|
||||||
|
| Product view counts | 🟡 A "Views" column was shipped in Admin Products; it always renders `0` because no tracking source exists. Storefront `Item.visits` is live-wired but displayed nowhere. |
|
||||||
|
|
||||||
|
### 3.10 Backoffice navigation (§4.1) — 12 required sections, 5 missing outright
|
||||||
|
|
||||||
|
Have (mock unless noted): Overview/Dashboard, Catalog (Categories real, Products mock), Orders, Payments partial (Transactions), Customers, Notifications partial, Content & Design (builder/CMS, `localStorage` only), Monitoring, Reports, Users, Settings.
|
||||||
|
|
||||||
|
Missing entirely:
|
||||||
|
|
||||||
|
- **Marketplaces** — registry, type, status, domains, currencies, feature set, responsible manager. Nothing.
|
||||||
|
- **Sellers** — organizations, applications, roles, listings, integration health. Placeholder page only.
|
||||||
|
- **Payments & Finance** — refunds, reconciliation, unmatched events, settlements. `settlement*` = 0 hits.
|
||||||
|
- **Integrations** — external connectors, payment providers, FX sources, messaging. Nothing.
|
||||||
|
- **Domains & Releases** — DNS/SSL, staging, production, health checks, rollback. Nothing.
|
||||||
|
- **Audit & Security** — role changes, sensitive actions, login/security events, exports. `audit` appears only as display fields on mock models.
|
||||||
|
|
||||||
|
### 3.11 Roles and RBAC (§4.4, §10.1) — ⚠️ our most serious security gap
|
||||||
|
|
||||||
|
The plan specifies three scopes and 17 named roles (5 platform, 7 marketplace, 5 seller).
|
||||||
|
|
||||||
|
Our state: **the admin role model is decorative.** `AdminRole` and permissions exist as types, but nothing gates any button, page or action anywhere in the app. Anyone who passes admin authentication has full access. `AdminRole` is additionally defined twice with unrelated shapes.
|
||||||
|
|
||||||
|
Also missing from §10.1: idempotency keys, rate-limit handling (429 has zero client-side handling), step-up authentication for financial actions, audit log, PII minimisation policy.
|
||||||
|
|
||||||
|
### 3.12 External marketplace integrations (§5) — 0% built
|
||||||
|
|
||||||
|
Nothing in this section exists in any form: connector contract, webhook-preferred/polling-fallback ingestion, raw event storage, normalizer, SKU mapping, unmatched queue, exponential retry, dead-letter, manual replay, reconciliation, connector observability, and the proposed SLA (99% of webhook events processed under 60s, zero duplicate orders).
|
||||||
|
|
||||||
|
**Blocking unknown:** the plan never names which external marketplaces. Ozon? Wildberries? Yandex Market? Avito? Each is a separate connector with its own auth and rate limits. We cannot size this without the list.
|
||||||
|
|
||||||
|
### 3.13 Domains, publishing and tenant launch (§8)
|
||||||
|
|
||||||
|
| Plan requirement | Our state |
|
||||||
|
|---|---|
|
||||||
|
| Marketplace lifecycle `draft → configured → content_ready → domains_planned → staging_live → qa_passed → production_ready → live → paused/archived`, with the blocking item shown per transition | ❌ |
|
||||||
|
| DNS automation via Hostinger API (7 endpoints listed), snapshot + rollback, never touching MX/SPF/DKIM/DMARC/CAA, approval gate in production, propagation + SSL + health checks | ❌ Zero references. |
|
||||||
|
| Publish model: `draft → validation → preview → publish`, immutable published revision, rollback creates a new revision | 🟡 The builder edits an in-memory config and persists drafts to `localStorage`. "Publish" only promotes a local signal. No revisions, no server-side publish endpoint (`apiEndpoints.builder` is an empty placeholder). |
|
||||||
|
| Commerce data explicitly **not** part of content revisions | ✅ Structurally true today — orders/payments simply aren't in the revision at all. |
|
||||||
|
|
||||||
|
### 3.14 API boundaries (§9.3) — ⚠️ a naming migration we have not planned
|
||||||
|
|
||||||
|
Plan namespaces: `/api/v2/storefront/*`, `/api/admin/v2/*`, `/api/seller/v1/*`, `/api/identity/v1/*`, `/api/providers/v1/*`, `/api/integrations/v1/*`.
|
||||||
|
|
||||||
|
Ours: unversioned, flat — `/cart`, `/orders`, `/items`, `/category`, `/searchitems`, plus a separate `qrApiUrl` host. Our own reference says **"No API versioning scheme has been decided"**.
|
||||||
|
|
||||||
|
Adopting the plan's namespaces is a coordinated frontend+backend rename, not a config change. It should be sequenced *before* the new commerce endpoints are built, not after.
|
||||||
|
|
||||||
|
Also in §9: the plan's error model assumes a structured envelope. Ours is a proposal only — no interceptor inspects error bodies today; every error reaction happens at raw HTTP-status level.
|
||||||
|
|
||||||
|
### 3.15 Gorbushka as a tenant (§11)
|
||||||
|
|
||||||
|
The plan lists mall-directory content entities: `Shop`, `ShopCategory`, `Service`, `Floor`, `SchemePin`, `RentListing`, `News/Promo`, `StaticPage`, `Lead`, `MallSettings` — each with `marketplaceId`, audit, and publish/preview.
|
||||||
|
|
||||||
|
We have: static pages inside the bootstrap document. None of the other nine entity types exist, and CMS content has no backend write path at all.
|
||||||
|
|
||||||
|
Positive read: the plan explicitly says Gorbushka must **not** dictate platform architecture, and that the existing frontend is UX reference only. That matches our ADR-0001 constraint ("frontend must not contain marketplace-specific code"). No conflict here — just unbuilt scope.
|
||||||
|
|
||||||
|
### 3.16 Definition of Done (§13) — where we stand today
|
||||||
|
|
||||||
|
Of the 13 launch-checklist items, we can currently claim **zero** as green. Additionally, our own QA position makes their DoD hard to evidence:
|
||||||
|
|
||||||
|
- ~32% statement coverage, ~19% branch coverage, 11 spec files repo-wide.
|
||||||
|
- **Zero E2E tests** — no Playwright/Cypress config anywhere. The plan's acceptance criteria are all end-to-end by construction.
|
||||||
|
- Several past "verified live" claims were code-inspection only, because `/edit` and `/backoffice` require Telegram admin login that automated environments cannot complete.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. What we have that the plan does not account for
|
||||||
|
|
||||||
|
Not gaps — assets and risks they should know about before sequencing:
|
||||||
|
|
||||||
|
1. **Project editor / builder** (~1.0 MB lazy chunk) — a full visual site builder. The plan's §8.3 publish model would replace its persistence layer entirely.
|
||||||
|
2. **Ed25519 challenge/response admin auth** — fully wired client-side, backend returns 404 today. The plan never mentions it; it assumes conventional RBAC.
|
||||||
|
3. **Widget manifest / dynamic renderer** — the mechanism that makes one storefront runtime serve many tenants. This is the part of the plan we have *already* solved and should defend.
|
||||||
|
4. **Super-admin Phase 1 design** (`docs/superpowers/specs/superuser.md`) — cross-tenant read-only view. Overlaps §4.3 Marketplace Registry and §10 audit. Worth re-scoping against the plan rather than building as specified.
|
||||||
|
5. **Three in-flight items already answer v3.0 P0s:** admin purchase notifications (§3.5), admin product views column (§3.1), email/phone OTP login (§3.4). Two of the three are inert until a real backend exists.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Manager's read — the honest framing
|
||||||
|
|
||||||
|
**Split of ownership.** Roughly 80% of this document is backend and platform-service work: Platform API, Workers/Event Processing, Integration Hub, Domain Automation, payment state machines, reconciliation, analytics pipeline. This repository is a frontend. Of the plan's ~14 sections, only Storefront Runtime (§6.1) is substantially delivered, and it is delivered *well*.
|
||||||
|
|
||||||
|
**The real message is trust, not features.** Every P0 in §3 is a variant of "we cannot explain your numbers." Sequencing should follow that: traceability first (money model, price snapshot, payment timeline, audit), feature breadth second. That happens to also be the plan's own P0-A ordering.
|
||||||
|
|
||||||
|
**The largest single risk is not scope — it is the frozen payment chain.** Cart is client-owned, price is client-supplied, orders are fire-and-forget, and the whole chain is marked "do not modify." Three P0s sit behind that freeze. Nothing else in this list can be honestly estimated until that decision is reversed or explained.
|
||||||
|
|
||||||
|
**Second risk: RBAC.** The plan assumes 17 enforced roles across three scopes. We enforce none. Any real admin backend going live before this is fixed hands full platform access to every authenticated operator.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Decisions we need from them before estimating
|
||||||
|
|
||||||
|
1. **Who owns the backend?** The plan assumes Platform API, Workers, Integration Hub and Domain Automation exist or will be built. None do. Same team, or a service team we integrate with?
|
||||||
|
2. **Is the payment chain unfrozen?** P0-A/P0-C are unbuildable otherwise.
|
||||||
|
3. **Which external marketplaces**, by name, for §5 connectors?
|
||||||
|
4. **Which FX rate source?** The plan says "configurable external source"; our earlier ask named Rapira as a candidate. Also: does the backend return converted prices, or serve rates for the client to apply? The plan implies the former.
|
||||||
|
5. **§14 vs. our approved email/phone OTP spec** — build VK ID first, or finish OTP first?
|
||||||
|
6. **Multi-seller orders: unified or split?** Undecided in three of our own documents; the plan requires cart-level seller grouping (§2.5) but never resolves the order-splitting question.
|
||||||
|
7. **Where does the "fixed 5-second payment" (§3.2) come from?** We cannot reproduce it in this codebase.
|
||||||
|
8. **API namespace migration (§9.3)** — do it now, before new endpoints, or accept two conventions?
|
||||||
|
9. **Document version** — the file is v3.1 but the version block says 3.0. Which is canonical for change tracking?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Suggested first slice (if they want a proposal back)
|
||||||
|
|
||||||
|
Following their own dependency order, restricted to what is buildable and provable:
|
||||||
|
|
||||||
|
1. **Money model + FX quote + price snapshot** (P0-A) — needs the payment freeze lifted. Removes client-supplied `amount`, kills the float math, gives every total an explainable formula. This one item closes §3.3, §3.8 and half of §13.1.
|
||||||
|
2. **Order canonical model + timeline + notification wiring** (P0-B) — the notification feature already exists and switches on for free.
|
||||||
|
3. **RBAC enforcement** — not on their P0 list, but it is the gate on everything else in the backoffice going live safely.
|
||||||
|
4. **Analytics event pipeline** (P0/§3.1) — long lead time, so start it in parallel rather than last.
|
||||||
|
|
||||||
|
Explicitly *not* in a first slice: Seller Portal, external connectors, domain automation, VK/MAX bots. All of them depend on the commerce core being real first, which is what the plan itself says in §12.1.
|
||||||
@@ -13,10 +13,10 @@ import {
|
|||||||
AdminRecentActivityEntry,
|
AdminRecentActivityEntry,
|
||||||
AdminRecommendationCard,
|
AdminRecommendationCard,
|
||||||
} from '../models/admin-analytics.model';
|
} from '../models/admin-analytics.model';
|
||||||
import { AdminOrdersLocalGateway } from '../../orders/services/admin-orders-local.gateway';
|
import { ADMIN_ORDERS_GATEWAY } from '../../orders/services/admin-orders-gateway.token';
|
||||||
import { AdminProductsLocalGateway } from '../../products/services/admin-products-local.gateway';
|
import { ADMIN_PRODUCTS_GATEWAY } from '../../products/services/admin-products-gateway.token';
|
||||||
import { ADMIN_CATEGORIES_GATEWAY } from '../../categories/services/admin-categories-gateway.token';
|
import { ADMIN_CATEGORIES_GATEWAY } from '../../categories/services/admin-categories-gateway.token';
|
||||||
import { AdminModerationLocalGateway } from '../../moderation/services/admin-moderation-local.gateway';
|
import { ADMIN_MODERATION_GATEWAY } from '../../moderation/services/admin-moderation-gateway.token';
|
||||||
import { AdminDashboardFacade } from '../../dashboard/facade/admin-dashboard.facade';
|
import { AdminDashboardFacade } from '../../dashboard/facade/admin-dashboard.facade';
|
||||||
import { AdminOrder } from '../../orders/models/admin-order.model';
|
import { AdminOrder } from '../../orders/models/admin-order.model';
|
||||||
import { AdminProduct } from '../../products/models/admin-product.model';
|
import { AdminProduct } from '../../products/models/admin-product.model';
|
||||||
@@ -31,10 +31,10 @@ import { AdminReview } from '../../moderation/models/admin-review.model';
|
|||||||
*/
|
*/
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AdminAnalyticsFacade {
|
export class AdminAnalyticsFacade {
|
||||||
private readonly ordersGateway = inject(AdminOrdersLocalGateway);
|
private readonly ordersGateway = inject(ADMIN_ORDERS_GATEWAY);
|
||||||
private readonly productsGateway = inject(AdminProductsLocalGateway);
|
private readonly productsGateway = inject(ADMIN_PRODUCTS_GATEWAY);
|
||||||
private readonly categoriesGateway = inject(ADMIN_CATEGORIES_GATEWAY);
|
private readonly categoriesGateway = inject(ADMIN_CATEGORIES_GATEWAY);
|
||||||
private readonly moderationGateway = inject(AdminModerationLocalGateway);
|
private readonly moderationGateway = inject(ADMIN_MODERATION_GATEWAY);
|
||||||
private readonly dashboardFacade = inject(AdminDashboardFacade);
|
private readonly dashboardFacade = inject(AdminDashboardFacade);
|
||||||
|
|
||||||
readonly dateRange = signal<AdminAnalyticsDateRange>(30);
|
readonly dateRange = signal<AdminAnalyticsDateRange>(30);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Injectable, inject, signal } from '@angular/core';
|
import { Injectable, inject, signal } from '@angular/core';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { AdminOrdersLocalGateway } from '../../orders/services/admin-orders-local.gateway';
|
import { ADMIN_ORDERS_GATEWAY } from '../../orders/services/admin-orders-gateway.token';
|
||||||
import { AdminOrder } from '../../orders/models/admin-order.model';
|
import { AdminOrder } from '../../orders/models/admin-order.model';
|
||||||
import { AdminCustomer } from '../models/admin-customer.model';
|
import { AdminCustomer } from '../models/admin-customer.model';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AdminCustomersFacade {
|
export class AdminCustomersFacade {
|
||||||
private readonly ordersGateway = inject(AdminOrdersLocalGateway);
|
private readonly ordersGateway = inject(ADMIN_ORDERS_GATEWAY);
|
||||||
|
|
||||||
readonly customers = signal<AdminCustomer[]>([]);
|
readonly customers = signal<AdminCustomer[]>([]);
|
||||||
readonly loading = signal(false);
|
readonly loading = signal(false);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Injectable, computed, inject, signal } from '@angular/core';
|
|||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { AdminReview, AdminReviewListFilters, AdminReviewStatus } from '../models/admin-review.model';
|
import { AdminReview, AdminReviewListFilters, AdminReviewStatus } from '../models/admin-review.model';
|
||||||
import { AdminReport, AdminReportStatus } from '../models/admin-report.model';
|
import { AdminReport, AdminReportStatus } from '../models/admin-report.model';
|
||||||
import { AdminModerationLocalGateway } from '../services/admin-moderation-local.gateway';
|
import { ADMIN_MODERATION_GATEWAY } from '../services/admin-moderation-gateway.token';
|
||||||
import { LocalStorageService } from '../../../../core/storage/local-storage.service';
|
import { LocalStorageService } from '../../../../core/storage/local-storage.service';
|
||||||
|
|
||||||
export type AdminModerationViewMode = 'table' | 'cards';
|
export type AdminModerationViewMode = 'table' | 'cards';
|
||||||
@@ -38,7 +38,7 @@ const COLUMNS_KEY = 'admin-moderation:visible-columns';
|
|||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AdminModerationFacade {
|
export class AdminModerationFacade {
|
||||||
private readonly gateway = inject(AdminModerationLocalGateway);
|
private readonly gateway = inject(ADMIN_MODERATION_GATEWAY);
|
||||||
private readonly localStorage = inject(LocalStorageService);
|
private readonly localStorage = inject(LocalStorageService);
|
||||||
|
|
||||||
readonly filters = signal<AdminReviewListFilters>({ search: '', status: 'all', rating: 'all', page: 1, pageSize: 10 });
|
readonly filters = signal<AdminReviewListFilters>({ search: '', status: 'all', rating: 'all', page: 1, pageSize: 10 });
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { InjectionToken, inject } from '@angular/core';
|
||||||
|
import { AdminModerationGateway } from './admin-moderation-gateway.interface';
|
||||||
|
import { AdminModerationLocalGateway } from './admin-moderation-local.gateway';
|
||||||
|
|
||||||
|
/** Swap point for a real Moderation backend - see BACKEND-API-REFERENCE.md §8 (no seam existed before this token). */
|
||||||
|
export const ADMIN_MODERATION_GATEWAY = new InjectionToken<AdminModerationGateway>('ADMIN_MODERATION_GATEWAY', {
|
||||||
|
providedIn: 'root',
|
||||||
|
factory: () => inject(AdminModerationLocalGateway),
|
||||||
|
});
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Injectable, inject, signal } from '@angular/core';
|
import { Injectable, inject, signal } from '@angular/core';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { AdminMonitoringEvent, AdminMonitoringEventFilters, AdminQueue, AdminWebhookDelivery } from '../models/admin-monitoring.model';
|
import { AdminMonitoringEvent, AdminMonitoringEventFilters, AdminQueue, AdminWebhookDelivery } from '../models/admin-monitoring.model';
|
||||||
import { AdminMonitoringLocalGateway } from '../services/admin-monitoring-local.gateway';
|
import { ADMIN_MONITORING_GATEWAY } from '../services/admin-monitoring-gateway.token';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AdminMonitoringFacade {
|
export class AdminMonitoringFacade {
|
||||||
private readonly gateway = inject(AdminMonitoringLocalGateway);
|
private readonly gateway = inject(ADMIN_MONITORING_GATEWAY);
|
||||||
|
|
||||||
readonly filters = signal<AdminMonitoringEventFilters>({ category: 'all', search: '' });
|
readonly filters = signal<AdminMonitoringEventFilters>({ category: 'all', search: '' });
|
||||||
readonly events = signal<AdminMonitoringEvent[]>([]);
|
readonly events = signal<AdminMonitoringEvent[]>([]);
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { InjectionToken, inject } from '@angular/core';
|
||||||
|
import { AdminMonitoringGateway } from './admin-monitoring-gateway.interface';
|
||||||
|
import { AdminMonitoringLocalGateway } from './admin-monitoring-local.gateway';
|
||||||
|
|
||||||
|
/** Swap point for a real Monitoring backend - see BACKEND-API-REFERENCE.md §8 (no seam existed before this token). */
|
||||||
|
export const ADMIN_MONITORING_GATEWAY = new InjectionToken<AdminMonitoringGateway>('ADMIN_MONITORING_GATEWAY', {
|
||||||
|
providedIn: 'root',
|
||||||
|
factory: () => inject(AdminMonitoringLocalGateway),
|
||||||
|
});
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Injectable, computed, inject, signal } from '@angular/core';
|
import { Injectable, computed, inject, signal } from '@angular/core';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { AdminOrder, AdminOrderListFilters, AdminOrderStatus, TERMINAL_ORDER_STATUSES } from '../models/admin-order.model';
|
import { AdminOrder, AdminOrderListFilters, AdminOrderStatus, TERMINAL_ORDER_STATUSES } from '../models/admin-order.model';
|
||||||
import { AdminOrdersLocalGateway } from '../services/admin-orders-local.gateway';
|
import { ADMIN_ORDERS_GATEWAY } from '../services/admin-orders-gateway.token';
|
||||||
import { LocalStorageService } from '../../../../core/storage/local-storage.service';
|
import { LocalStorageService } from '../../../../core/storage/local-storage.service';
|
||||||
|
|
||||||
export type AdminOrdersViewMode = 'table' | 'cards';
|
export type AdminOrdersViewMode = 'table' | 'cards';
|
||||||
@@ -30,7 +30,7 @@ const COLUMNS_KEY = 'admin-orders:visible-columns';
|
|||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AdminOrdersFacade {
|
export class AdminOrdersFacade {
|
||||||
private readonly gateway = inject(AdminOrdersLocalGateway);
|
private readonly gateway = inject(ADMIN_ORDERS_GATEWAY);
|
||||||
private readonly localStorage = inject(LocalStorageService);
|
private readonly localStorage = inject(LocalStorageService);
|
||||||
|
|
||||||
readonly filters = signal<AdminOrderListFilters>({ search: '', status: 'all', page: 1, pageSize: 10 });
|
readonly filters = signal<AdminOrderListFilters>({ search: '', status: 'all', page: 1, pageSize: 10 });
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { InjectionToken, inject } from '@angular/core';
|
||||||
|
import { AdminOrdersGateway } from './admin-orders-gateway.interface';
|
||||||
|
import { AdminOrdersLocalGateway } from './admin-orders-local.gateway';
|
||||||
|
|
||||||
|
/** Swap point for a real Orders backend - see BACKEND-API-REFERENCE.md §8 (no seam existed before this token). */
|
||||||
|
export const ADMIN_ORDERS_GATEWAY = new InjectionToken<AdminOrdersGateway>('ADMIN_ORDERS_GATEWAY', {
|
||||||
|
providedIn: 'root',
|
||||||
|
factory: () => inject(AdminOrdersLocalGateway),
|
||||||
|
});
|
||||||
@@ -2,7 +2,7 @@ import { Injectable, computed, inject, signal } from '@angular/core';
|
|||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { AdminProduct, AdminProductCategoryOption, AdminProductEditorMode, AdminProductListFilters } from '../models/admin-product.model';
|
import { AdminProduct, AdminProductCategoryOption, AdminProductEditorMode, AdminProductListFilters } from '../models/admin-product.model';
|
||||||
import { AdminProductsFormFactory } from '../services/admin-products-form.factory';
|
import { AdminProductsFormFactory } from '../services/admin-products-form.factory';
|
||||||
import { AdminProductsLocalGateway } from '../services/admin-products-local.gateway';
|
import { ADMIN_PRODUCTS_GATEWAY } from '../services/admin-products-gateway.token';
|
||||||
import { ProjectEditorFacade } from '../../../project-editor/facade/project-editor.facade';
|
import { ProjectEditorFacade } from '../../../project-editor/facade/project-editor.facade';
|
||||||
import { LocalStorageService } from '../../../../core/storage/local-storage.service';
|
import { LocalStorageService } from '../../../../core/storage/local-storage.service';
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ export type AdminProductColumn = typeof ALL_PRODUCT_COLUMNS[number];
|
|||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AdminProductsFacade {
|
export class AdminProductsFacade {
|
||||||
private readonly gateway = inject(AdminProductsLocalGateway);
|
private readonly gateway = inject(ADMIN_PRODUCTS_GATEWAY);
|
||||||
private readonly formFactory = inject(AdminProductsFormFactory);
|
private readonly formFactory = inject(AdminProductsFormFactory);
|
||||||
private readonly projectEditor = inject(ProjectEditorFacade);
|
private readonly projectEditor = inject(ProjectEditorFacade);
|
||||||
private readonly localStorage = inject(LocalStorageService);
|
private readonly localStorage = inject(LocalStorageService);
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { InjectionToken, inject } from '@angular/core';
|
||||||
|
import { AdminProductsGateway } from './admin-products-gateway.interface';
|
||||||
|
import { AdminProductsLocalGateway } from './admin-products-local.gateway';
|
||||||
|
|
||||||
|
/** Swap point for a real Products backend - see BACKEND-API-REFERENCE.md §8 (no seam existed before this token). */
|
||||||
|
export const ADMIN_PRODUCTS_GATEWAY = new InjectionToken<AdminProductsGateway>('ADMIN_PRODUCTS_GATEWAY', {
|
||||||
|
providedIn: 'root',
|
||||||
|
factory: () => inject(AdminProductsLocalGateway),
|
||||||
|
});
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Injectable, Signal, computed, effect, inject, signal } from '@angular/core';
|
import { Injectable, Signal, computed, effect, inject, signal } from '@angular/core';
|
||||||
import { AdminOrder } from '../../orders/models/admin-order.model';
|
import { AdminOrder } from '../../orders/models/admin-order.model';
|
||||||
import { AdminOrdersLocalGateway } from '../../orders/services/admin-orders-local.gateway';
|
import { ADMIN_ORDERS_GATEWAY } from '../../orders/services/admin-orders-gateway.token';
|
||||||
import { LocalStorageService } from '../../../../core/storage/local-storage.service';
|
import { LocalStorageService } from '../../../../core/storage/local-storage.service';
|
||||||
import { UserNotificationService } from '../../../website/user-experience/services/user-notification.service';
|
import { UserNotificationService } from '../../../website/user-experience/services/user-notification.service';
|
||||||
import { LanguageService } from '../../../../services/language.service';
|
import { LanguageService } from '../../../../services/language.service';
|
||||||
@@ -19,7 +19,7 @@ const TOAST_DURATION_MS = 4000;
|
|||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AdminOrderWatcherService {
|
export class AdminOrderWatcherService {
|
||||||
private readonly gateway = inject(AdminOrdersLocalGateway);
|
private readonly gateway = inject(ADMIN_ORDERS_GATEWAY);
|
||||||
private readonly storage = inject(LocalStorageService);
|
private readonly storage = inject(LocalStorageService);
|
||||||
private readonly notifications = inject(UserNotificationService);
|
private readonly notifications = inject(UserNotificationService);
|
||||||
private readonly languageService = inject(LanguageService);
|
private readonly languageService = inject(LanguageService);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Injectable, inject, signal } from '@angular/core';
|
import { Injectable, inject, signal } from '@angular/core';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { AdminTransaction, AdminTransactionListFilters } from '../models/admin-transaction.model';
|
import { AdminTransaction, AdminTransactionListFilters } from '../models/admin-transaction.model';
|
||||||
import { AdminTransactionsLocalGateway } from '../services/admin-transactions-local.gateway';
|
import { ADMIN_TRANSACTIONS_GATEWAY } from '../services/admin-transactions-gateway.token';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AdminTransactionsFacade {
|
export class AdminTransactionsFacade {
|
||||||
private readonly gateway = inject(AdminTransactionsLocalGateway);
|
private readonly gateway = inject(ADMIN_TRANSACTIONS_GATEWAY);
|
||||||
|
|
||||||
readonly filters = signal<AdminTransactionListFilters>({ search: '', status: 'all', type: 'all', page: 1, pageSize: 10 });
|
readonly filters = signal<AdminTransactionListFilters>({ search: '', status: 'all', type: 'all', page: 1, pageSize: 10 });
|
||||||
readonly transactions = signal<AdminTransaction[]>([]);
|
readonly transactions = signal<AdminTransaction[]>([]);
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { InjectionToken, inject } from '@angular/core';
|
||||||
|
import { AdminTransactionsGateway } from './admin-transactions-gateway.interface';
|
||||||
|
import { AdminTransactionsLocalGateway } from './admin-transactions-local.gateway';
|
||||||
|
|
||||||
|
/** Swap point for a real Transactions backend - see BACKEND-API-REFERENCE.md §8 (no seam existed before this token). */
|
||||||
|
export const ADMIN_TRANSACTIONS_GATEWAY = new InjectionToken<AdminTransactionsGateway>('ADMIN_TRANSACTIONS_GATEWAY', {
|
||||||
|
providedIn: 'root',
|
||||||
|
factory: () => inject(AdminTransactionsLocalGateway),
|
||||||
|
});
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Injectable, inject, signal } from '@angular/core';
|
import { Injectable, inject, signal } from '@angular/core';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { AdminInvitation, AdminUserRoleRecord, AdminSession, AdminUser, AdminUserAuditEntry, AdminUserScope, AdminUserStatus } from '../models/admin-user.model';
|
import { AdminInvitation, AdminUserRoleRecord, AdminSession, AdminUser, AdminUserAuditEntry, AdminUserScope, AdminUserStatus } from '../models/admin-user.model';
|
||||||
import { AdminUsersLocalGateway } from '../services/admin-users-local.gateway';
|
import { ADMIN_USERS_GATEWAY } from '../services/admin-users-gateway.token';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class AdminUsersFacade {
|
export class AdminUsersFacade {
|
||||||
private readonly gateway = inject(AdminUsersLocalGateway);
|
private readonly gateway = inject(ADMIN_USERS_GATEWAY);
|
||||||
|
|
||||||
readonly users = signal<AdminUser[]>([]);
|
readonly users = signal<AdminUser[]>([]);
|
||||||
readonly roles = signal<AdminUserRoleRecord[]>([]);
|
readonly roles = signal<AdminUserRoleRecord[]>([]);
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { InjectionToken, inject } from '@angular/core';
|
||||||
|
import { AdminUsersGateway } from './admin-users-gateway.interface';
|
||||||
|
import { AdminUsersLocalGateway } from './admin-users-local.gateway';
|
||||||
|
|
||||||
|
/** Swap point for a real Users backend - see BACKEND-API-REFERENCE.md §8 (no seam existed before this token). */
|
||||||
|
export const ADMIN_USERS_GATEWAY = new InjectionToken<AdminUsersGateway>('ADMIN_USERS_GATEWAY', {
|
||||||
|
providedIn: 'root',
|
||||||
|
factory: () => inject(AdminUsersLocalGateway),
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user