Spaces:
Sleeping
Sleeping
| """ | |
| Models Package - SQLAlchemy ORM Models | |
| Import order is CRITICAL to avoid circular dependencies and mapper initialization errors. | |
| Base models and independent models first, then dependent models. | |
| IMPORTANT: | |
| - CustomerCommunication MUST be imported BEFORE Customer to resolve the relationship | |
| - Models must be imported in dependency order to avoid mapper initialization failures | |
| """ | |
| # Base and Enums (no dependencies) | |
| from app.models.base import BaseModel | |
| from app.models.enums import * | |
| # Core independent models (minimal dependencies) | |
| from app.models.user import User | |
| from app.models.notification import Notification, NotificationChannel, NotificationStatus | |
| from app.models.audit_log import AuditLog | |
| from app.models.document import Document | |
| # Organization models | |
| from app.models.client import Client | |
| from app.models.contractor import Contractor | |
| # Project structure models (must come before projects) | |
| from app.models.project import ProjectRegion, ProjectRole, ProjectSubcontractor, Project | |
| from app.models.project_team import ProjectTeam | |
| # Customer and related (CustomerCommunication MUST come before Customer!) | |
| from app.models.customer_communication import CustomerCommunication | |
| from app.models.customer import Customer | |
| # Sales and subscriptions | |
| from app.models.sales_order import SalesOrder | |
| from app.models.subscription import Subscription | |
| # Tasks | |
| from app.models.task import Task | |
| # Tickets and related (import in dependency order) | |
| from app.models.ticket_comment import TicketComment | |
| from app.models.ticket_expense import TicketExpense | |
| from app.models.ticket_image import TicketImage | |
| from app.models.ticket_progress_report import TicketProgressReport | |
| from app.models.ticket_incident_report import TicketIncidentReport | |
| from app.models.ticket_status_history import TicketStatusHistory | |
| from app.models.ticket import Ticket | |
| from app.models.ticket_assignment import TicketAssignment | |
| # Incidents | |
| from app.models.incident import Incident | |
| # Finance models | |
| from app.models.contractor_invoice import ContractorInvoice | |
| from app.models.timesheet import Timesheet | |
| from app.models.finance import ProjectFinance, PaymentLog | |
| # User-related association tables | |
| from app.models.user_payroll import UserPayroll | |
| from app.models.user_financial_account import UserFinancialAccount | |
| from app.models.user_document_link import UserDocumentLink | |
| from app.models.user_asset_assignment import UserAssetAssignment | |
| # Inventory models | |
| from app.models.inventory import ProjectInventory, ProjectInventoryDistribution, InventoryAssignment | |
| # Auth models | |
| from app.models.invitation import UserInvitation | |
| __all__ = [ | |
| # Base | |
| "BaseModel", | |
| # Users & Auth | |
| "User", | |
| "UserInvitation", | |
| "UserPayroll", | |
| "UserFinancialAccount", | |
| "UserDocumentLink", | |
| "UserAssetAssignment", | |
| # Organizations | |
| "Client", | |
| "Contractor", | |
| # Customers | |
| "Customer", | |
| "CustomerCommunication", | |
| # Projects & Structure | |
| "Project", | |
| "ProjectRegion", | |
| "ProjectRole", | |
| "ProjectSubcontractor", | |
| "ProjectTeam", | |
| # Sales & Subscriptions | |
| "SalesOrder", | |
| "Subscription", | |
| # Tasks | |
| "Task", | |
| # Tickets | |
| "Ticket", | |
| "TicketAssignment", | |
| "TicketComment", | |
| "TicketExpense", | |
| "TicketImage", | |
| "TicketProgressReport", | |
| "TicketIncidentReport", | |
| "TicketStatusHistory", | |
| # Incidents | |
| "Incident", | |
| # Finance | |
| "ContractorInvoice", | |
| "Timesheet", | |
| "ProjectFinance", | |
| "PaymentLog", | |
| # Inventory | |
| "ProjectInventory", | |
| "ProjectInventoryDistribution", | |
| "InventoryAssignment", | |
| # System | |
| "Notification", | |
| "NotificationChannel", | |
| "NotificationStatus", | |
| "AuditLog", | |
| "Document", | |
| ] | |