- Renamed `domain/` to `business/` to better reflect the organization of code by business logic. - Updated all relevant file paths and references throughout the project to align with the new structure. - Ensured that all models and services are now located under the `business/` directory, maintaining existing functionality while improving clarity.
243 lines
7.8 KiB
Markdown
243 lines
7.8 KiB
Markdown
# PHASE 6: SITE INTEGRATION & MULTI-DESTINATION PUBLISHING
|
|
**Detailed Implementation Plan**
|
|
|
|
**Goal**: Support multiple publishing destinations (WordPress, Sites, Shopify).
|
|
|
|
**Timeline**: 2-3 weeks
|
|
**Priority**: MEDIUM
|
|
**Dependencies**: Phase 5
|
|
|
|
---
|
|
|
|
## TABLE OF CONTENTS
|
|
|
|
1. [Overview](#overview)
|
|
2. [Site Integration Models](#site-integration-models)
|
|
3. [Integration Service](#integration-service)
|
|
4. [Publishing Adapters](#publishing-adapters)
|
|
5. [Multi-Destination Publishing](#multi-destination-publishing)
|
|
6. [Site Model Extensions](#site-model-extensions)
|
|
7. [Integration API](#integration-api)
|
|
8. [Integration UI](#integration-ui)
|
|
9. [Publishing Settings UI](#publishing-settings-ui)
|
|
10. [Site Management UI](#site-management-ui)
|
|
11. [Testing & Validation](#testing--validation)
|
|
12. [Implementation Checklist](#implementation-checklist)
|
|
|
|
---
|
|
|
|
## OVERVIEW
|
|
|
|
### Objectives
|
|
- ✅ Support multiple site integrations per site
|
|
- ✅ Multi-destination publishing (WordPress, Sites, Shopify)
|
|
- ✅ Two-way sync with external platforms
|
|
- ✅ Site management UI (CMS)
|
|
- ✅ Publishing settings UI
|
|
|
|
### Key Principles
|
|
- **Multiple Integrations**: One site can have multiple integrations
|
|
- **Adapter Pattern**: Platform-specific adapters for publishing
|
|
- **Two-Way Sync**: Sync content both ways
|
|
- **User-Friendly**: "Site Manager" or "Content Manager" in UI
|
|
|
|
---
|
|
|
|
## SITE INTEGRATION MODELS
|
|
|
|
### 6.1 Site Integration Models
|
|
|
|
| Task | File | Dependencies | Implementation |
|
|
|------|------|--------------|----------------|
|
|
| **SiteIntegration Model** | `business/integration/models.py` | Phase 1 | Store integration configs |
|
|
|
|
**SiteIntegration Model**:
|
|
```python
|
|
# business/integration/models.py
|
|
class SiteIntegration(SiteSectorBaseModel):
|
|
site = models.ForeignKey(Site, on_delete=models.CASCADE)
|
|
platform = models.CharField(max_length=50) # 'wordpress', 'shopify', 'custom'
|
|
platform_type = models.CharField(max_length=50) # 'cms', 'ecommerce', 'custom_api'
|
|
config_json = models.JSONField(default=dict)
|
|
credentials = models.EncryptedField() # Encrypted API keys
|
|
is_active = models.BooleanField(default=True)
|
|
sync_enabled = models.BooleanField(default=False)
|
|
last_sync_at = models.DateTimeField(null=True, blank=True)
|
|
sync_status = models.CharField(max_length=20) # 'success', 'failed', 'pending'
|
|
```
|
|
|
|
---
|
|
|
|
## INTEGRATION SERVICE
|
|
|
|
### 6.2 Integration Service
|
|
|
|
| Task | File | Dependencies | Implementation |
|
|
|------|------|--------------|----------------|
|
|
| **IntegrationService** | `business/integration/services/integration_service.py` | Phase 1 | Manage integrations |
|
|
| **SyncService** | `business/integration/services/sync_service.py` | Phase 1 | Handle two-way sync |
|
|
|
|
---
|
|
|
|
## PUBLISHING ADAPTERS
|
|
|
|
### 6.3 Publishing Adapters
|
|
|
|
| Task | File | Dependencies | Implementation |
|
|
|------|------|--------------|----------------|
|
|
| **BaseAdapter** | `business/publishing/services/adapters/base_adapter.py` | Phase 5 | Base adapter interface |
|
|
| **WordPressAdapter** | `business/publishing/services/adapters/wordpress_adapter.py` | EXISTING (refactor) | WordPress publishing |
|
|
| **SitesRendererAdapter** | `business/publishing/services/adapters/sites_renderer_adapter.py` | Phase 5 | IGNY8 Sites deployment |
|
|
| **ShopifyAdapter** | `business/publishing/services/adapters/shopify_adapter.py` | Phase 5 (future) | Shopify publishing |
|
|
|
|
---
|
|
|
|
## MULTI-DESTINATION PUBLISHING
|
|
|
|
### 6.4 Multi-Destination Publishing
|
|
|
|
| Task | File | Dependencies | Implementation |
|
|
|------|------|--------------|----------------|
|
|
| **Extend PublisherService** | `business/publishing/services/publisher_service.py` | Phase 5 | Support multiple destinations |
|
|
| **Update PublishingRecord** | `business/publishing/models.py` | Phase 5 | Track multiple destinations |
|
|
|
|
**Multi-Destination Publishing**:
|
|
```python
|
|
# business/publishing/services/publisher_service.py
|
|
class PublisherService:
|
|
def publish(self, content, destinations):
|
|
"""Publish content to multiple destinations"""
|
|
results = []
|
|
for destination in destinations:
|
|
adapter = self.get_adapter(destination)
|
|
result = adapter.publish(content)
|
|
results.append(result)
|
|
return results
|
|
```
|
|
|
|
---
|
|
|
|
## SITE MODEL EXTENSIONS
|
|
|
|
### 6.5 Site Model Extensions
|
|
|
|
| Task | File | Dependencies | Implementation |
|
|
|------|------|--------------|----------------|
|
|
| **Add site_type field** | `core/auth/models.py` | None | Track site type |
|
|
| **Add hosting_type field** | `core/auth/models.py` | None | Track hosting type |
|
|
| **Add integrations relationship** | `core/auth/models.py` | Phase 6.1 | Link to SiteIntegration |
|
|
|
|
---
|
|
|
|
## INTEGRATION API
|
|
|
|
### 6.6 Integration API
|
|
|
|
| Task | File | Dependencies | Implementation |
|
|
|------|------|--------------|----------------|
|
|
| **Integration ViewSet** | `modules/integration/views.py` | IntegrationService | CRUD for integrations |
|
|
| **Integration URLs** | `modules/integration/urls.py` | None | Register integration routes |
|
|
|
|
---
|
|
|
|
## INTEGRATION UI
|
|
|
|
### 6.7 Integration UI (Update Existing)
|
|
|
|
| Task | File | Dependencies | Implementation |
|
|
|------|------|--------------|----------------|
|
|
| **Update Integration Settings** | `frontend/src/pages/Settings/Integration.tsx` | EXISTING (update) | Add SiteIntegration support |
|
|
| **Multi-Platform Support** | `frontend/src/components/integration/PlatformSelector.tsx` | NEW | Platform selector |
|
|
| **Integration Status** | `frontend/src/components/integration/IntegrationStatus.tsx` | NEW | Show integration status |
|
|
|
|
---
|
|
|
|
## PUBLISHING SETTINGS UI
|
|
|
|
### 6.8 Publishing Settings UI
|
|
|
|
| Task | File | Dependencies | Implementation |
|
|
|------|------|--------------|----------------|
|
|
| **Publishing Settings Page** | `frontend/src/pages/Settings/Publishing.tsx` | NEW | Publishing configuration |
|
|
| **Destination Management** | `frontend/src/pages/Settings/Publishing.tsx` | Phase 6 | Manage publishing destinations |
|
|
| **Publishing Rules** | `frontend/src/components/publishing/PublishingRules.tsx` | NEW | Publishing rules configuration |
|
|
|
|
---
|
|
|
|
## SITE MANAGEMENT UI
|
|
|
|
### 6.9 Individual Site Management (CMS)
|
|
|
|
**User-Friendly Name**: "Site Manager" or "Content Manager"
|
|
|
|
| Task | File | Dependencies | Implementation |
|
|
|------|------|--------------|----------------|
|
|
| **Site Management Dashboard** | `frontend/src/pages/Sites/Manage.tsx` | NEW | Site management overview |
|
|
| **Site Content Editor** | `frontend/src/pages/Sites/Editor.tsx` | NEW | Edit site content |
|
|
| **Post Editor** | `frontend/src/pages/Sites/PostEditor.tsx` | NEW | Edit posts |
|
|
| **Page Manager** | `frontend/src/pages/Sites/PageManager.tsx` | NEW | Manage pages |
|
|
| **Site Settings** | `frontend/src/pages/Sites/Settings.tsx` | NEW | Site settings |
|
|
|
|
**Site Management Features**:
|
|
- View all pages/posts for a site
|
|
- Add new pages
|
|
- Remove pages
|
|
- Edit page content
|
|
- Manage page order
|
|
- Change page templates
|
|
- Update site settings
|
|
- Preview site
|
|
|
|
---
|
|
|
|
## TESTING & VALIDATION
|
|
|
|
### 6.9 Testing
|
|
|
|
**Test Cases**:
|
|
- ✅ Site integrations work correctly
|
|
- ✅ Multi-destination publishing works
|
|
- ✅ WordPress sync works (when plugin connected)
|
|
- ✅ Two-way sync functions properly
|
|
- ✅ Site management UI works
|
|
|
|
---
|
|
|
|
## IMPLEMENTATION CHECKLIST
|
|
|
|
### Backend Tasks
|
|
|
|
- [ ] Create SiteIntegration model
|
|
- [ ] Create IntegrationService
|
|
- [ ] Create SyncService
|
|
- [ ] Create BaseAdapter
|
|
- [ ] Refactor WordPressAdapter
|
|
- [ ] Create SitesRendererAdapter
|
|
- [ ] Extend PublisherService for multi-destination
|
|
- [ ] Extend Site model
|
|
- [ ] Create Integration ViewSet
|
|
|
|
### Frontend Tasks
|
|
|
|
- [ ] Update Integration Settings page
|
|
- [ ] Create Publishing Settings page
|
|
- [ ] Create Site Management Dashboard
|
|
- [ ] Create Site Content Editor
|
|
- [ ] Create Page Manager
|
|
- [ ] Create Site Settings page
|
|
|
|
---
|
|
|
|
## SUCCESS CRITERIA
|
|
|
|
- ✅ Site integrations work correctly
|
|
- ✅ Multi-destination publishing works
|
|
- ✅ WordPress sync works
|
|
- ✅ Two-way sync functions properly
|
|
- ✅ Site management UI works
|
|
|
|
---
|
|
|
|
**END OF PHASE 6 DOCUMENT**
|
|
|