cms.c2sgmbh/docs/PROMPT_PHASE1_COLLECTIONS.md
Martin Porwoll a88e4f60d0 test: add E2E and integration tests with documentation
Tests:
- Update frontend.e2e.spec.ts with locale testing
- Add search.e2e.spec.ts for search functionality
- Add i18n.int.spec.ts for localization tests
- Add search.int.spec.ts for search integration
- Update playwright.config.ts

Documentation:
- Add CLAUDE.md with project instructions
- Add docs/ directory with detailed documentation
- Add scripts/ for utility scripts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 08:19:52 +00:00

182 lines
4.4 KiB
Markdown

# Phase 1: Payload CMS Collections für porwoll.de
## Kontext
Du arbeitest im Verzeichnis `/home/payload/payload-cms`. Dies ist ein Payload CMS 3.x Projekt mit Multi-Tenant-Support. Der Tenant "porwoll" (ID: 1) existiert bereits.
Lies zuerst die CLAUDE.md für Projektkontext.
## Aufgabe
Erstelle die Collections und Globals für die Website porwoll.de. Die Website ist eine persönliche/berufliche Präsenz mit Blog.
## Zu erstellende Dateien
### 1. Collection: Pages (`src/collections/Pages.ts`)
Für statische Seiten wie Startseite, Mensch, Leben, etc.
```typescript
Felder:
- title: text, required
- slug: text, required, unique
- hero: group
- image: upload (Media)
- headline: text
- subline: textarea
- content: richText (Lexical)
- seo: group
- metaTitle: text
- metaDescription: textarea
- ogImage: upload (Media)
- status: select (draft, published), default: draft
- publishedAt: date
Admin:
- useAsTitle: 'title'
- defaultColumns: ['title', 'slug', 'status', 'updatedAt']
```
### 2. Collection: Posts (`src/collections/Posts.ts`)
Für Blog-Artikel.
```typescript
Felder:
- title: text, required
- slug: text, required, unique
- excerpt: textarea, maxLength 300
- content: richText (Lexical)
- featuredImage: upload (Media)
- category: relationship Categories
- author: relationship Users
- publishedAt: date
- status: select (draft, published), default: draft
Admin:
- useAsTitle: 'title'
- defaultColumns: ['title', 'category', 'status', 'publishedAt']
```
### 3. Collection: Categories (`src/collections/Categories.ts`)
Blog-Kategorien.
```typescript
Felder:
- name: text, required
- slug: text, required, unique
- description: textarea
Admin:
- useAsTitle: 'name'
```
### 4. Collection: SocialLinks (`src/collections/SocialLinks.ts`)
Social Media Verlinkungen.
```typescript
Felder:
- platform: select (facebook, x, instagram, youtube, linkedin, xing), required
- url: text, required
- isActive: checkbox, default: true
Admin:
- useAsTitle: 'platform'
```
### 5. Global: SiteSettings (`src/globals/SiteSettings.ts`)
Globale Website-Einstellungen.
```typescript
Felder:
- siteName: text, default: 'porwoll.de'
- siteTagline: text
- logo: upload (Media)
- favicon: upload (Media)
- contact: group
- email: email
- phone: text
- address: textarea
- footer: group
- copyrightText: text
- showSocialLinks: checkbox, default: true
- seo: group
- defaultMetaTitle: text
- defaultMetaDescription: textarea
- defaultOgImage: upload (Media)
```
### 6. Global: Navigation (`src/globals/Navigation.ts`)
Hauptnavigation der Website.
```typescript
Felder:
- mainMenu: array
- label: text, required
- type: select (page, custom, submenu)
- page: relationship Pages (wenn type = page)
- url: text (wenn type = custom)
- openInNewTab: checkbox
- submenu: array (wenn type = submenu)
- label: text
- page: relationship Pages
- url: text
- footerMenu: array
- label: text
- page: relationship Pages
- url: text
```
## Umsetzungsschritte
1. Erstelle den Ordner `src/globals/` falls nicht vorhanden
2. Erstelle alle Collection-Dateien in `src/collections/`
3. Erstelle alle Global-Dateien in `src/globals/`
4. Aktualisiere `src/payload.config.ts`:
- Importiere alle neuen Collections
- Füge sie zum `collections` Array hinzu
- Importiere alle Globals
- Füge `globals: [SiteSettings, Navigation]` hinzu
5. Führe aus: `pnpm payload generate:types`
6. Führe aus: `pnpm payload migrate:create`
7. Führe aus: `pnpm payload migrate`
8. Führe aus: `pnpm build`
9. Starte neu: `pm2 restart payload`
## Wichtige Hinweise
- Alle Collections müssen Multi-Tenant-fähig sein (werden automatisch durch das Plugin gefiltert)
- Verwende den Lexical Editor für Rich Text: `import { lexicalEditor } from '@payloadcms/richtext-lexical'`
- Prüfe nach jedem Schritt auf TypeScript-Fehler
- Die Media Collection existiert bereits - nutze sie für alle Uploads
- Halte dich an Payload 3.x Syntax (nicht 2.x)
## Erfolgskriterien
Nach Abschluss sollten im Admin Panel unter https://pl.c2sgmbh.de/admin folgende Einträge sichtbar sein:
Collections:
- Users (existiert)
- Media (existiert)
- Tenants (existiert)
- Pages (neu)
- Posts (neu)
- Categories (neu)
- SocialLinks (neu)
Globals:
- Site Settings (neu)
- Navigation (neu)
## Bei Fehlern
- Lies die Fehlermeldung genau
- Prüfe die Payload 3.x Dokumentation
- Stelle sicher, dass alle Imports korrekt sind
- Prüfe TypeScript-Kompatibilität mit `pnpm tsc --noEmit`