Refactor domain structure to business layer

- 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.
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-16 21:47:51 +00:00
parent cb0e42bb8d
commit 455358ecfc
11 changed files with 281 additions and 281 deletions

View File

@@ -27,7 +27,7 @@
| Principle | Description | Implementation |
|-----------|-------------|----------------|
| **Domain-Driven Design** | Organize by business domains, not technical layers | `domain/` folder with content, planning, linking, optimization, publishing domains |
| **Domain-Driven Design** | Organize by business domains, not technical layers | `business/` folder with content, planning, linking, optimization, publishing domains |
| **Service Layer Pattern** | Business logic in services, not ViewSets | All modules delegate to domain services |
| **Single Responsibility** | Each layer has one clear purpose | Core → Domain → Module → Infrastructure |
| **No Duplication** | Reuse services across modules | ContentGenerationService used by Writer + Site Builder |
@@ -108,7 +108,7 @@ backend/igny8_core/
│ ├── permissions.py # IsAuthenticatedAndActive, HasTenantAccess
│ └── throttles.py # DebugScopedRateThrottle
├── domain/ # DOMAIN LAYER (Business Logic)
├── business/ # BUSINESS LAYER (Business Logic)
│ ├── content/ # Content domain
│ │ ├── models.py # Content, Tasks, Images (unified, extended)
│ │ ├── services/
@@ -248,20 +248,20 @@ backend/igny8_core/
| Model | Current Location | New Location | Extensions Needed |
|-------|------------------|-------------|-------------------|
| `Content` | `modules/writer/models.py` | `domain/content/models.py` | Add: `entity_type`, `json_blocks`, `structure_data`, `linker_version`, `optimizer_version`, `internal_links`, `optimization_scores`, `published_to`, `external_ids`, `source`, `sync_status`, `external_id`, `external_url`, `sync_metadata` |
| `Tasks` | `modules/writer/models.py` | `domain/content/models.py` | Add: `entity_type` choices (product, service, taxonomy, etc.) |
| `Keywords` | `modules/planner/models.py` | `domain/planning/models.py` | No changes |
| `Clusters` | `modules/planner/models.py` | `domain/planning/models.py` | No changes |
| `ContentIdeas` | `modules/planner/models.py` | `domain/planning/models.py` | Add: `entity_type` support |
| `InternalLinks` | - | `domain/linking/models.py` | NEW: `source_id`, `target_id`, `anchor`, `position`, `link_type` |
| `OptimizationTask` | - | `domain/optimization/models.py` | NEW: `content_id`, `type`, `target_keyword`, `scores_before`, `scores_after`, `html_before`, `html_after` |
| `SiteBlueprint` | - | `domain/site_building/models.py` | NEW: `tenant`, `site`, `config_json`, `structure_json`, `status`, `hosting_type` |
| `PageBlueprint` | - | `domain/site_building/models.py` | NEW: `site_blueprint`, `slug`, `type`, `blocks_json`, `status` |
| `SiteIntegration` | - | `domain/integration/models.py` | NEW: `site`, `platform`, `platform_type`, `config_json`, `credentials`, `is_active`, `sync_enabled` |
| `PublishingRecord` | - | `domain/publishing/models.py` | NEW: `content_id`, `destination`, `destination_type`, `status`, `external_id`, `published_at`, `sync_status` |
| `DeploymentRecord` | - | `domain/publishing/models.py` | NEW: `site_blueprint`, `version`, `status`, `build_url`, `deployed_at`, `deployment_type` |
| `AutomationRule` | - | `domain/automation/models.py` | NEW: `name`, `trigger`, `conditions`, `actions`, `schedule`, `is_active` |
| `ScheduledTask` | - | `domain/automation/models.py` | NEW: `automation_rule`, `scheduled_at`, `status`, `executed_at` |
| `Content` | `modules/writer/models.py` | `business/content/models.py` | Add: `entity_type`, `json_blocks`, `structure_data`, `linker_version`, `optimizer_version`, `internal_links`, `optimization_scores`, `published_to`, `external_ids`, `source`, `sync_status`, `external_id`, `external_url`, `sync_metadata` |
| `Tasks` | `modules/writer/models.py` | `business/content/models.py` | Add: `entity_type` choices (product, service, taxonomy, etc.) |
| `Keywords` | `modules/planner/models.py` | `business/planning/models.py` | No changes |
| `Clusters` | `modules/planner/models.py` | `business/planning/models.py` | No changes |
| `ContentIdeas` | `modules/planner/models.py` | `business/planning/models.py` | Add: `entity_type` support |
| `InternalLinks` | - | `business/linking/models.py` | NEW: `source_id`, `target_id`, `anchor`, `position`, `link_type` |
| `OptimizationTask` | - | `business/optimization/models.py` | NEW: `content_id`, `type`, `target_keyword`, `scores_before`, `scores_after`, `html_before`, `html_after` |
| `SiteBlueprint` | - | `business/site_building/models.py` | NEW: `tenant`, `site`, `config_json`, `structure_json`, `status`, `hosting_type` |
| `PageBlueprint` | - | `business/site_building/models.py` | NEW: `site_blueprint`, `slug`, `type`, `blocks_json`, `status` |
| `SiteIntegration` | - | `business/integration/models.py` | NEW: `site`, `platform`, `platform_type`, `config_json`, `credentials`, `is_active`, `sync_enabled` |
| `PublishingRecord` | - | `business/publishing/models.py` | NEW: `content_id`, `destination`, `destination_type`, `status`, `external_id`, `published_at`, `sync_status` |
| `DeploymentRecord` | - | `business/publishing/models.py` | NEW: `site_blueprint`, `version`, `status`, `build_url`, `deployed_at`, `deployment_type` |
| `AutomationRule` | - | `business/automation/models.py` | NEW: `name`, `trigger`, `conditions`, `actions`, `schedule`, `is_active` |
| `ScheduledTask` | - | `business/automation/models.py` | NEW: `automation_rule`, `scheduled_at`, `status`, `executed_at` |
---
@@ -366,8 +366,8 @@ sites/src/
| Component | Purpose | Implementation |
|-----------|---------|----------------|
| **AutomationRule Model** | Store automation rules | `domain/automation/models.py` |
| **AutomationService** | Execute automation rules | `domain/automation/services/automation_service.py` |
| **AutomationRule Model** | Store automation rules | `business/automation/models.py` |
| **AutomationService** | Execute automation rules | `business/automation/services/automation_service.py` |
| **Celery Beat Tasks** | Scheduled automation | `infrastructure/messaging/automation_tasks.py` |
| **Automation API** | CRUD for rules | `modules/automation/views.py` |
| **Automation UI** | Manage rules | `frontend/src/pages/Automation/` |
@@ -409,8 +409,8 @@ class AutomationRule(SiteSectorBaseModel):
| Task | File | Implementation |
|------|------|----------------|
| **AutomationRule Model** | `domain/automation/models.py` | Create model with trigger, conditions, actions, schedule |
| **AutomationService** | `domain/automation/services/automation_service.py` | `execute_rule()`, `check_conditions()`, `execute_actions()` |
| **AutomationRule Model** | `business/automation/models.py` | Create model with trigger, conditions, actions, schedule |
| **AutomationService** | `business/automation/services/automation_service.py` | `execute_rule()`, `check_conditions()`, `execute_actions()` |
| **Celery Beat Tasks** | `infrastructure/messaging/automation_tasks.py` | `@periodic_task` decorators for scheduled rules |
| **Automation API** | `modules/automation/views.py` | CRUD ViewSet for AutomationRule |
| **Automation UI** | `frontend/src/pages/Automation/` | Dashboard, Rules management, History |
@@ -434,9 +434,9 @@ class AutomationRule(SiteSectorBaseModel):
| Resource | Limit Type | Enforcement | Location |
|-----------|------------|-------------|----------|
| **Daily Content Tasks** | Per site | `Plan.daily_content_tasks` | `domain/content/services/content_generation_service.py` |
| **Daily Content Tasks** | Per site | `Plan.daily_content_tasks` | `business/content/services/content_generation_service.py` |
| **Daily AI Requests** | Per site | `Plan.daily_ai_requests` | `infrastructure/ai/engine.py` |
| **Monthly Word Count** | Per site | `Plan.monthly_word_count_limit` | `domain/content/services/content_generation_service.py` |
| **Monthly Word Count** | Per site | `Plan.monthly_word_count_limit` | `business/content/services/content_generation_service.py` |
| **Daily Image Generation** | Per site | `Plan.daily_image_generation_limit` | `infrastructure/ai/functions/generate_images.py` |
| **Storage Quota** | Per site | Configurable (default: 10GB) | `infrastructure/storage/file_storage.py` |
| **Concurrent Tasks** | Per site | Configurable (default: 5) | Celery queue configuration |
@@ -530,7 +530,7 @@ class FileStorageService:
**Site Builder File Management**:
```python
# domain/site_building/services/file_management_service.py
# business/site_building/services/file_management_service.py
class SiteBuilderFileService:
def get_user_accessible_sites(self, user) -> List[Site]:
"""Get sites user can access for file management"""
@@ -645,11 +645,11 @@ docker-data/
| Task | Files | Status | Priority |
|------|-------|--------|-----------|
| **Extend Content Model** | `domain/content/models.py` | TODO | HIGH |
| **Create Service Layer** | `domain/*/services/` | TODO | HIGH |
| **Extend Content Model** | `business/content/models.py` | TODO | HIGH |
| **Create Service Layer** | `business/*/services/` | TODO | HIGH |
| **Refactor ViewSets** | `modules/*/views.py` | TODO | HIGH |
| **Implement Automation Models** | `domain/automation/models.py` | TODO | HIGH |
| **Implement Automation Service** | `domain/automation/services/` | TODO | HIGH |
| **Implement Automation Models** | `business/automation/models.py` | TODO | HIGH |
| **Implement Automation Service** | `business/automation/services/` | TODO | HIGH |
| **Implement Automation API** | `modules/automation/` | TODO | HIGH |
| **Implement Automation UI** | `frontend/src/pages/Automation/` | TODO | HIGH |
| **Note**: Schedules functionality will be integrated into Automation UI, not as a separate page | - | - | - |
@@ -659,8 +659,8 @@ docker-data/
| Task | Files | Dependencies | Priority |
|------|-------|--------------|----------|
| **Create Site Builder Container** | `docker-compose.app.yml` | Phase 0 | HIGH |
| **Site Builder Models** | `domain/site_building/models.py` | Phase 0 | HIGH |
| **Structure Generation Service** | `domain/site_building/services/` | Phase 0 | HIGH |
| **Site Builder Models** | `business/site_building/models.py` | Phase 0 | HIGH |
| **Structure Generation Service** | `business/site_building/services/` | Phase 0 | HIGH |
| **Structure Generation AI Function** | `infrastructure/ai/functions/generate_site_structure.py` | Phase 0 | HIGH |
| **Site Builder API** | `modules/site_builder/` | Phase 0 | HIGH |
| **Site Builder Frontend** | `site-builder/src/` | Phase 0 | HIGH |
@@ -669,12 +669,12 @@ docker-data/
| Task | Files | Dependencies | Priority |
|------|-------|--------------|----------|
| **Linker Models** | `domain/linking/models.py` | Phase 0 | MEDIUM |
| **Linker Service** | `domain/linking/services/` | Phase 0 | MEDIUM |
| **Linker Models** | `business/linking/models.py` | Phase 0 | MEDIUM |
| **Linker Service** | `business/linking/services/` | Phase 0 | MEDIUM |
| **Linker API** | `modules/linker/` | Phase 0 | MEDIUM |
| **Linker UI** | `frontend/src/pages/Linker/` | Phase 0 | MEDIUM |
| **Optimizer Models** | `domain/optimization/models.py` | Phase 0 | MEDIUM |
| **Optimizer Service** | `domain/optimization/services/` | Phase 0 | MEDIUM |
| **Optimizer Models** | `business/optimization/models.py` | Phase 0 | MEDIUM |
| **Optimizer Service** | `business/optimization/services/` | Phase 0 | MEDIUM |
| **Optimizer AI Function** | `infrastructure/ai/functions/optimize_content.py` | Phase 0 | MEDIUM |
| **Optimizer API** | `modules/optimizer/` | Phase 0 | MEDIUM |
| **Optimizer UI** | `frontend/src/pages/Optimizer/` | Phase 0 | MEDIUM |
@@ -685,22 +685,22 @@ docker-data/
|------|-------|--------------|----------|
| **Create Sites Container** | `docker-compose.app.yml` | Phase 1 | MEDIUM |
| **Sites Renderer Frontend** | `sites/src/` | Phase 1 | MEDIUM |
| **Publisher Service** | `domain/publishing/services/` | Phase 0 | MEDIUM |
| **Sites Renderer Adapter** | `domain/publishing/services/adapters/` | Phase 1 | MEDIUM |
| **Publisher Service** | `business/publishing/services/` | Phase 0 | MEDIUM |
| **Sites Renderer Adapter** | `business/publishing/services/adapters/` | Phase 1 | MEDIUM |
| **Publisher API** | `modules/publisher/` | Phase 0 | MEDIUM |
| **Deployment Service** | `domain/publishing/services/deployment_service.py` | Phase 1 | MEDIUM |
| **Deployment Service** | `business/publishing/services/deployment_service.py` | Phase 1 | MEDIUM |
### 9.5 Phase 4: Universal Content Types
| Task | Files | Dependencies | Priority |
|------|-------|--------------|----------|
| **Extend Content Model** | `domain/content/models.py` | Phase 0 | LOW |
| **Extend Content Model** | `business/content/models.py` | Phase 0 | LOW |
| **Product Content Prompts** | `infrastructure/ai/prompts.py` | Phase 0 | LOW |
| **Service Page Prompts** | `infrastructure/ai/prompts.py` | Phase 0 | LOW |
| **Taxonomy Prompts** | `infrastructure/ai/prompts.py` | Phase 0 | LOW |
| **Content Type Support in Writer** | `domain/content/services/` | Phase 0 | LOW |
| **Content Type Support in Linker** | `domain/linking/services/` | Phase 2 | LOW |
| **Content Type Support in Optimizer** | `domain/optimization/services/` | Phase 2 | LOW |
| **Content Type Support in Writer** | `business/content/services/` | Phase 0 | LOW |
| **Content Type Support in Linker** | `business/linking/services/` | Phase 2 | LOW |
| **Content Type Support in Optimizer** | `business/optimization/services/` | Phase 2 | LOW |
---
@@ -750,11 +750,11 @@ docker-data/
| Location | Check | Implementation |
|----------|-------|----------------|
| **AI Engine** | Before AI call | `infrastructure/ai/engine.py` - Check credits, deduct before request |
| **Content Generation** | Before generation | `domain/content/services/content_generation_service.py` |
| **Content Generation** | Before generation | `business/content/services/content_generation_service.py` |
| **Image Generation** | Before generation | `infrastructure/ai/functions/generate_images.py` |
| **Linking** | Before linking | `domain/linking/services/linker_service.py` (NEW) |
| **Optimization** | Before optimization | `domain/optimization/services/optimizer_service.py` (NEW) |
| **Site Building** | Before structure gen | `domain/site_building/services/structure_generation_service.py` (NEW) |
| **Linking** | Before linking | `business/linking/services/linker_service.py` (NEW) |
| **Optimization** | Before optimization | `business/optimization/services/optimizer_service.py` (NEW) |
| **Site Building** | Before structure gen | `business/site_building/services/structure_generation_service.py` (NEW) |
### 10.5 Credit Logging
@@ -784,8 +784,8 @@ These are **NOT** business limits - they're technical constraints for request pr
| Feature | Implementation | Location |
|---------|----------------|----------|
| **Credit Check** | Before every AI operation | `domain/billing/services/credit_service.py` |
| **Credit Deduction** | After successful operation | `domain/billing/services/credit_service.py` |
| **Credit Check** | Before every AI operation | `business/billing/services/credit_service.py` |
| **Credit Deduction** | After successful operation | `business/billing/services/credit_service.py` |
| **Credit Top-up** | On-demand purchase | `modules/billing/views.py` |
| **Monthly Replenishment** | Celery Beat task | `infrastructure/messaging/automation_tasks.py` |
| **Low Credit Warning** | When < 10% remaining | Frontend + Email notification |
@@ -893,7 +893,7 @@ publisher_service.publish(
### 11.6 Site Integration Service
```python
# domain/integration/services/integration_service.py
# business/integration/services/integration_service.py
class IntegrationService:
def create_integration(self, site, platform, config, credentials):
"""Create new site integration"""
@@ -945,12 +945,12 @@ Content/Site Publishing Flow:
| Component | File | Purpose |
|-----------|------|---------|
| **SiteIntegration Model** | `domain/integration/models.py` | Store integration configs |
| **IntegrationService** | `domain/integration/services/integration_service.py` | Manage integrations |
| **SyncService** | `domain/integration/services/sync_service.py` | Handle two-way sync |
| **WordPressAdapter** | `domain/publishing/services/adapters/wordpress_adapter.py` | WordPress publishing |
| **SitesRendererAdapter** | `domain/publishing/services/adapters/sites_renderer_adapter.py` | IGNY8 Sites deployment |
| **ShopifyAdapter** | `domain/publishing/services/adapters/shopify_adapter.py` | Shopify publishing (future) |
| **SiteIntegration Model** | `business/integration/models.py` | Store integration configs |
| **IntegrationService** | `business/integration/services/integration_service.py` | Manage integrations |
| **SyncService** | `business/integration/services/sync_service.py` | Handle two-way sync |
| **WordPressAdapter** | `business/publishing/services/adapters/wordpress_adapter.py` | WordPress publishing |
| **SitesRendererAdapter** | `business/publishing/services/adapters/sites_renderer_adapter.py` | IGNY8 Sites deployment |
| **ShopifyAdapter** | `business/publishing/services/adapters/shopify_adapter.py` | Shopify publishing (future) |
| **Integration API** | `modules/integration/views.py` | CRUD for integrations |
| **Integration UI** | `frontend/src/pages/Settings/Integrations.tsx` | Manage integrations |

View File

@@ -72,7 +72,7 @@
| Task | Files | Dependencies | Risk |
|------|-------|--------------|------|
| **Add Module Enable/Disable** | `domain/system/models.py` | EXISTING (ModuleSettings) | LOW - Extend existing |
| **Add Module Enable/Disable** | `business/system/models.py` | EXISTING (ModuleSettings) | LOW - Extend existing |
| **Module Settings API** | `modules/system/views.py` | EXISTING | LOW - Extend existing |
| **Module Settings UI** | `frontend/src/pages/Settings/Modules.tsx` | EXISTING (placeholder) | LOW - Implement UI |
| **Frontend Module Loader** | `frontend/src/config/modules.config.ts` | None | MEDIUM - Conditional loading |
@@ -100,18 +100,18 @@
|------|-------|--------------|------|
| **Remove Plan Limit Fields** | `core/auth/models.py` | None | LOW - Add migration to set defaults |
| **Update Plan Model** | `core/auth/models.py` | None | LOW - Keep only monthly_credits, support_level |
| **Update CreditService** | `domain/billing/services/credit_service.py` | None | MEDIUM - Add credit cost constants |
| **Add Credit Costs** | `domain/billing/constants.py` | None | LOW - Define credit costs per operation |
| **Update CreditService** | `business/billing/services/credit_service.py` | None | MEDIUM - Add credit cost constants |
| **Add Credit Costs** | `business/billing/constants.py` | None | LOW - Define credit costs per operation |
| **Update AI Engine** | `infrastructure/ai/engine.py` | CreditService | MEDIUM - Check credits before AI calls |
| **Update Content Generation** | `domain/content/services/` | CreditService | MEDIUM - Check credits before generation |
| **Update Content Generation** | `business/content/services/` | CreditService | MEDIUM - Check credits before generation |
| **Update Image Generation** | `infrastructure/ai/functions/generate_images.py` | CreditService | MEDIUM - Check credits before generation |
| **Remove Limit Checks** | All services | None | MEDIUM - Remove all plan limit validations |
| **Update Usage Logging** | `domain/billing/models.py` | None | LOW - Ensure all operations log credits |
| **Update Usage Logging** | `business/billing/models.py` | None | LOW - Ensure all operations log credits |
| **Update Frontend Limits UI** | `frontend/src/pages/Billing/` | Backend API | LOW - Replace limits with credit display |
**Credit Cost Constants**:
```python
# domain/billing/constants.py
# business/billing/constants.py
CREDIT_COSTS = {
'clustering': 10,
'idea_generation': 15,
@@ -156,16 +156,16 @@ CREDIT_COSTS = {
**Goal**: Extract business logic from ViewSets into services, preserving all existing functionality.
### 1.1 Create Domain Structure
### 1.1 Create Business Structure
| Task | Files | Dependencies |
|------|-------|--------------|
| **Create domain/ folder** | `backend/igny8_core/domain/` | None |
| **Move Content models** | `domain/content/models.py` | Phase 0 |
| **Move Planning models** | `domain/planning/models.py` | Phase 0 |
| **Create ContentService** | `domain/content/services/content_generation_service.py` | Existing Writer logic |
| **Create PlanningService** | `domain/planning/services/clustering_service.py` | Existing Planner logic |
| **Create IdeasService** | `domain/planning/services/ideas_service.py` | Existing Planner logic |
| **Create business/ folder** | `backend/igny8_core/business/` | None |
| **Move Content models** | `business/content/models.py` | Phase 0 |
| **Move Planning models** | `business/planning/models.py` | Phase 0 |
| **Create ContentService** | `business/content/services/content_generation_service.py` | Existing Writer logic |
| **Create PlanningService** | `business/planning/services/clustering_service.py` | Existing Planner logic |
| **Create IdeasService** | `business/planning/services/ideas_service.py` | Existing Planner logic |
### 1.2 Refactor ViewSets (Keep APIs Working)
@@ -199,18 +199,18 @@ CREDIT_COSTS = {
| Task | Files | Dependencies |
|------|-------|--------------|
| **AutomationRule Model** | `domain/automation/models.py` | Phase 1 |
| **ScheduledTask Model** | `domain/automation/models.py` | Phase 1 |
| **Automation Migrations** | `domain/automation/migrations/` | Phase 1 |
| **AutomationRule Model** | `business/automation/models.py` | Phase 1 |
| **ScheduledTask Model** | `business/automation/models.py` | Phase 1 |
| **Automation Migrations** | `business/automation/migrations/` | Phase 1 |
### 2.2 Automation Service
| Task | Files | Dependencies |
|------|-------|--------------|
| **AutomationService** | `domain/automation/services/automation_service.py` | Phase 1 services |
| **Rule Execution Engine** | `domain/automation/services/rule_engine.py` | Phase 1 services |
| **Condition Evaluator** | `domain/automation/services/condition_evaluator.py` | None |
| **Action Executor** | `domain/automation/services/action_executor.py` | Phase 1 services |
| **AutomationService** | `business/automation/services/automation_service.py` | Phase 1 services |
| **Rule Execution Engine** | `business/automation/services/rule_engine.py` | Phase 1 services |
| **Condition Evaluator** | `business/automation/services/condition_evaluator.py` | None |
| **Action Executor** | `business/automation/services/action_executor.py` | Phase 1 services |
### 2.3 Celery Beat Tasks
@@ -256,8 +256,8 @@ CREDIT_COSTS = {
| Task | Files | Dependencies |
|------|-------|--------------|
| **Site File Management Service** | `domain/site_building/services/file_management_service.py` | Phase 1 |
| **User Site Access Check** | `domain/site_building/services/file_management_service.py` | EXISTING (SiteUserAccess) |
| **Site File Management Service** | `business/site_building/services/file_management_service.py` | Phase 1 |
| **User Site Access Check** | `business/site_building/services/file_management_service.py` | EXISTING (SiteUserAccess) |
| **File Upload API** | `modules/site_builder/views.py` | File Management Service |
| **File Browser UI** | `site-builder/src/components/files/FileBrowser.tsx` | NEW |
| **Storage Quota Check** | `infrastructure/storage/file_storage.py` | Phase 1 |
@@ -286,16 +286,16 @@ CREDIT_COSTS = {
| Task | Files | Dependencies |
|------|-------|--------------|
| **SiteBlueprint Model** | `domain/site_building/models.py` | Phase 1 |
| **PageBlueprint Model** | `domain/site_building/models.py` | Phase 1 |
| **Site Builder Migrations** | `domain/site_building/migrations/` | Phase 1 |
| **SiteBlueprint Model** | `business/site_building/models.py` | Phase 1 |
| **PageBlueprint Model** | `business/site_building/models.py` | Phase 1 |
| **Site Builder Migrations** | `business/site_building/migrations/` | Phase 1 |
### 3.2 Site Structure Generation
| Task | Files | Dependencies |
|------|-------|--------------|
| **Structure Generation AI Function** | `infrastructure/ai/functions/generate_site_structure.py` | Existing AI framework |
| **Structure Generation Service** | `domain/site_building/services/structure_generation_service.py` | Phase 1, AI framework |
| **Structure Generation Service** | `business/site_building/services/structure_generation_service.py` | Phase 1, AI framework |
| **Site Structure Prompts** | `infrastructure/ai/prompts.py` | Existing prompt system |
### 3.3 Site Builder API
@@ -361,8 +361,8 @@ frontend/src/components/shared/
| Task | Files | Dependencies |
|------|-------|--------------|
| **Extend ContentService** | `domain/content/services/content_generation_service.py` | Phase 1 |
| **Add Site Page Type** | `domain/content/models.py` | Phase 1 |
| **Extend ContentService** | `business/content/services/content_generation_service.py` | Phase 1 |
| **Add Site Page Type** | `business/content/models.py` | Phase 1 |
| **Page Generation Prompts** | `infrastructure/ai/prompts.py` | Existing prompt system |
### 3.6 Testing
@@ -437,11 +437,11 @@ Entry Point 4: Manual Selection → Linker/Optimizer
| Task | Files | Dependencies |
|------|-------|--------------|
| **Add source field** | `domain/content/models.py` | Phase 1 |
| **Add sync_status field** | `domain/content/models.py` | Phase 1 |
| **Add external_id field** | `domain/content/models.py` | Phase 1 |
| **Add sync_metadata field** | `domain/content/models.py` | Phase 1 |
| **Content Migrations** | `domain/content/migrations/` | Phase 1 |
| **Add source field** | `business/content/models.py` | Phase 1 |
| **Add sync_status field** | `business/content/models.py` | Phase 1 |
| **Add external_id field** | `business/content/models.py` | Phase 1 |
| **Add sync_metadata field** | `business/content/models.py` | Phase 1 |
| **Content Migrations** | `business/content/migrations/` | Phase 1 |
**Content Model Extensions**:
```python
@@ -481,26 +481,26 @@ class Content(SiteSectorBaseModel):
| Task | Files | Dependencies |
|------|-------|--------------|
| **InternalLink Model** | `domain/linking/models.py` | Phase 1 |
| **LinkGraph Model** | `domain/linking/models.py` | Phase 1 |
| **Linker Migrations** | `domain/linking/migrations/` | Phase 1 |
| **InternalLink Model** | `business/linking/models.py` | Phase 1 |
| **LinkGraph Model** | `business/linking/models.py` | Phase 1 |
| **Linker Migrations** | `business/linking/migrations/` | Phase 1 |
### 4.3 Linker Service
| Task | Files | Dependencies |
|------|-------|--------------|
| **LinkerService** | `domain/linking/services/linker_service.py` | Phase 1, ContentService |
| **Link Candidate Engine** | `domain/linking/services/candidate_engine.py` | Phase 1 |
| **Link Injection Engine** | `domain/linking/services/injection_engine.py` | Phase 1 |
| **LinkerService** | `business/linking/services/linker_service.py` | Phase 1, ContentService |
| **Link Candidate Engine** | `business/linking/services/candidate_engine.py` | Phase 1 |
| **Link Injection Engine** | `business/linking/services/injection_engine.py` | Phase 1 |
### 4.4 Content Sync Service (For WordPress/3rd Party)
| Task | Files | Dependencies |
|------|-------|--------------|
| **ContentSyncService** | `domain/integration/services/content_sync_service.py` | Phase 1, Phase 6 |
| **WordPress Content Sync** | `domain/integration/services/wordpress_sync.py` | Phase 6 |
| **3rd Party Content Sync** | `domain/integration/services/external_sync.py` | Phase 6 |
| **Content Import Logic** | `domain/integration/services/import_service.py` | Phase 1 |
| **ContentSyncService** | `business/integration/services/content_sync_service.py` | Phase 1, Phase 6 |
| **WordPress Content Sync** | `business/integration/services/wordpress_sync.py` | Phase 6 |
| **3rd Party Content Sync** | `business/integration/services/external_sync.py` | Phase 6 |
| **Content Import Logic** | `business/integration/services/import_service.py` | Phase 1 |
**Sync Service Flow**:
```python
@@ -530,17 +530,17 @@ class ContentSyncService:
| Task | Files | Dependencies |
|------|-------|--------------|
| **OptimizationTask Model** | `domain/optimization/models.py` | Phase 1 |
| **OptimizationScores Model** | `domain/optimization/models.py` | Phase 1 |
| **Optimizer Migrations** | `domain/optimization/migrations/` | Phase 1 |
| **OptimizationTask Model** | `business/optimization/models.py` | Phase 1 |
| **OptimizationScores Model** | `business/optimization/models.py` | Phase 1 |
| **Optimizer Migrations** | `business/optimization/migrations/` | Phase 1 |
### 4.6 Optimizer Service (Multiple Entry Points)
| Task | Files | Dependencies |
|------|-------|--------------|
| **OptimizerService** | `domain/optimization/services/optimizer_service.py` | Phase 1, ContentService |
| **Content Analyzer** | `domain/optimization/services/analyzer.py` | Phase 1 |
| **Entry Point Handler** | `domain/optimization/services/entry_handler.py` | Phase 1 |
| **OptimizerService** | `business/optimization/services/optimizer_service.py` | Phase 1, ContentService |
| **Content Analyzer** | `business/optimization/services/analyzer.py` | Phase 1 |
| **Entry Point Handler** | `business/optimization/services/entry_handler.py` | Phase 1 |
| **Optimization AI Function** | `infrastructure/ai/functions/optimize_content.py` | Existing AI framework |
| **Optimization Prompts** | `infrastructure/ai/prompts.py` | Existing prompt system |
@@ -578,8 +578,8 @@ class OptimizerService:
| Task | Files | Dependencies |
|------|-------|--------------|
| **OptimizerService** | `domain/optimization/services/optimizer_service.py` | Phase 1, ContentService |
| **Content Analyzer** | `domain/optimization/services/analyzer.py` | Phase 1 |
| **OptimizerService** | `business/optimization/services/optimizer_service.py` | Phase 1, ContentService |
| **Content Analyzer** | `business/optimization/services/analyzer.py` | Phase 1 |
| **Optimization AI Function** | `infrastructure/ai/functions/optimize_content.py` | Existing AI framework |
| **Optimization Prompts** | `infrastructure/ai/prompts.py` | Existing prompt system |
@@ -587,9 +587,9 @@ class OptimizerService:
| Task | Files | Dependencies |
|------|-------|--------------|
| **ContentPipelineService** | `domain/content/services/content_pipeline_service.py` | LinkerService, OptimizerService |
| **Pipeline Orchestration** | `domain/content/services/pipeline_service.py` | Phase 1 services |
| **Workflow State Machine** | `domain/content/services/workflow_state.py` | Phase 1 services |
| **ContentPipelineService** | `business/content/services/content_pipeline_service.py` | LinkerService, OptimizerService |
| **Pipeline Orchestration** | `business/content/services/pipeline_service.py` | Phase 1 services |
| **Workflow State Machine** | `business/content/services/workflow_state.py` | Phase 1 services |
**Pipeline Workflow States**:
```
@@ -711,7 +711,7 @@ class ContentPipelineService:
| Task | Files | Dependencies |
|------|-------|--------------|
| **Layout Configuration** | `domain/site_building/models.py` | Phase 3 |
| **Layout Configuration** | `business/site_building/models.py` | Phase 3 |
| **Layout Selector UI** | `site-builder/src/components/layouts/LayoutSelector.tsx` | Phase 3 |
| **Layout Renderer** | `sites/src/utils/layoutRenderer.ts` | Phase 5 |
| **Layout Preview** | `site-builder/src/components/preview/LayoutPreview.tsx` | Phase 3 |
@@ -729,17 +729,17 @@ class ContentPipelineService:
| Task | Files | Dependencies |
|------|-------|--------------|
| **PublisherService** | `domain/publishing/services/publisher_service.py` | Phase 1 |
| **SitesRendererAdapter** | `domain/publishing/services/adapters/sites_renderer_adapter.py` | Phase 3 |
| **DeploymentService** | `domain/publishing/services/deployment_service.py` | Phase 3 |
| **PublisherService** | `business/publishing/services/publisher_service.py` | Phase 1 |
| **SitesRendererAdapter** | `business/publishing/services/adapters/sites_renderer_adapter.py` | Phase 3 |
| **DeploymentService** | `business/publishing/services/deployment_service.py` | Phase 3 |
### 5.3 Publishing Models
| Task | Files | Dependencies |
|------|-------|--------------|
| **PublishingRecord Model** | `domain/publishing/models.py` | Phase 1 |
| **DeploymentRecord Model** | `domain/publishing/models.py` | Phase 3 |
| **Publishing Migrations** | `domain/publishing/migrations/` | Phase 1 |
| **PublishingRecord Model** | `business/publishing/models.py` | Phase 1 |
| **DeploymentRecord Model** | `business/publishing/models.py` | Phase 3 |
| **Publishing Migrations** | `business/publishing/migrations/` | Phase 1 |
### 5.4 Publisher API
@@ -767,32 +767,32 @@ class ContentPipelineService:
| Task | Files | Dependencies |
|------|-------|--------------|
| **SiteIntegration Model** | `domain/integration/models.py` | Phase 1 |
| **Integration Migrations** | `domain/integration/migrations/` | Phase 1 |
| **SiteIntegration Model** | `business/integration/models.py` | Phase 1 |
| **Integration Migrations** | `business/integration/migrations/` | Phase 1 |
### 6.2 Integration Service
| Task | Files | Dependencies |
|------|-------|--------------|
| **IntegrationService** | `domain/integration/services/integration_service.py` | Phase 1 |
| **SyncService** | `domain/integration/services/sync_service.py` | Phase 1 |
| **IntegrationService** | `business/integration/services/integration_service.py` | Phase 1 |
| **SyncService** | `business/integration/services/sync_service.py` | Phase 1 |
### 6.3 Publishing Adapters
| Task | Files | Dependencies |
|------|-------|--------------|
| **BaseAdapter** | `domain/publishing/services/adapters/base_adapter.py` | Phase 5 |
| **WordPressAdapter** | `domain/publishing/services/adapters/wordpress_adapter.py` | EXISTING (refactor) |
| **SitesRendererAdapter** | `domain/publishing/services/adapters/sites_renderer_adapter.py` | Phase 5 |
| **ShopifyAdapter** | `domain/publishing/services/adapters/shopify_adapter.py` | Phase 5 (future) |
| **BaseAdapter** | `business/publishing/services/adapters/base_adapter.py` | Phase 5 |
| **WordPressAdapter** | `business/publishing/services/adapters/wordpress_adapter.py` | EXISTING (refactor) |
| **SitesRendererAdapter** | `business/publishing/services/adapters/sites_renderer_adapter.py` | Phase 5 |
| **ShopifyAdapter** | `business/publishing/services/adapters/shopify_adapter.py` | Phase 5 (future) |
### 6.4 Multi-Destination Publishing
| Task | Files | Dependencies |
|------|-------|--------------|
| **Extend PublisherService** | `domain/publishing/services/publisher_service.py` | Phase 5 |
| **Multi-destination Support** | `domain/publishing/services/publisher_service.py` | Phase 5 |
| **Update PublishingRecord** | `domain/publishing/models.py` | Phase 5 |
| **Extend PublisherService** | `business/publishing/services/publisher_service.py` | Phase 5 |
| **Multi-destination Support** | `business/publishing/services/publisher_service.py` | Phase 5 |
| **Update PublishingRecord** | `business/publishing/models.py` | Phase 5 |
### 6.5 Site Model Extensions
@@ -867,7 +867,7 @@ class ContentPipelineService:
| Task | Files | Dependencies |
|------|-------|--------------|
| **WordPress Sync Endpoints** | `modules/integration/views.py` | IntegrationService |
| **Two-way Sync Logic** | `domain/integration/services/sync_service.py` | Phase 6.2 |
| **Two-way Sync Logic** | `business/integration/services/sync_service.py` | Phase 6.2 |
| **WordPress Webhook Handler** | `modules/integration/views.py` | Phase 6.2 |
**Note**: WordPress plugin itself is built separately. Only API endpoints for plugin connection are built here.
@@ -1036,10 +1036,10 @@ const isModuleEnabled = (moduleName: string) => {
| Task | Files | Dependencies |
|------|-------|--------------|
| **Add entity_type field** | `domain/content/models.py` | Phase 1 |
| **Add json_blocks field** | `domain/content/models.py` | Phase 1 |
| **Add structure_data field** | `domain/content/models.py` | Phase 1 |
| **Content Migrations** | `domain/content/migrations/` | Phase 1 |
| **Add entity_type field** | `business/content/models.py` | Phase 1 |
| **Add json_blocks field** | `business/content/models.py` | Phase 1 |
| **Add structure_data field** | `business/content/models.py` | Phase 1 |
| **Content Migrations** | `business/content/migrations/` | Phase 1 |
### 8.2 Content Type Prompts
@@ -1053,18 +1053,18 @@ const isModuleEnabled = (moduleName: string) => {
| Task | Files | Dependencies |
|------|-------|--------------|
| **Product Content Generation** | `domain/content/services/content_generation_service.py` | Phase 1 |
| **Service Page Generation** | `domain/content/services/content_generation_service.py` | Phase 1 |
| **Taxonomy Generation** | `domain/content/services/content_generation_service.py` | Phase 1 |
| **Product Content Generation** | `business/content/services/content_generation_service.py` | Phase 1 |
| **Service Page Generation** | `business/content/services/content_generation_service.py` | Phase 1 |
| **Taxonomy Generation** | `business/content/services/content_generation_service.py` | Phase 1 |
### 8.4 Linker & Optimizer Extensions
| Task | Files | Dependencies |
|------|-------|--------------|
| **Product Linking** | `domain/linking/services/linker_service.py` | Phase 4 |
| **Taxonomy Linking** | `domain/linking/services/linker_service.py` | Phase 4 |
| **Product Optimization** | `domain/optimization/services/optimizer_service.py` | Phase 4 |
| **Taxonomy Optimization** | `domain/optimization/services/optimizer_service.py` | Phase 4 |
| **Product Linking** | `business/linking/services/linker_service.py` | Phase 4 |
| **Taxonomy Linking** | `business/linking/services/linker_service.py` | Phase 4 |
| **Product Optimization** | `business/optimization/services/optimizer_service.py` | Phase 4 |
| **Taxonomy Optimization** | `business/optimization/services/optimizer_service.py` | Phase 4 |
### 8.5 Testing

View File

@@ -48,13 +48,13 @@
| Task | File | Current State | Implementation |
|------|------|---------------|----------------|
| **Extend ModuleSettings Model** | `domain/system/models.py` | EXISTING (ModuleSettings) | Add `enabled` boolean field per module |
| **Extend ModuleSettings Model** | `business/system/models.py` | EXISTING (ModuleSettings) | Add `enabled` boolean field per module |
| **Module Settings API** | `modules/system/views.py` | EXISTING | Extend ViewSet to handle enable/disable |
| **Module Settings Serializer** | `modules/system/serializers.py` | EXISTING | Add enabled field to serializer |
**ModuleSettings Model Extension**:
```python
# domain/system/models.py (or core/system/models.py if exists)
# business/system/models.py (or core/system/models.py if exists)
class ModuleSettings(AccountBaseModel):
# Existing fields...
@@ -173,11 +173,11 @@ class Plan(models.Model):
| Task | File | Current State | Implementation |
|------|------|---------------|----------------|
| **Add Credit Costs** | `domain/billing/constants.py` | NEW | Define credit costs per operation |
| **Add Credit Costs** | `business/billing/constants.py` | NEW | Define credit costs per operation |
**Credit Cost Constants**:
```python
# domain/billing/constants.py
# business/billing/constants.py
CREDIT_COSTS = {
'clustering': 10, # Per clustering request
'idea_generation': 15, # Per cluster → ideas request
@@ -195,11 +195,11 @@ CREDIT_COSTS = {
| Task | File | Current State | Implementation |
|------|------|---------------|----------------|
| **Update CreditService** | `domain/billing/services/credit_service.py` | EXISTING | Add credit cost constants, update methods |
| **Update CreditService** | `business/billing/services/credit_service.py` | EXISTING | Add credit cost constants, update methods |
**CreditService Methods**:
```python
# domain/billing/services/credit_service.py
# business/billing/services/credit_service.py
class CreditService:
def check_credits(self, account, operation_type, amount=None):
"""Check if account has sufficient credits"""
@@ -256,11 +256,11 @@ class AIEngine:
| Task | File | Current State | Implementation |
|------|------|---------------|----------------|
| **Update Content Generation** | `domain/content/services/content_generation_service.py` | NEW (Phase 1) | Check credits before generation |
| **Update Content Generation** | `business/content/services/content_generation_service.py` | NEW (Phase 1) | Check credits before generation |
**Content Generation Credit Check**:
```python
# domain/content/services/content_generation_service.py
# business/content/services/content_generation_service.py
class ContentGenerationService:
def generate_content(self, task, account):
# Check credits before generation
@@ -331,11 +331,11 @@ credit_service.check_credits(account, 'clustering', keyword_count)
| Task | File | Current State | Implementation |
|------|------|---------------|----------------|
| **Update Usage Logging** | `domain/billing/models.py` | EXISTING | Ensure all operations log credits |
| **Update Usage Logging** | `business/billing/models.py` | EXISTING | Ensure all operations log credits |
**CreditUsageLog Model**:
```python
# domain/billing/models.py
# business/billing/models.py
class CreditUsageLog(AccountBaseModel):
account = models.ForeignKey(Account, on_delete=models.CASCADE)
operation_type = models.CharField(max_length=50)
@@ -399,7 +399,7 @@ class Migration(migrations.Migration):
**Migration 2: Add Credit Cost Tracking**:
```python
# domain/billing/migrations/XXXX_add_credit_tracking.py
# business/billing/migrations/XXXX_add_credit_tracking.py
class Migration(migrations.Migration):
operations = [
migrations.AddField(
@@ -461,7 +461,7 @@ class Migration(migrations.Migration):
### Backend Tasks
- [ ] Create `domain/billing/constants.py` with credit costs
- [ ] Create `business/billing/constants.py` with credit costs
- [ ] Update `CreditService` with credit cost methods
- [ ] Update `Plan` model - remove limit fields
- [ ] Create migration to remove plan limit fields

View File

@@ -12,8 +12,8 @@
## TABLE OF CONTENTS
1. [Overview](#overview)
2. [Create Domain Structure](#create-domain-structure)
3. [Move Models to Domain](#move-models-to-domain)
2. [Create Business Structure](#create-business-structure)
3. [Move Models to Business](#move-models-to-business)
4. [Create Services](#create-services)
5. [Refactor ViewSets](#refactor-viewsets)
6. [Testing & Validation](#testing--validation)
@@ -24,8 +24,8 @@
## OVERVIEW
### Objectives
- ✅ Create `domain/` folder structure
- ✅ Move models from `modules/` to `domain/`
- ✅ Create `business/` folder structure
- ✅ Move models from `modules/` to `business/`
- ✅ Extract business logic from ViewSets to services
- ✅ Keep ViewSets as thin wrappers
- ✅ Preserve all existing API functionality
@@ -38,18 +38,18 @@
---
## CREATE DOMAIN STRUCTURE
## CREATE BUSINESS STRUCTURE
### 1.1 Create Domain Structure
### 1.1 Create Business Structure
**Purpose**: Organize code by business domains, not technical layers.
**Purpose**: Organize code by business logic, not technical layers.
#### Folder Structure
```
backend/igny8_core/
├── domain/ # NEW: Domain layer
│ ├── content/ # Content domain
├── business/ # NEW: Business logic layer
│ ├── content/ # Content business logic
│ │ ├── __init__.py
│ │ ├── models.py # Content, Tasks, Images
│ │ ├── services/
@@ -59,7 +59,7 @@ backend/igny8_core/
│ │ │ └── content_versioning_service.py
│ │ └── migrations/
│ │
│ ├── planning/ # Planning domain
│ ├── planning/ # Planning business logic
│ │ ├── __init__.py
│ │ ├── models.py # Keywords, Clusters, Ideas
│ │ ├── services/
@@ -68,12 +68,12 @@ backend/igny8_core/
│ │ │ └── ideas_service.py
│ │ └── migrations/
│ │
│ ├── billing/ # Billing domain (already exists)
│ ├── billing/ # Billing business logic (already exists)
│ │ ├── models.py # Credits, Transactions
│ │ └── services/
│ │ └── credit_service.py # Already exists
│ │
│ └── automation/ # Automation domain (Phase 2)
│ └── automation/ # Automation business logic (Phase 2)
│ ├── models.py
│ └── services/
```
@@ -82,30 +82,30 @@ backend/igny8_core/
| Task | File | Current Location | New Location | Risk |
|------|------|------------------|--------------|------|
| **Create domain/ folder** | `backend/igny8_core/domain/` | N/A | NEW | LOW |
| **Create content domain** | `domain/content/` | N/A | NEW | LOW |
| **Create planning domain** | `domain/planning/` | N/A | NEW | LOW |
| **Create billing domain** | `domain/billing/` | `modules/billing/` | MOVE | LOW |
| **Create automation domain** | `domain/automation/` | N/A | NEW (Phase 2) | LOW |
| **Create business/ folder** | `backend/igny8_core/business/` | N/A | NEW | LOW |
| **Create content business** | `business/content/` | N/A | NEW | LOW |
| **Create planning business** | `business/planning/` | N/A | NEW | LOW |
| **Create billing business** | `business/billing/` | `modules/billing/` | MOVE | LOW |
| **Create automation business** | `business/automation/` | N/A | NEW (Phase 2) | LOW |
---
## MOVE MODELS TO DOMAIN
## MOVE MODELS TO BUSINESS
### 1.2 Move Models to Domain
### 1.2 Move Models to Business
**Purpose**: Move models from `modules/` to `domain/` to separate business logic from API layer.
**Purpose**: Move models from `modules/` to `business/` to separate business logic from API layer.
#### Content Models Migration
| Model | Current Location | New Location | Changes Needed |
|------|------------------|--------------|----------------|
| `Content` | `modules/writer/models.py` | `domain/content/models.py` | Move, update imports |
| `Tasks` | `modules/writer/models.py` | `domain/content/models.py` | Move, update imports |
| `Images` | `modules/writer/models.py` | `domain/content/models.py` | Move, update imports |
| `Content` | `modules/writer/models.py` | `business/content/models.py` | Move, update imports |
| `Tasks` | `modules/writer/models.py` | `business/content/models.py` | Move, update imports |
| `Images` | `modules/writer/models.py` | `business/content/models.py` | Move, update imports |
**Migration Steps**:
1. Create `domain/content/models.py`
1. Create `business/content/models.py`
2. Copy models from `modules/writer/models.py`
3. Update imports in `modules/writer/views.py`
4. Create migration to ensure no data loss
@@ -115,12 +115,12 @@ backend/igny8_core/
| Model | Current Location | New Location | Changes Needed |
|------|------------------|--------------|----------------|
| `Keywords` | `modules/planner/models.py` | `domain/planning/models.py` | Move, update imports |
| `Clusters` | `modules/planner/models.py` | `domain/planning/models.py` | Move, update imports |
| `ContentIdeas` | `modules/planner/models.py` | `domain/planning/models.py` | Move, update imports |
| `Keywords` | `modules/planner/models.py` | `business/planning/models.py` | Move, update imports |
| `Clusters` | `modules/planner/models.py` | `business/planning/models.py` | Move, update imports |
| `ContentIdeas` | `modules/planner/models.py` | `business/planning/models.py` | Move, update imports |
**Migration Steps**:
1. Create `domain/planning/models.py`
1. Create `business/planning/models.py`
2. Copy models from `modules/planner/models.py`
3. Update imports in `modules/planner/views.py`
4. Create migration to ensure no data loss
@@ -130,13 +130,13 @@ backend/igny8_core/
| Model | Current Location | New Location | Changes Needed |
|------|------------------|--------------|----------------|
| `CreditTransaction` | `modules/billing/models.py` | `domain/billing/models.py` | Move, update imports |
| `CreditUsageLog` | `modules/billing/models.py` | `domain/billing/models.py` | Move, update imports |
| `CreditTransaction` | `modules/billing/models.py` | `business/billing/models.py` | Move, update imports |
| `CreditUsageLog` | `modules/billing/models.py` | `business/billing/models.py` | Move, update imports |
**Migration Steps**:
1. Create `domain/billing/models.py`
1. Create `business/billing/models.py`
2. Copy models from `modules/billing/models.py`
3. Move `CreditService` to `domain/billing/services/credit_service.py`
3. Move `CreditService` to `business/billing/services/credit_service.py`
4. Update imports in `modules/billing/views.py`
5. Create migration to ensure no data loss
@@ -152,11 +152,11 @@ backend/igny8_core/
| Task | File | Purpose | Dependencies |
|------|------|---------|--------------|
| **Create ContentService** | `domain/content/services/content_generation_service.py` | Unified content generation | Existing Writer logic, CreditService |
| **Create ContentService** | `business/content/services/content_generation_service.py` | Unified content generation | Existing Writer logic, CreditService |
**ContentService Methods**:
```python
# domain/content/services/content_generation_service.py
# business/content/services/content_generation_service.py
class ContentGenerationService:
def __init__(self):
self.credit_service = CreditService()
@@ -184,11 +184,11 @@ class ContentGenerationService:
| Task | File | Purpose | Dependencies |
|------|------|---------|--------------|
| **Create PlanningService** | `domain/planning/services/clustering_service.py` | Keyword clustering | Existing Planner logic, CreditService |
| **Create PlanningService** | `business/planning/services/clustering_service.py` | Keyword clustering | Existing Planner logic, CreditService |
**PlanningService Methods**:
```python
# domain/planning/services/clustering_service.py
# business/planning/services/clustering_service.py
class ClusteringService:
def __init__(self):
self.credit_service = CreditService()
@@ -211,11 +211,11 @@ class ClusteringService:
| Task | File | Purpose | Dependencies |
|------|------|---------|--------------|
| **Create IdeasService** | `domain/planning/services/ideas_service.py` | Generate content ideas | Existing Planner logic, CreditService |
| **Create IdeasService** | `business/planning/services/ideas_service.py` | Generate content ideas | Existing Planner logic, CreditService |
**IdeasService Methods**:
```python
# domain/planning/services/ideas_service.py
# business/planning/services/ideas_service.py
class IdeasService:
def __init__(self):
self.credit_service = CreditService()
@@ -380,13 +380,13 @@ class TasksViewSet(SiteSectorModelViewSet):
### Backend Tasks
- [ ] Create `domain/` folder structure
- [ ] Create `domain/content/` folder
- [ ] Create `domain/planning/` folder
- [ ] Create `domain/billing/` folder (move existing)
- [ ] Move Content models to `domain/content/models.py`
- [ ] Move Planning models to `domain/planning/models.py`
- [ ] Move Billing models to `domain/billing/models.py`
- [ ] Create `business/` folder structure
- [ ] Create `business/content/` folder
- [ ] Create `business/planning/` folder
- [ ] Create `business/billing/` folder (move existing)
- [ ] Move Content models to `business/content/models.py`
- [ ] Move Planning models to `business/planning/models.py`
- [ ] Move Billing models to `business/billing/models.py`
- [ ] Create migrations for model moves
- [ ] Create `ContentGenerationService`
- [ ] Create `ClusteringService`
@@ -428,7 +428,7 @@ class TasksViewSet(SiteSectorModelViewSet):
- ✅ Services are testable independently
- ✅ Business logic extracted from ViewSets
- ✅ ViewSets are thin wrappers
- ✅ All models moved to domain layer
- ✅ All models moved to business layer
---

View File

@@ -49,11 +49,11 @@
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **AutomationRule Model** | `domain/automation/models.py` | Phase 1 | Create model with trigger, conditions, actions, schedule |
| **AutomationRule Model** | `business/automation/models.py` | Phase 1 | Create model with trigger, conditions, actions, schedule |
**AutomationRule Model**:
```python
# domain/automation/models.py
# business/automation/models.py
class AutomationRule(SiteSectorBaseModel):
name = models.CharField(max_length=255)
description = models.TextField(blank=True)
@@ -101,11 +101,11 @@ class AutomationRule(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **ScheduledTask Model** | `domain/automation/models.py` | Phase 1 | Create model to track scheduled executions |
| **ScheduledTask Model** | `business/automation/models.py` | Phase 1 | Create model to track scheduled executions |
**ScheduledTask Model**:
```python
# domain/automation/models.py
# business/automation/models.py
class ScheduledTask(SiteSectorBaseModel):
automation_rule = models.ForeignKey(AutomationRule, on_delete=models.CASCADE)
scheduled_at = models.DateTimeField()
@@ -133,7 +133,7 @@ class ScheduledTask(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Automation Migrations** | `domain/automation/migrations/` | Phase 1 | Create initial migrations |
| **Automation Migrations** | `business/automation/migrations/` | Phase 1 | Create initial migrations |
---
@@ -147,11 +147,11 @@ class ScheduledTask(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **AutomationService** | `domain/automation/services/automation_service.py` | Phase 1 services | Main service for rule execution |
| **AutomationService** | `business/automation/services/automation_service.py` | Phase 1 services | Main service for rule execution |
**AutomationService Methods**:
```python
# domain/automation/services/automation_service.py
# business/automation/services/automation_service.py
class AutomationService:
def __init__(self):
self.rule_engine = RuleEngine()
@@ -202,11 +202,11 @@ class AutomationService:
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Rule Execution Engine** | `domain/automation/services/rule_engine.py` | Phase 1 services | Orchestrates rule execution |
| **Rule Execution Engine** | `business/automation/services/rule_engine.py` | Phase 1 services | Orchestrates rule execution |
**RuleEngine Methods**:
```python
# domain/automation/services/rule_engine.py
# business/automation/services/rule_engine.py
class RuleEngine:
def execute_rule(self, rule, context):
"""Orchestrate rule execution"""
@@ -221,11 +221,11 @@ class RuleEngine:
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Condition Evaluator** | `domain/automation/services/condition_evaluator.py` | None | Evaluates rule conditions |
| **Condition Evaluator** | `business/automation/services/condition_evaluator.py` | None | Evaluates rule conditions |
**ConditionEvaluator Methods**:
```python
# domain/automation/services/condition_evaluator.py
# business/automation/services/condition_evaluator.py
class ConditionEvaluator:
def evaluate(self, conditions, context):
"""Evaluate rule conditions"""
@@ -238,11 +238,11 @@ class ConditionEvaluator:
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Action Executor** | `domain/automation/services/action_executor.py` | Phase 1 services | Executes rule actions |
| **Action Executor** | `business/automation/services/action_executor.py` | Phase 1 services | Executes rule actions |
**ActionExecutor Methods**:
```python
# domain/automation/services/action_executor.py
# business/automation/services/action_executor.py
class ActionExecutor:
def __init__(self):
self.clustering_service = ClusteringService()
@@ -290,7 +290,7 @@ from celery.schedules import crontab
@shared_task
def execute_scheduled_automation_rules():
"""Execute all scheduled automation rules"""
from domain.automation.services.automation_service import AutomationService
from business.automation.services.automation_service import AutomationService
service = AutomationService()
rules = AutomationRule.objects.filter(
@@ -316,7 +316,7 @@ def execute_scheduled_automation_rules():
@shared_task
def replenish_monthly_credits():
"""Replenish monthly credits for all active accounts"""
from domain.billing.services.credit_service import CreditService
from business.billing.services.credit_service import CreditService
service = CreditService()
accounts = Account.objects.filter(status='active')
@@ -528,14 +528,14 @@ export const automationApi = {
### Backend Tasks
- [ ] Create `domain/automation/models.py`
- [ ] Create `business/automation/models.py`
- [ ] Create AutomationRule model
- [ ] Create ScheduledTask model
- [ ] Create automation migrations
- [ ] Create `domain/automation/services/automation_service.py`
- [ ] Create `domain/automation/services/rule_engine.py`
- [ ] Create `domain/automation/services/condition_evaluator.py`
- [ ] Create `domain/automation/services/action_executor.py`
- [ ] Create `business/automation/services/automation_service.py`
- [ ] Create `business/automation/services/rule_engine.py`
- [ ] Create `business/automation/services/condition_evaluator.py`
- [ ] Create `business/automation/services/action_executor.py`
- [ ] Create `infrastructure/messaging/automation_tasks.py`
- [ ] Add scheduled automation task
- [ ] Add monthly credit replenishment task

View File

@@ -77,11 +77,11 @@
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Site File Management Service** | `domain/site_building/services/file_management_service.py` | Phase 1 | File upload, delete, organize |
| **Site File Management Service** | `business/site_building/services/file_management_service.py` | Phase 1 | File upload, delete, organize |
**FileManagementService**:
```python
# domain/site_building/services/file_management_service.py
# business/site_building/services/file_management_service.py
class SiteBuilderFileService:
def get_user_accessible_sites(self, user):
"""Get sites user can access for file management"""
@@ -142,11 +142,11 @@ class SiteBuilderFileService:
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **SiteBlueprint Model** | `domain/site_building/models.py` | Phase 1 | Store site structure |
| **SiteBlueprint Model** | `business/site_building/models.py` | Phase 1 | Store site structure |
**SiteBlueprint Model**:
```python
# domain/site_building/models.py
# business/site_building/models.py
class SiteBlueprint(SiteSectorBaseModel):
name = models.CharField(max_length=255)
description = models.TextField(blank=True)
@@ -195,11 +195,11 @@ class SiteBlueprint(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **PageBlueprint Model** | `domain/site_building/models.py` | Phase 1 | Store page definitions |
| **PageBlueprint Model** | `business/site_building/models.py` | Phase 1 | Store page definitions |
**PageBlueprint Model**:
```python
# domain/site_building/models.py
# business/site_building/models.py
class PageBlueprint(SiteSectorBaseModel):
site_blueprint = models.ForeignKey(SiteBlueprint, on_delete=models.CASCADE, related_name='pages')
slug = models.SlugField(max_length=255)
@@ -246,7 +246,7 @@ class PageBlueprint(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Site Builder Migrations** | `domain/site_building/migrations/` | Phase 1 | Create initial migrations |
| **Site Builder Migrations** | `business/site_building/migrations/` | Phase 1 | Create initial migrations |
---
@@ -294,11 +294,11 @@ class GenerateSiteStructureFunction(BaseAIFunction):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Structure Generation Service** | `domain/site_building/services/structure_generation_service.py` | Phase 1, AI framework | Service to generate site structure |
| **Structure Generation Service** | `business/site_building/services/structure_generation_service.py` | Phase 1, AI framework | Service to generate site structure |
**StructureGenerationService**:
```python
# domain/site_building/services/structure_generation_service.py
# business/site_building/services/structure_generation_service.py
class StructureGenerationService:
def __init__(self):
self.ai_function = GenerateSiteStructureFunction()
@@ -531,13 +531,13 @@ frontend/src/components/shared/
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Extend ContentService** | `domain/content/services/content_generation_service.py` | Phase 1 | Add site page generation method |
| **Extend ContentService** | `business/content/services/content_generation_service.py` | Phase 1 | Add site page generation method |
#### Add Site Page Type
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Add Site Page Type** | `domain/content/models.py` | Phase 1 | Add site page content type |
| **Add Site Page Type** | `business/content/models.py` | Phase 1 | Add site page content type |
#### Page Generation Prompts
@@ -575,12 +575,12 @@ frontend/src/components/shared/
### Backend Tasks
- [ ] Create `domain/site_building/models.py`
- [ ] Create `business/site_building/models.py`
- [ ] Create SiteBlueprint model
- [ ] Create PageBlueprint model
- [ ] Create site builder migrations
- [ ] Create `domain/site_building/services/file_management_service.py`
- [ ] Create `domain/site_building/services/structure_generation_service.py`
- [ ] Create `business/site_building/services/file_management_service.py`
- [ ] Create `business/site_building/services/structure_generation_service.py`
- [ ] Create `infrastructure/ai/functions/generate_site_structure.py`
- [ ] Add site structure prompts
- [ ] Create `modules/site_builder/views.py`

View File

@@ -73,14 +73,14 @@ Entry Point 4: Manual Selection → Linker/Optimizer
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Add source field** | `domain/content/models.py` | Phase 1 | Track content source |
| **Add sync_status field** | `domain/content/models.py` | Phase 1 | Track sync status |
| **Add external_id field** | `domain/content/models.py` | Phase 1 | Store external platform ID |
| **Add sync_metadata field** | `domain/content/models.py` | Phase 1 | Store platform-specific metadata |
| **Add source field** | `business/content/models.py` | Phase 1 | Track content source |
| **Add sync_status field** | `business/content/models.py` | Phase 1 | Track sync status |
| **Add external_id field** | `business/content/models.py` | Phase 1 | Store external platform ID |
| **Add sync_metadata field** | `business/content/models.py` | Phase 1 | Store platform-specific metadata |
**Content Model Extensions**:
```python
# domain/content/models.py
# business/content/models.py
class Content(SiteSectorBaseModel):
# Existing fields...
@@ -129,20 +129,20 @@ class Content(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **InternalLink Model** | `domain/linking/models.py` | Phase 1 | Store link relationships |
| **LinkGraph Model** | `domain/linking/models.py` | Phase 1 | Store link graph |
| **InternalLink Model** | `business/linking/models.py` | Phase 1 | Store link relationships |
| **LinkGraph Model** | `business/linking/models.py` | Phase 1 | Store link graph |
### 4.3 Linker Service
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **LinkerService** | `domain/linking/services/linker_service.py` | Phase 1, ContentService | Main linking service |
| **Link Candidate Engine** | `domain/linking/services/candidate_engine.py` | Phase 1 | Find link candidates |
| **Link Injection Engine** | `domain/linking/services/injection_engine.py` | Phase 1 | Inject links into content |
| **LinkerService** | `business/linking/services/linker_service.py` | Phase 1, ContentService | Main linking service |
| **Link Candidate Engine** | `business/linking/services/candidate_engine.py` | Phase 1 | Find link candidates |
| **Link Injection Engine** | `business/linking/services/injection_engine.py` | Phase 1 | Inject links into content |
**LinkerService**:
```python
# domain/linking/services/linker_service.py
# business/linking/services/linker_service.py
class LinkerService:
def process(self, content_id):
"""Process content for linking"""
@@ -176,20 +176,20 @@ class LinkerService:
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **OptimizationTask Model** | `domain/optimization/models.py` | Phase 1 | Store optimization results |
| **OptimizationScores Model** | `domain/optimization/models.py` | Phase 1 | Store optimization scores |
| **OptimizationTask Model** | `business/optimization/models.py` | Phase 1 | Store optimization results |
| **OptimizationScores Model** | `business/optimization/models.py` | Phase 1 | Store optimization scores |
### 4.6 Optimizer Service (Multiple Entry Points)
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **OptimizerService** | `domain/optimization/services/optimizer_service.py` | Phase 1, ContentService | Main optimization service |
| **Content Analyzer** | `domain/optimization/services/analyzer.py` | Phase 1 | Analyze content quality |
| **OptimizerService** | `business/optimization/services/optimizer_service.py` | Phase 1, ContentService | Main optimization service |
| **Content Analyzer** | `business/optimization/services/analyzer.py` | Phase 1 | Analyze content quality |
| **Optimization AI Function** | `infrastructure/ai/functions/optimize_content.py` | Existing AI framework | AI optimization function |
**OptimizerService**:
```python
# domain/optimization/services/optimizer_service.py
# business/optimization/services/optimizer_service.py
class OptimizerService:
def optimize_from_writer(self, content_id):
"""Entry Point 1: Writer → Optimizer"""
@@ -253,7 +253,7 @@ class OptimizerService:
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **ContentPipelineService** | `domain/content/services/content_pipeline_service.py` | LinkerService, OptimizerService | Orchestrate content pipeline |
| **ContentPipelineService** | `business/content/services/content_pipeline_service.py` | LinkerService, OptimizerService | Orchestrate content pipeline |
**Pipeline Workflow States**:
```
@@ -267,7 +267,7 @@ Content States:
**ContentPipelineService**:
```python
# domain/content/services/content_pipeline_service.py
# business/content/services/content_pipeline_service.py
class ContentPipelineService:
def process_writer_content(self, content_id, stages=['linking', 'optimization']):
"""Writer → Linker → Optimizer pipeline"""
@@ -356,9 +356,9 @@ class ContentPipelineService:
### Backend Tasks
- [ ] Extend Content model with source/sync fields
- [ ] Create `domain/linking/models.py`
- [ ] Create `business/linking/models.py`
- [ ] Create LinkerService
- [ ] Create `domain/optimization/models.py`
- [ ] Create `business/optimization/models.py`
- [ ] Create OptimizerService
- [ ] Create optimization AI function
- [ ] Create ContentPipelineService

View File

@@ -75,13 +75,13 @@ igny8_sites:
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **PublisherService** | `domain/publishing/services/publisher_service.py` | Phase 1 | Main publishing service |
| **SitesRendererAdapter** | `domain/publishing/services/adapters/sites_renderer_adapter.py` | Phase 3 | Adapter for Sites renderer |
| **DeploymentService** | `domain/publishing/services/deployment_service.py` | Phase 3 | Deploy sites to renderer |
| **PublisherService** | `business/publishing/services/publisher_service.py` | Phase 1 | Main publishing service |
| **SitesRendererAdapter** | `business/publishing/services/adapters/sites_renderer_adapter.py` | Phase 3 | Adapter for Sites renderer |
| **DeploymentService** | `business/publishing/services/deployment_service.py` | Phase 3 | Deploy sites to renderer |
**PublisherService**:
```python
# domain/publishing/services/publisher_service.py
# business/publishing/services/publisher_service.py
class PublisherService:
def publish_to_sites(self, site_blueprint):
"""Publish site to Sites renderer"""
@@ -97,8 +97,8 @@ class PublisherService:
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **PublishingRecord Model** | `domain/publishing/models.py` | Phase 1 | Track content publishing |
| **DeploymentRecord Model** | `domain/publishing/models.py` | Phase 3 | Track site deployments |
| **PublishingRecord Model** | `business/publishing/models.py` | Phase 1 | Track content publishing |
| **DeploymentRecord Model** | `business/publishing/models.py` | Phase 3 | Track site deployments |
---
@@ -127,7 +127,7 @@ class PublisherService:
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Layout Configuration** | `domain/site_building/models.py` | Phase 3 | Store layout selection |
| **Layout Configuration** | `business/site_building/models.py` | Phase 3 | Store layout selection |
| **Layout Renderer** | `sites/src/utils/layoutRenderer.ts` | Phase 5 | Render different layouts |
---

View File

@@ -49,11 +49,11 @@
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **SiteIntegration Model** | `domain/integration/models.py` | Phase 1 | Store integration configs |
| **SiteIntegration Model** | `business/integration/models.py` | Phase 1 | Store integration configs |
**SiteIntegration Model**:
```python
# domain/integration/models.py
# business/integration/models.py
class SiteIntegration(SiteSectorBaseModel):
site = models.ForeignKey(Site, on_delete=models.CASCADE)
platform = models.CharField(max_length=50) # 'wordpress', 'shopify', 'custom'
@@ -74,8 +74,8 @@ class SiteIntegration(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **IntegrationService** | `domain/integration/services/integration_service.py` | Phase 1 | Manage integrations |
| **SyncService** | `domain/integration/services/sync_service.py` | Phase 1 | Handle two-way sync |
| **IntegrationService** | `business/integration/services/integration_service.py` | Phase 1 | Manage integrations |
| **SyncService** | `business/integration/services/sync_service.py` | Phase 1 | Handle two-way sync |
---
@@ -85,10 +85,10 @@ class SiteIntegration(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **BaseAdapter** | `domain/publishing/services/adapters/base_adapter.py` | Phase 5 | Base adapter interface |
| **WordPressAdapter** | `domain/publishing/services/adapters/wordpress_adapter.py` | EXISTING (refactor) | WordPress publishing |
| **SitesRendererAdapter** | `domain/publishing/services/adapters/sites_renderer_adapter.py` | Phase 5 | IGNY8 Sites deployment |
| **ShopifyAdapter** | `domain/publishing/services/adapters/shopify_adapter.py` | Phase 5 (future) | Shopify publishing |
| **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 |
---
@@ -98,12 +98,12 @@ class SiteIntegration(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Extend PublisherService** | `domain/publishing/services/publisher_service.py` | Phase 5 | Support multiple destinations |
| **Update PublishingRecord** | `domain/publishing/models.py` | Phase 5 | Track multiple destinations |
| **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
# domain/publishing/services/publisher_service.py
# business/publishing/services/publisher_service.py
class PublisherService:
def publish(self, content, destinations):
"""Publish content to multiple destinations"""

View File

@@ -43,13 +43,13 @@
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Add entity_type field** | `domain/content/models.py` | Phase 1 | Content type field |
| **Add json_blocks field** | `domain/content/models.py` | Phase 1 | Structured content blocks |
| **Add structure_data field** | `domain/content/models.py` | Phase 1 | Content structure data |
| **Add entity_type field** | `business/content/models.py` | Phase 1 | Content type field |
| **Add json_blocks field** | `business/content/models.py` | Phase 1 | Structured content blocks |
| **Add structure_data field** | `business/content/models.py` | Phase 1 | Content structure data |
**Content Model Extensions**:
```python
# domain/content/models.py
# business/content/models.py
class Content(SiteSectorBaseModel):
# Existing fields...
@@ -92,9 +92,9 @@ class Content(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Product Content Generation** | `domain/content/services/content_generation_service.py` | Phase 1 | Generate product content |
| **Service Page Generation** | `domain/content/services/content_generation_service.py` | Phase 1 | Generate service pages |
| **Taxonomy Generation** | `domain/content/services/content_generation_service.py` | Phase 1 | Generate taxonomy pages |
| **Product Content Generation** | `business/content/services/content_generation_service.py` | Phase 1 | Generate product content |
| **Service Page Generation** | `business/content/services/content_generation_service.py` | Phase 1 | Generate service pages |
| **Taxonomy Generation** | `business/content/services/content_generation_service.py` | Phase 1 | Generate taxonomy pages |
---
@@ -104,10 +104,10 @@ class Content(SiteSectorBaseModel):
| Task | File | Dependencies | Implementation |
|------|------|--------------|----------------|
| **Product Linking** | `domain/linking/services/linker_service.py` | Phase 4 | Link products |
| **Taxonomy Linking** | `domain/linking/services/linker_service.py` | Phase 4 | Link taxonomies |
| **Product Optimization** | `domain/optimization/services/optimizer_service.py` | Phase 4 | Optimize products |
| **Taxonomy Optimization** | `domain/optimization/services/optimizer_service.py` | Phase 4 | Optimize taxonomies |
| **Product Linking** | `business/linking/services/linker_service.py` | Phase 4 | Link products |
| **Taxonomy Linking** | `business/linking/services/linker_service.py` | Phase 4 | Link taxonomies |
| **Product Optimization** | `business/optimization/services/optimizer_service.py` | Phase 4 | Optimize products |
| **Taxonomy Optimization** | `business/optimization/services/optimizer_service.py` | Phase 4 | Optimize taxonomies |
---