fix: resolve architecture validation errors
- Create platform_service.py to move DB queries from platforms.py API - Create platform.py exceptions for PlatformNotFoundException - Update platforms.py API to use platform_service - Update vendor/content_pages.py to use vendor_service - Add get_vendor_by_id_optional method to VendorService - Fix platforms.js: add centralized logger and init guard - Fix content-page-edit.html: use modal macro instead of inline modal All 21 architecture validation errors resolved. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
11
app/api/v1/vendor/content_pages.py
vendored
11
app/api/v1/vendor/content_pages.py
vendored
@@ -19,8 +19,11 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.api.deps import get_current_vendor_api, get_db
|
||||
from app.services.content_page_service import content_page_service
|
||||
from app.services.vendor_service import VendorService
|
||||
from models.database.user import User
|
||||
|
||||
vendor_service = VendorService()
|
||||
|
||||
router = APIRouter(prefix="/content-pages")
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -272,9 +275,7 @@ def get_cms_usage(
|
||||
|
||||
Returns page counts and limits based on subscription tier.
|
||||
"""
|
||||
from models.database.vendor import Vendor
|
||||
|
||||
vendor = db.query(Vendor).filter(Vendor.id == current_user.token_vendor_id).first()
|
||||
vendor = vendor_service.get_vendor_by_id_optional(db, current_user.token_vendor_id)
|
||||
if not vendor:
|
||||
return CMSUsageResponse(
|
||||
total_pages=0,
|
||||
@@ -336,10 +337,8 @@ def get_platform_default(
|
||||
|
||||
Useful for vendors to view the original before/after overriding.
|
||||
"""
|
||||
from models.database.vendor import Vendor
|
||||
|
||||
# Get vendor's platform
|
||||
vendor = db.query(Vendor).filter(Vendor.id == current_user.token_vendor_id).first()
|
||||
vendor = vendor_service.get_vendor_by_id_optional(db, current_user.token_vendor_id)
|
||||
platform_id = 1 # Default to OMS
|
||||
|
||||
if vendor and vendor.platforms:
|
||||
|
||||
Reference in New Issue
Block a user