2026-06-29 00:10:10 +02:00
|
|
|
"""SQLAlchemy models for LeoCRM."""
|
2026-06-04 00:06:16 +00:00
|
|
|
|
2026-07-04 01:23:38 +00:00
|
|
|
from app.models.address import Address
|
2026-07-04 01:21:20 +00:00
|
|
|
from app.models.attachment import Attachment
|
2026-08-06 13:23:58 +02:00
|
|
|
from app.models.audit import AuditLog
|
2026-06-29 17:43:56 +02:00
|
|
|
from app.models.auth import ApiToken, PasswordResetToken
|
2026-08-16 01:17:18 +02:00
|
|
|
from app.models.backup import Backup
|
|
|
|
|
from app.models.bank_account import BankAccount
|
2026-08-21 01:58:46 +02:00
|
|
|
from app.models.compliance import ComplianceIncident
|
2026-08-24 13:36:17 +02:00
|
|
|
from app.models.consumer_inbox import ConsumerInbox
|
2026-08-29 02:48:31 +02:00
|
|
|
|
|
|
|
|
# Contact/ContactPerson: lazy via package __getattr__ (Paket 6) — the physical
|
|
|
|
|
# model lives in app.plugins.builtins.contacts.models; importing the plugin
|
|
|
|
|
# framework while app.models is still initializing caused a proven circular
|
|
|
|
|
# ImportError (app.core.auth -> app.models.session -> ... -> app.plugins).
|
2026-07-20 01:33:44 +02:00
|
|
|
from app.models.contact_folder import ContactFolder
|
2026-07-23 23:58:45 +02:00
|
|
|
from app.models.contact_merge import ContactMergeHistory
|
2026-08-16 01:17:18 +02:00
|
|
|
from app.models.currency import Currency
|
|
|
|
|
from app.models.custom_field_definition import CustomFieldDefinition
|
|
|
|
|
from app.models.entity_history import EntityHistory
|
2026-07-29 01:28:13 +02:00
|
|
|
from app.models.entity_permission import EntityPermission
|
2026-07-29 02:42:16 +02:00
|
|
|
from app.models.entity_policy import EntityPolicy
|
2026-07-15 21:59:45 +02:00
|
|
|
from app.models.group import Group, UserGroup
|
2026-07-15 21:00:32 +02:00
|
|
|
from app.models.notification import Notification, NotificationPreference, NotificationType
|
2026-08-29 02:48:31 +02:00
|
|
|
from app.models.outbox import EventOutbox, OutboxDelivery
|
2026-08-16 01:17:18 +02:00
|
|
|
from app.models.owned_mixin import OwnedMixin
|
|
|
|
|
from app.models.permission_delegation import PermissionDelegation
|
|
|
|
|
from app.models.permission_template import PermissionTemplate
|
2026-06-29 01:18:46 +02:00
|
|
|
from app.models.plugin import Plugin, PluginMigration
|
2026-06-29 17:43:56 +02:00
|
|
|
from app.models.role import Role
|
2026-08-16 01:17:18 +02:00
|
|
|
from app.models.saved_view import SavedView
|
2026-07-04 01:21:20 +00:00
|
|
|
from app.models.sequence import Sequence
|
2026-06-29 17:43:56 +02:00
|
|
|
from app.models.session import Session
|
2026-07-04 01:21:20 +00:00
|
|
|
from app.models.system_settings import SystemSettings
|
|
|
|
|
from app.models.tax import TaxRate
|
2026-06-29 17:43:56 +02:00
|
|
|
from app.models.tenant import Tenant
|
|
|
|
|
from app.models.user import User, UserTenant
|
2026-07-26 03:17:40 +02:00
|
|
|
from app.models.webhook import Webhook
|
2026-07-04 01:21:20 +00:00
|
|
|
from app.models.workflow import Workflow, WorkflowInstance, WorkflowStepHistory
|
2026-06-04 00:06:16 +00:00
|
|
|
|
|
|
|
|
__all__ = [
|
2026-06-29 17:43:56 +02:00
|
|
|
"Tenant",
|
|
|
|
|
"User",
|
|
|
|
|
"UserTenant",
|
|
|
|
|
"Role",
|
2026-07-15 21:59:45 +02:00
|
|
|
"Group",
|
|
|
|
|
"UserGroup",
|
2026-06-29 17:43:56 +02:00
|
|
|
"Session",
|
|
|
|
|
"AuditLog",
|
|
|
|
|
"Notification",
|
2026-07-15 21:00:32 +02:00
|
|
|
"NotificationType",
|
|
|
|
|
"NotificationPreference",
|
2026-06-29 17:43:56 +02:00
|
|
|
"PasswordResetToken",
|
|
|
|
|
"ApiToken",
|
2026-08-21 01:58:46 +02:00
|
|
|
"ComplianceIncident",
|
2026-06-29 17:43:56 +02:00
|
|
|
"Contact",
|
2026-07-19 21:12:49 +02:00
|
|
|
"ContactPerson",
|
2026-07-20 01:33:44 +02:00
|
|
|
"ContactFolder",
|
2026-07-23 23:58:45 +02:00
|
|
|
"ContactMergeHistory",
|
2026-07-29 01:28:13 +02:00
|
|
|
"EntityPermission",
|
2026-07-29 13:02:33 +02:00
|
|
|
"ConsumerInbox",
|
2026-07-29 02:47:03 +02:00
|
|
|
"PermissionDelegation",
|
|
|
|
|
"PermissionTemplate",
|
2026-07-29 02:42:16 +02:00
|
|
|
"EntityPolicy",
|
2026-07-29 01:28:13 +02:00
|
|
|
"OwnedMixin",
|
2026-07-23 08:42:26 +02:00
|
|
|
"EntityHistory",
|
2026-07-04 00:22:07 +00:00
|
|
|
"Currency",
|
2026-07-04 00:23:35 +00:00
|
|
|
"TaxRate",
|
2026-07-04 00:24:40 +00:00
|
|
|
"Sequence",
|
2026-07-04 00:26:21 +00:00
|
|
|
"SystemSettings",
|
2026-07-04 00:29:38 +00:00
|
|
|
"Attachment",
|
2026-07-04 01:23:38 +00:00
|
|
|
"Address",
|
2026-07-25 02:11:29 +02:00
|
|
|
"BankAccount",
|
2026-06-29 17:43:56 +02:00
|
|
|
"Plugin",
|
|
|
|
|
"PluginMigration",
|
2026-07-26 03:17:40 +02:00
|
|
|
"Backup",
|
2026-07-26 03:02:25 +02:00
|
|
|
"CustomFieldDefinition",
|
2026-07-26 03:17:40 +02:00
|
|
|
"Webhook",
|
2026-06-29 17:43:56 +02:00
|
|
|
"Workflow",
|
|
|
|
|
"WorkflowInstance",
|
|
|
|
|
"WorkflowStepHistory",
|
2026-07-28 14:36:52 +02:00
|
|
|
"SavedView",
|
2026-06-29 02:44:13 +02:00
|
|
|
]
|
2026-07-29 17:52:55 +02:00
|
|
|
from app.models.entity_attachment import EntityAttachment # noqa: F401
|
2026-08-16 01:17:18 +02:00
|
|
|
from app.models.workspace import ( # noqa: F401
|
|
|
|
|
Workspace,
|
|
|
|
|
WorkspaceModule,
|
|
|
|
|
WorkspaceUser,
|
|
|
|
|
WorkspaceWidget,
|
|
|
|
|
)
|
2026-08-29 02:48:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# ── Lazy Contact re-export (Paket 6, #357) ──────────────────────────────────
|
|
|
|
|
# The physical home of Contact/ContactPerson is the ContactsPlugin
|
|
|
|
|
# (app.plugins.builtins.contacts.models). Resolving them lazily via package
|
|
|
|
|
# __getattr__ keeps ``from app.models import *`` (alembic/env.py) working
|
|
|
|
|
# while avoiding a plugin-framework import during app.models initialization
|
|
|
|
|
# (proven circular ImportError, see app/models/contact.py).
|
|
|
|
|
def __getattr__(name: str):
|
|
|
|
|
if name in {"Contact", "ContactPerson"}:
|
|
|
|
|
from app.models.contact import Contact, ContactPerson
|
|
|
|
|
|
|
|
|
|
return {"Contact": Contact, "ContactPerson": ContactPerson}[name]
|
|
|
|
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|