feat(cms): hosting plans page with lifecycle gate and net + VAT prices (MITHOME-130)
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s

- Products collection (interim mirror of the PLATFM-14 catalogue contract):
  lifecycle status, product type, required whole-forint net price, yearly
  billing, service definition, per-product English gate
- HostingPlans global: page copy, comparison labels, VAT rate (27%)
- Gate: production shows only active plans, staging all but retired; with no
  showable plan the page is 404 and left out of the menu and the sitemap
- /hu/tarhely-csomagok <-> /en/hosting-plans via PAGE_SLUGS (hreflang,
  language switcher, CTA page picker)
- Seed migration 20260929_hosting_plans: mIT Start (14 900 Ft/yr, 5 mailboxes)
  and mIT Mid (23 900 Ft/yr) as drafts, English AI draft; idempotent
- Production SEO suite expects at least 12 sitemap URLs; new SMOKE-10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Do Siki
2026-09-29 19:36:44 +02:00
co-authored by Claude Opus 5.5
parent 0c5888761b
commit 1e0742a548
26 changed files with 1114 additions and 32 deletions
+124
View File
@@ -0,0 +1,124 @@
import type { CollectionConfig, NumberFieldSingleValidation } from 'payload'
import { collectionVersions } from '../lib/payload-versions'
import {
BILLING_PERIOD_LABELS,
BILLING_PERIODS,
PRODUCT_STATUS_LABELS,
PRODUCT_STATUSES,
PRODUCT_TYPE_LABELS,
PRODUCT_TYPES,
} from '../lib/products'
import { stringArrayField } from '../globals/fields/stringArray'
import { translationStatusField } from '../globals/fields/translationStatus'
const wholeForints: NumberFieldSingleValidation = (value) =>
value === null || value === undefined || (Number.isInteger(value) && value >= 0) || 'Egész, nem negatív forintösszeget adj meg.'
const count = (name: string, label: string) => ({ name, label, type: 'number' as const, min: 0 })
/**
* MITHOME-130: hosting (and later managed-service) products.
*
* Interim mirror of the central product catalogue (mitplatform PLATFM-14,
* docs/architecture/product-catalog-contract.md) — same structure, so the
* data source can be swapped later. Prices and service figures come from
* the catalogue; change them there first.
*
* WHY two statuses: Payload's own `_status` (draft/published) only decides
* which version of the record is saved; `status` is the product lifecycle
* and decides where the product is shown (src/lib/products.ts).
* Internal operations data (runbooks, owners, costs) never goes here.
*/
export const Products: CollectionConfig = {
slug: 'products',
labels: { singular: 'Termék', plural: 'Termékek' },
admin: {
useAsTitle: 'name',
group: 'Oldalak',
defaultColumns: ['name', 'productType', 'status', 'sortOrder'],
},
versions: collectionVersions,
fields: [
{ name: 'name', label: 'Név', type: 'text', required: true, admin: { description: 'Márkanév, minden nyelven azonos (pl. „mIT Start”).' } },
{
name: 'slug',
label: 'Azonosító',
type: 'text',
required: true,
unique: true,
admin: { position: 'sidebar', description: 'Stabil azonosító a központi katalógusból (pl. mit-start). Ne változtasd.' },
},
{
name: 'productType',
label: 'Terméktípus',
type: 'select',
required: true,
defaultValue: 'hosting',
options: PRODUCT_TYPES.map((value) => ({ label: PRODUCT_TYPE_LABELS[value], value })),
admin: { position: 'sidebar' },
},
{
name: 'status',
label: 'Életciklus-állapot',
type: 'select',
required: true,
defaultValue: 'draft',
options: PRODUCT_STATUSES.map((value) => ({ label: PRODUCT_STATUS_LABELS[value], value })),
admin: {
position: 'sidebar',
description:
'Az éles oldalon csak az „Aktív” termék jelenik meg; a staging a „Kivezetett” kivételével mindent mutat. ' +
'Aktívra csak üzleti jóváhagyás és a név védjegyvizsgálata után állítsd.',
},
},
{ name: 'sortOrder', label: 'Sorrend', type: 'number', defaultValue: 0, admin: { position: 'sidebar' } },
{ name: 'highlighted', label: 'Ajánlott csomag', type: 'checkbox', defaultValue: false, admin: { position: 'sidebar' } },
{
name: 'public',
label: 'Publikus szövegek',
type: 'group',
fields: [
{ name: 'audience', label: 'Kinek szól', type: 'text', required: true, localized: true },
{ name: 'shortDescription', label: 'Rövid leírás', type: 'textarea', required: true, localized: true },
stringArrayField('features', 'Kiemelt jellemzők', { localized: true }),
{ name: 'ctaText', label: 'Gomb felirata', type: 'text', required: true, localized: true },
{ name: 'seoDescription', label: 'SEO-leírás', type: 'textarea', localized: true },
],
},
{
name: 'pricing',
label: 'Ár',
type: 'group',
admin: { description: 'Nettó ár; a bruttót az oldal számolja az ÁFA-kulcsból (Tárhelycsomagok oldal beállítása).' },
fields: [
{ name: 'netAmount', label: 'Nettó ár (Ft)', type: 'number', required: true, min: 0, validate: wholeForints },
{
name: 'billingPeriod',
label: 'Számlázási periódus',
type: 'select',
required: true,
defaultValue: 'yearly',
options: BILLING_PERIODS.map((value) => ({ label: BILLING_PERIOD_LABELS[value], value })),
},
],
},
{
name: 'serviceDefinition',
label: 'Szolgáltatás',
type: 'group',
fields: [
count('storageGb', 'Tárhely összesen (GB)'),
count('mailStorageGb', 'Ebből levelezés (GB)'),
count('domains', 'Domain'),
count('domainAliases', 'Domain-alias'),
count('databases', 'Adatbázis'),
count('mailboxes', 'E-mail-fiók (legfeljebb)'),
{ name: 'backup', label: 'Mentés', type: 'text', localized: true },
{ name: 'ssl', label: 'SSL-tanúsítvány', type: 'checkbox', defaultValue: false },
{ name: 'spamFilter', label: 'Spamszűrés', type: 'checkbox', defaultValue: false },
],
},
translationStatusField(),
],
}