fix: resolve all remaining legacy import issues
- Update models/database/__init__.py to import from module locations - Update models/schema/__init__.py to remove deleted modules - Update models/__init__.py to import Inventory from module - Remove duplicate AdminNotification from models/database/admin.py - Fix monitoring module to import AdminNotification from messaging - Update stats schema imports in admin/vendor API - Update notification schema imports - Add order_item_exception.py schema to orders module - Fix app/api/v1/__init__.py to use storefront instead of shop - Add cms_admin_pages import to main.py - Fix password_reset_token imports - Fix AdminNotification test imports Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,13 +6,15 @@ from . import schema
|
||||
|
||||
# Database models (SQLAlchemy)
|
||||
from .database.base import Base
|
||||
from .database.inventory import Inventory
|
||||
from .database.marketplace_import_job import MarketplaceImportJob
|
||||
from .database.marketplace_product import MarketplaceProduct
|
||||
from .database.product import Product
|
||||
from .database.user import User
|
||||
from .database.vendor import Vendor
|
||||
|
||||
# Module-based models
|
||||
from app.modules.inventory.models import Inventory
|
||||
|
||||
# Export database models for Alembic
|
||||
__all__ = [
|
||||
"Base",
|
||||
|
||||
@@ -25,11 +25,11 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
from .admin import (
|
||||
AdminAuditLog,
|
||||
AdminNotification,
|
||||
AdminSession,
|
||||
AdminSetting,
|
||||
PlatformAlert,
|
||||
)
|
||||
from app.modules.messaging.models import AdminNotification
|
||||
from .admin_menu_config import AdminMenuConfig, FrontendType, MANDATORY_MENU_ITEMS
|
||||
from .admin_platform import AdminPlatform
|
||||
from .architecture_scan import (
|
||||
@@ -43,15 +43,15 @@ from .company import Company
|
||||
from .platform import Platform
|
||||
from .platform_module import PlatformModule
|
||||
from .vendor_platform import VendorPlatform
|
||||
from .customer import Customer, CustomerAddress
|
||||
from .password_reset_token import PasswordResetToken
|
||||
from app.modules.customers.models import Customer, CustomerAddress
|
||||
from app.modules.customers.models import PasswordResetToken
|
||||
from .email import EmailCategory, EmailLog, EmailStatus, EmailTemplate
|
||||
from .vendor_email_template import VendorEmailTemplate
|
||||
from .vendor_email_settings import EmailProvider, VendorEmailSettings, PREMIUM_EMAIL_PROVIDERS
|
||||
from .feature import Feature, FeatureCategory, FeatureCode, FeatureUILocation
|
||||
from .inventory import Inventory
|
||||
from .inventory_transaction import InventoryTransaction, TransactionType
|
||||
from .invoice import (
|
||||
from app.modules.inventory.models import Inventory
|
||||
from app.modules.inventory.models import InventoryTransaction, TransactionType
|
||||
from app.modules.orders.models import (
|
||||
Invoice,
|
||||
InvoiceStatus,
|
||||
VATRegime,
|
||||
@@ -64,7 +64,7 @@ from .letzshop import (
|
||||
VendorLetzshopCredentials,
|
||||
)
|
||||
from .marketplace_import_job import MarketplaceImportError, MarketplaceImportJob
|
||||
from .message import (
|
||||
from app.modules.messaging.models import (
|
||||
Conversation,
|
||||
ConversationParticipant,
|
||||
ConversationType,
|
||||
@@ -80,8 +80,8 @@ from .marketplace_product import (
|
||||
from .media import MediaFile, ProductMedia
|
||||
from .marketplace_product_translation import MarketplaceProductTranslation
|
||||
from .onboarding import OnboardingStatus, OnboardingStep, VendorOnboarding
|
||||
from .order import Order, OrderItem
|
||||
from .order_item_exception import OrderItemException
|
||||
from app.modules.orders.models import Order, OrderItem
|
||||
from app.modules.orders.models import OrderItemException
|
||||
from .product import Product
|
||||
from .product_translation import ProductTranslation
|
||||
from .subscription import (
|
||||
|
||||
@@ -59,37 +59,8 @@ class AdminAuditLog(Base, TimestampMixin):
|
||||
return f"<AdminAuditLog(id={self.id}, action='{self.action}', target={self.target_type}:{self.target_id})>"
|
||||
|
||||
|
||||
class AdminNotification(Base, TimestampMixin):
|
||||
"""
|
||||
Admin-specific notifications for system alerts and warnings.
|
||||
|
||||
Different from vendor/customer notifications - these are for platform
|
||||
administrators to track system health and issues requiring attention.
|
||||
"""
|
||||
|
||||
__tablename__ = "admin_notifications"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
type = Column(
|
||||
String(50), nullable=False, index=True
|
||||
) # system_alert, vendor_issue, import_failure
|
||||
priority = Column(
|
||||
String(20), default="normal", index=True
|
||||
) # low, normal, high, critical
|
||||
title = Column(String(200), nullable=False)
|
||||
message = Column(Text, nullable=False)
|
||||
is_read = Column(Boolean, default=False, index=True)
|
||||
read_at = Column(DateTime, nullable=True)
|
||||
read_by_user_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
action_required = Column(Boolean, default=False, index=True)
|
||||
action_url = Column(String(500)) # Link to relevant admin page
|
||||
notification_metadata = Column(JSON) # Additional contextual data
|
||||
|
||||
# Relationships
|
||||
read_by = relationship("User", foreign_keys=[read_by_user_id])
|
||||
|
||||
def __repr__(self):
|
||||
return f"<AdminNotification(id={self.id}, type='{self.type}', priority='{self.priority}')>"
|
||||
# AdminNotification has been moved to app/modules/messaging/models/admin_notification.py
|
||||
# It's re-exported via models/database/__init__.py for backwards compatibility
|
||||
|
||||
|
||||
class AdminSetting(Base, TimestampMixin):
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
# models/schema/__init__.py
|
||||
"""API models package - Pydantic models for request/response validation."""
|
||||
"""API models package - Pydantic models for request/response validation.
|
||||
|
||||
# Import API model modules
|
||||
Note: Many schemas have been migrated to their respective modules:
|
||||
- Customer schemas: app.modules.customers.schemas
|
||||
- Order schemas: app.modules.orders.schemas
|
||||
- Inventory schemas: app.modules.inventory.schemas
|
||||
- Message schemas: app.modules.messaging.schemas
|
||||
- Cart schemas: app.modules.cart.schemas
|
||||
"""
|
||||
|
||||
# Import API model modules that remain in legacy location
|
||||
from . import (
|
||||
auth,
|
||||
base,
|
||||
email,
|
||||
inventory,
|
||||
invoice,
|
||||
marketplace_import_job,
|
||||
marketplace_product,
|
||||
message,
|
||||
onboarding,
|
||||
stats,
|
||||
vendor,
|
||||
)
|
||||
|
||||
@@ -23,12 +27,8 @@ __all__ = [
|
||||
"base",
|
||||
"auth",
|
||||
"email",
|
||||
"invoice",
|
||||
"marketplace_product",
|
||||
"message",
|
||||
"inventory",
|
||||
"onboarding",
|
||||
"vendor",
|
||||
"marketplace_import_job",
|
||||
"stats",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user