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:
2026-01-19 18:42:30 +01:00
parent 4f55fe31c8
commit d70a9f38d4
7 changed files with 432 additions and 276 deletions

View File

@@ -0,0 +1,44 @@
# app/exceptions/platform.py
"""
Platform-related exceptions.
Custom exceptions for platform management operations.
"""
from app.exceptions.base import WizamartException
class PlatformNotFoundException(WizamartException):
"""Raised when a platform is not found."""
def __init__(self, code: str):
super().__init__(
message=f"Platform not found: {code}",
error_code="PLATFORM_NOT_FOUND",
status_code=404,
details={"platform_code": code},
)
class PlatformInactiveException(WizamartException):
"""Raised when trying to access an inactive platform."""
def __init__(self, code: str):
super().__init__(
message=f"Platform is inactive: {code}",
error_code="PLATFORM_INACTIVE",
status_code=403,
details={"platform_code": code},
)
class PlatformUpdateException(WizamartException):
"""Raised when platform update fails."""
def __init__(self, code: str, reason: str):
super().__init__(
message=f"Failed to update platform {code}: {reason}",
error_code="PLATFORM_UPDATE_FAILED",
status_code=400,
details={"platform_code": code, "reason": reason},
)