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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user