refactor(arch): eliminate all cross-module model imports in service layer
Some checks failed
CI / ruff (push) Successful in 9s
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / pytest (push) Has been cancelled

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:
2026-02-27 06:13:15 +01:00
parent e3a52f6536
commit 86e85a98b8
66 changed files with 2242 additions and 1295 deletions

View File

@@ -155,8 +155,8 @@ class BillingService:
trial_days = settings.stripe_trial_days
# Get merchant for Stripe customer creation
from app.modules.tenancy.models import Merchant
merchant = db.query(Merchant).filter(Merchant.id == merchant_id).first()
from app.modules.tenancy.services.merchant_service import merchant_service
merchant = merchant_service.get_merchant_by_id_optional(db, merchant_id)
session = stripe_service.create_checkout_session(
db=db,
@@ -494,8 +494,8 @@ class BillingService:
if not addon.stripe_price_id:
raise BillingException(f"Stripe price not configured for add-on '{addon_code}'")
from app.modules.tenancy.models import Store
store = db.query(Store).filter(Store.id == store_id).first()
from app.modules.tenancy.services.store_service import store_service
store = store_service.get_store_by_id_optional(db, store_id)
session = stripe_service.create_checkout_session(
db=db,