- Created setup-directus-collections.js to automate the creation of tech stack collections, fields, and relations in Directus. - Created setup-directus-hobbies.js for setting up hobbies collection with translations. - Created setup-directus-projects.js for establishing projects collection with comprehensive fields and translations. - Added setup-tech-stack-directus.js to populate tech_stack_items with predefined data.
119 lines
3.6 KiB
Markdown
119 lines
3.6 KiB
Markdown
# Directus Integration Status
|
|
|
|
## ✅ Vollständig integriert
|
|
|
|
### Tech Stack
|
|
- **Collection**: `tech_stack_categories` + `tech_stack_items` ✅
|
|
- **Data Migration**: 4 Kategorien, ~16 Items (EN + DE) ✅
|
|
- **API**: `/api/tech-stack` ✅
|
|
- **Component**: `About.tsx` lädt aus Directus mit Fallback ✅
|
|
- **Status**: ✅ **PRODUCTION READY**
|
|
|
|
### Hobbies
|
|
- **Collection**: `hobbies` ✅
|
|
- **Data Migration**: 4 Hobbies (EN + DE) ✅
|
|
- **API**: `/api/hobbies` ✅
|
|
- **Component**: `About.tsx` lädt aus Directus mit Fallback ✅
|
|
- **Status**: ✅ **PRODUCTION READY**
|
|
|
|
### Content Pages
|
|
- **Collection**: Bereits existierend ✅
|
|
- **Data**: Home-About Page ✅
|
|
- **API**: `/api/content/page` ✅
|
|
- **Component**: `About.tsx` lädt aus Directus ✅
|
|
- **Status**: ✅ **PRODUCTION READY**
|
|
|
|
---
|
|
|
|
## ⚠️ Teilweise integriert
|
|
|
|
### Projects
|
|
- **Collection**: `projects` ✅ (30+ Felder mit Translations)
|
|
- **Data Migration**: Script vorhanden, PostgreSQL benötigt ⚠️
|
|
- **API**: `/api/projects` mit **Hybrid-System** ✅
|
|
- Primär: PostgreSQL (wenn verfügbar)
|
|
- Fallback: Directus (wenn PostgreSQL offline)
|
|
- Response enthält `source` field (`postgresql`, `directus`, `directus-empty`, `error`)
|
|
- **Components**: Verwenden weiterhin `/api/projects` ✅
|
|
- `Projects.tsx`
|
|
- `ProjectsPageClient.tsx`
|
|
- `ProjectCard.tsx`
|
|
- Admin: `ProjectManager.tsx`
|
|
- **Status**: ⚠️ **HYBRID MODE** - Funktioniert mit beiden Datenquellen
|
|
|
|
**Migration durchführen:**
|
|
```bash
|
|
# 1. PostgreSQL starten
|
|
docker-compose up -d postgres
|
|
|
|
# 2. Migration ausführen
|
|
node scripts/migrate-projects-to-directus.js
|
|
|
|
# 3. Optional: PostgreSQL deaktivieren
|
|
# → /api/projects nutzt automatisch Directus
|
|
```
|
|
|
|
---
|
|
|
|
## 📊 Verwendung nach Quelle
|
|
|
|
| Content | Source | Load Location |
|
|
|---------|--------|---------------|
|
|
| Tech Stack | Directus | `About.tsx` via `/api/tech-stack` |
|
|
| Hobbies | Directus | `About.tsx` via `/api/hobbies` |
|
|
| Projects | PostgreSQL → Directus Fallback | `Projects.tsx` via `/api/projects` |
|
|
| Content Pages | Directus | `About.tsx` via `/api/content/page` |
|
|
| Messages/i18n | `messages/*.json` | next-intl loader |
|
|
| Analytics | PostgreSQL | Admin Dashboard |
|
|
| Users/Auth | PostgreSQL | Admin System |
|
|
|
|
---
|
|
|
|
## 🔄 Hybrid System für Projects
|
|
|
|
Die `/api/projects` Route nutzt ein intelligentes Fallback-System:
|
|
|
|
1. **PostgreSQL prüfen** via `prisma.$queryRaw`
|
|
2. **Bei Erfolg**: Daten aus PostgreSQL laden (`source: 'postgresql'`)
|
|
3. **Bei Fehler**: Automatisch zu Directus wechseln (`source: 'directus'`)
|
|
4. **Bei beiden offline**: Error Response (`source: 'error'`, Status 503)
|
|
|
|
**Vorteile:**
|
|
- ✅ Zero Downtime bei DB-Migration
|
|
- ✅ Lokale Entwicklung ohne PostgreSQL möglich
|
|
- ✅ Bestehende Components funktionieren unverändert
|
|
- ✅ Graduelle Migration möglich
|
|
|
|
---
|
|
|
|
## 🎯 Nächste Schritte
|
|
|
|
### Option 1: Vollständige Directus-Migration
|
|
```bash
|
|
# Projects nach Directus migrieren
|
|
node scripts/migrate-projects-to-directus.js
|
|
|
|
# PostgreSQL optional deaktivieren
|
|
# → /api/projects nutzt automatisch Directus
|
|
```
|
|
|
|
### Option 2: Hybrid-Betrieb
|
|
```bash
|
|
# Nichts tun - System funktioniert bereits!
|
|
# PostgreSQL = Primary, Directus = Fallback
|
|
```
|
|
|
|
---
|
|
|
|
## 📝 Zusammenfassung
|
|
|
|
| Status | Count | Components |
|
|
|--------|-------|------------|
|
|
| ✅ Vollständig in Directus | 3 | Tech Stack, Hobbies, Content Pages |
|
|
| ⚠️ Hybrid (PostgreSQL + Directus) | 1 | Projects |
|
|
| ❌ Noch in JSON | 1 | Messages (next-intl) |
|
|
|
|
**Ergebnis**: Fast alle User-sichtbaren Inhalte sind bereits über Directus editierbar! 🎉
|
|
|
|
**Einzige Ausnahme**: System-Messages (`messages/en.json`, `messages/de.json`) für UI-Texte wie Buttons, Labels, etc.
|