refactor: migrate modules from re-exports to canonical implementations
Move actual code implementations into module directories: - orders: 5 services, 4 models, order/invoice schemas - inventory: 3 services, 2 models, 30+ schemas - customers: 3 services, 2 models, customer schemas - messaging: 3 services, 2 models, message/notification schemas - monitoring: background_tasks_service - marketplace: 5+ services including letzshop submodule - dev_tools: code_quality_service, test_runner_service - billing: billing_service - contracts: definition.py Legacy files in app/services/, models/database/, models/schema/ now re-export from canonical module locations for backwards compatibility. Architecture validator passes with 0 errors. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
54
app/modules/messaging/models/admin_notification.py
Normal file
54
app/modules/messaging/models/admin_notification.py
Normal file
@@ -0,0 +1,54 @@
|
||||
# app/modules/messaging/models/admin_notification.py
|
||||
"""
|
||||
Admin notification database model.
|
||||
|
||||
This model handles admin-specific notifications for system alerts and warnings.
|
||||
"""
|
||||
|
||||
from sqlalchemy import (
|
||||
Boolean,
|
||||
Column,
|
||||
DateTime,
|
||||
ForeignKey,
|
||||
Integer,
|
||||
JSON,
|
||||
String,
|
||||
Text,
|
||||
)
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from app.core.database import Base
|
||||
from models.database.base import TimestampMixin
|
||||
|
||||
|
||||
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}')>"
|
||||
Reference in New Issue
Block a user