feat(cms): Partners + Media collection MVP (MITHOME-89)
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
Payload built-in upload collection (Media) + a Partners collection (name, url, logo -> Media relationship) mirroring home.json's partners.items. Scope decision (see Plane MITHOME-89/118): the old logo editor (crop/rotate/transparent-background — MITHOME-76/84) is entirely client-side canvas logic (scripts/cms-logo-client.js, 345 lines), not server-side processing. Porting that UX into the Payload admin is a real custom React field component, split into its own ticket (MITHOME-118) rather than bundled here. This ticket covers plain upload only. - src/collections/Media.ts, src/collections/Partners.ts, registered in payload.config.ts. - migrate-content-to-payload.ts: upsertPartner() uploads the existing processed logo file (filePath) into Media (idempotent — matched by `alt` == partner name) and upserts the Partner document (matched by `name`). - .gitignore: Payload's default local upload storage lands at proto/media/ (not proto/public/) — runtime data, not source, needs a persistent volume in staging/production (flagged for MITHOME-97). Also ignored the generated src/payload-types.ts. Verified: migration run twice against the real dev MongoDB produced exactly 1 Media doc + 1 Partner doc (no duplicates, confirmed via mongosh) with the correct file size (12289 bytes, matching the source PNG). Real browser: logged into /admin, Partners list shows the migrated entry, and the document editor renders the logo thumbnail (270x80, 12KB) correctly. build/lint/tsc/test (58 passed) all clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
928439bc7b
commit
776fa66bc8
@@ -0,0 +1,33 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
/**
|
||||
* MITHOME-89 (MVP scope) — Payload beépített upload collection.
|
||||
*
|
||||
* WHY nincs saját `staticDir` a `proto/public/`-ba mutatva: a fájlokat a
|
||||
* Payload a saját REST route-jain (src/app/(payload)/api/[...slug]/route.ts)
|
||||
* szolgálja ki, nem közvetlen statikus mappából — így nem ütközik a régi
|
||||
* content-editor.js-féle /public/partners/*.png fájlokkal, amik MITHOME-93
|
||||
* leépítéséig még élnek.
|
||||
*
|
||||
* A tényleges vágás/forgatás/áttetszővé tétel szerkesztő NEM ide tartozik —
|
||||
* lásd MITHOME-118 (külön, egyedi admin field component).
|
||||
*/
|
||||
export const Media: CollectionConfig = {
|
||||
slug: 'media',
|
||||
admin: {
|
||||
group: 'Média',
|
||||
},
|
||||
upload: {
|
||||
mimeTypes: ['image/*'],
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'alt',
|
||||
type: 'text',
|
||||
required: true,
|
||||
admin: {
|
||||
description: 'Alternatív szöveg (accessibility) — pl. "Angele Pihenőház logó".',
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
/**
|
||||
* Mirrors home.json `partners.items` (proto/src/content/pages/home.json) —
|
||||
* MITHOME-89 (MVP). Korábban a Home Global szándékosan NEM tartalmazta ezt
|
||||
* a listát (lásd src/globals/Home.ts megjegyzése) — itt lesz az önálló
|
||||
* collection, logo = Media upload reference.
|
||||
*/
|
||||
export const Partners: CollectionConfig = {
|
||||
slug: 'partners',
|
||||
admin: {
|
||||
useAsTitle: 'name',
|
||||
group: 'Oldalak',
|
||||
},
|
||||
fields: [
|
||||
{ name: 'name', type: 'text', required: true },
|
||||
{ name: 'url', type: 'text', required: true },
|
||||
{
|
||||
name: 'logo',
|
||||
type: 'upload',
|
||||
relationTo: 'media',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -8,7 +8,9 @@
|
||||
* MITHOME-87: Home/About/Services/Contact/Common Globals hozzáadva — ezek
|
||||
* tükrözik a proto/src/content/pages/*.json + common.json struktúráját.
|
||||
* MITHOME-88: LegalPages collection hozzáadva (adatvedelem, hasznalati-
|
||||
* feltetelek). A Partners/Media collectionök a MITHOME-89-ben kerülnek be.
|
||||
* feltetelek).
|
||||
* MITHOME-89: Partners + Media collection (MVP — feltöltés, a vágás/
|
||||
* áttetszővé tétel szerkesztő külön, MITHOME-118).
|
||||
*/
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
@@ -19,6 +21,8 @@ import sharp from 'sharp'
|
||||
|
||||
import { Users } from './collections/Users'
|
||||
import { LegalPages } from './collections/LegalPages'
|
||||
import { Media } from './collections/Media'
|
||||
import { Partners } from './collections/Partners'
|
||||
import { Home } from './globals/Home'
|
||||
import { About } from './globals/About'
|
||||
import { Services } from './globals/Services'
|
||||
@@ -37,7 +41,7 @@ export default buildConfig({
|
||||
|
||||
editor: lexicalEditor(),
|
||||
|
||||
collections: [Users, LegalPages],
|
||||
collections: [Users, LegalPages, Media, Partners],
|
||||
|
||||
globals: [Home, About, Services, Contact, Common],
|
||||
|
||||
|
||||
Reference in New Issue
Block a user