blurpritn adn site builde cleanup
This commit is contained in:
@@ -115,7 +115,7 @@ class SitesRendererAdapter(BaseAdapter):
|
||||
Returns:
|
||||
dict: Site definition structure
|
||||
"""
|
||||
from igny8_core.business.content.models import Tasks, Content, ContentClusterMap, ContentTaxonomyMap
|
||||
from igny8_core.business.content.models import Tasks, Content, ContentClusterMap
|
||||
|
||||
# Get all pages
|
||||
pages = []
|
||||
@@ -129,8 +129,7 @@ class SitesRendererAdapter(BaseAdapter):
|
||||
'cluster_id': None,
|
||||
'cluster_name': None,
|
||||
'content_structure': None,
|
||||
'taxonomy_id': None,
|
||||
'taxonomy_name': None,
|
||||
'taxonomy_terms': [], # Changed from taxonomy_id/taxonomy_name to list of terms
|
||||
'internal_links': []
|
||||
}
|
||||
|
||||
@@ -180,11 +179,13 @@ class SitesRendererAdapter(BaseAdapter):
|
||||
page_metadata['cluster_name'] = cluster_map.cluster.name
|
||||
page_metadata['content_structure'] = cluster_map.role or task.content_structure if task else None
|
||||
|
||||
# Get taxonomy mapping
|
||||
taxonomy_map = ContentTaxonomyMap.objects.filter(content=content).first()
|
||||
if taxonomy_map and taxonomy_map.taxonomy:
|
||||
page_metadata['taxonomy_id'] = taxonomy_map.taxonomy.id
|
||||
page_metadata['taxonomy_name'] = taxonomy_map.taxonomy.name
|
||||
# Get taxonomy terms using M2M relationship
|
||||
taxonomy_terms = content.taxonomy_terms.all()
|
||||
if taxonomy_terms.exists():
|
||||
page_metadata['taxonomy_terms'] = [
|
||||
{'id': term.id, 'name': term.name, 'type': term.taxonomy_type}
|
||||
for term in taxonomy_terms
|
||||
]
|
||||
|
||||
# Get internal links from content
|
||||
if content.internal_links:
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
"""
|
||||
Publisher Service
|
||||
Phase 5: Sites Renderer & Publishing
|
||||
Phase 5: Content Publishing
|
||||
|
||||
Main publishing orchestrator for content and sites.
|
||||
Main publishing orchestrator for content.
|
||||
Legacy: SiteBlueprint publishing removed.
|
||||
"""
|
||||
import logging
|
||||
from typing import Optional, List, Dict, Any
|
||||
|
||||
from igny8_core.business.publishing.models import PublishingRecord, DeploymentRecord
|
||||
from igny8_core.business.site_building.models import SiteBlueprint
|
||||
# Removed: from igny8_core.business.site_building.models import SiteBlueprint
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PublisherService:
|
||||
"""
|
||||
Main publishing service for content and sites.
|
||||
Main publishing service for content.
|
||||
Routes to appropriate adapters based on destination.
|
||||
Legacy: SiteBlueprint publishing removed.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
@@ -27,36 +29,6 @@ class PublisherService:
|
||||
"""Lazy load adapters to avoid circular imports"""
|
||||
pass # Will be implemented when adapters are created
|
||||
|
||||
def publish_to_sites(self, site_blueprint: SiteBlueprint) -> Dict[str, Any]:
|
||||
"""
|
||||
Publish site to Sites renderer.
|
||||
|
||||
Args:
|
||||
site_blueprint: SiteBlueprint instance to deploy
|
||||
|
||||
Returns:
|
||||
dict: Deployment result with status and deployment record
|
||||
"""
|
||||
from igny8_core.business.publishing.services.adapters.sites_renderer_adapter import SitesRendererAdapter
|
||||
|
||||
adapter = SitesRendererAdapter()
|
||||
return adapter.deploy(site_blueprint)
|
||||
|
||||
def get_deployment_status(self, site_blueprint: SiteBlueprint) -> Optional[DeploymentRecord]:
|
||||
"""
|
||||
Get deployment status for a site.
|
||||
|
||||
Args:
|
||||
site_blueprint: SiteBlueprint instance
|
||||
|
||||
Returns:
|
||||
DeploymentRecord or None
|
||||
"""
|
||||
from igny8_core.business.publishing.services.deployment_service import DeploymentService
|
||||
|
||||
service = DeploymentService()
|
||||
return service.get_status(site_blueprint)
|
||||
|
||||
def publish_content(
|
||||
self,
|
||||
content_id: int,
|
||||
@@ -216,7 +188,7 @@ class PublisherService:
|
||||
Publish content to multiple destinations.
|
||||
|
||||
Args:
|
||||
content: Content instance or SiteBlueprint
|
||||
content: Content instance
|
||||
destinations: List of destination configs, e.g.:
|
||||
[
|
||||
{'platform': 'wordpress', 'site_url': '...', 'username': '...', 'app_password': '...'},
|
||||
@@ -272,8 +244,7 @@ class PublisherService:
|
||||
account=account,
|
||||
site=content.site,
|
||||
sector=content.sector,
|
||||
content=content if hasattr(content, 'id') and not isinstance(content, SiteBlueprint) else None,
|
||||
site_blueprint=content if isinstance(content, SiteBlueprint) else None,
|
||||
content=content if hasattr(content, 'id') else None,
|
||||
destination=platform,
|
||||
status='published' if result.get('success') else 'failed',
|
||||
destination_id=result.get('external_id'),
|
||||
@@ -319,7 +290,7 @@ class PublisherService:
|
||||
Publish content using site integrations.
|
||||
|
||||
Args:
|
||||
content: Content instance or SiteBlueprint
|
||||
content: Content instance
|
||||
site: Site instance
|
||||
account: Account instance
|
||||
platforms: Optional list of platforms to publish to (all active if None)
|
||||
|
||||
Reference in New Issue
Block a user