refactor(arch): eliminate all cross-module model imports in service layer
Some checks failed
Some checks failed
Enforce MOD-025/MOD-026 rules: zero top-level cross-module model imports remain in any service file. All 66 files migrated using deferred import patterns (method-body, _get_model() helpers, instance-cached self._Model) and new cross-module service methods in tenancy. Documentation updated with Pattern 6 (deferred imports), migration plan marked complete, and violations status reflects 84→0 service-layer violations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -60,22 +60,9 @@ class ContentPageService:
|
||||
Returns:
|
||||
Platform ID or None if no platform association found
|
||||
"""
|
||||
from app.modules.tenancy.models import StorePlatform
|
||||
from app.modules.tenancy.services.platform_service import platform_service
|
||||
|
||||
primary_sp = (
|
||||
db.query(StorePlatform)
|
||||
.filter(StorePlatform.store_id == store_id, StorePlatform.is_primary.is_(True))
|
||||
.first()
|
||||
)
|
||||
if primary_sp:
|
||||
return primary_sp.platform_id
|
||||
# Fallback: any active store_platform
|
||||
any_sp = (
|
||||
db.query(StorePlatform)
|
||||
.filter(StorePlatform.store_id == store_id, StorePlatform.is_active.is_(True))
|
||||
.first()
|
||||
)
|
||||
return any_sp.platform_id if any_sp else None
|
||||
return platform_service.get_primary_platform_id_for_store(db, store_id)
|
||||
|
||||
@staticmethod
|
||||
def resolve_platform_id_or_raise(db: Session, store_id: int) -> int:
|
||||
|
||||
Reference in New Issue
Block a user