b3e259fc25
Check Cross-Plugin Imports / check (push) Has been cancelled
- dashboards-Tabelle (Layout JSONB, Tabs, is_default, partial unique name index) - 6 CRUD-Endpoints /api/v1/dashboards, Owner-only (saved_views-Präzedenz), Audit - Lazy Default-Seed aus MiniApp-Registry (permission-gefiltert, 12-Spalten-Flow) - CORE_PERMISSIONS dashboard:read/write (fixt Phantom-Permission in dashboard.py) - Migration 0144: RLS crm_api+crm_worker + konvergenter Fix der 3 Phase-L-Policies - Tests: test_dashboards_backend.py 23/23 (TDD rot->grün); Regression 162/163
107 lines
3.8 KiB
Python
107 lines
3.8 KiB
Python
"""SQLAlchemy models for LeoCRM."""
|
|
|
|
from app.models.address import Address
|
|
from app.models.attachment import Attachment
|
|
from app.models.audit import AuditLog
|
|
from app.models.auth import ApiToken, PasswordResetToken
|
|
from app.models.backup import Backup
|
|
from app.models.bank_account import BankAccount
|
|
from app.models.compliance import ComplianceIncident
|
|
from app.models.consumer_inbox import ConsumerInbox
|
|
|
|
# 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).
|
|
from app.models.contact_folder import ContactFolder
|
|
from app.models.contact_merge import ContactMergeHistory
|
|
from app.models.currency import Currency
|
|
from app.models.custom_field_definition import CustomFieldDefinition
|
|
from app.models.dashboard import Dashboard
|
|
from app.models.entity_history import EntityHistory
|
|
from app.models.entity_permission import EntityPermission
|
|
from app.models.entity_policy import EntityPolicy
|
|
from app.models.group import Group, UserGroup
|
|
from app.models.notification import Notification, NotificationPreference, NotificationType
|
|
from app.models.outbox import EventOutbox, OutboxDelivery # noqa: F401
|
|
from app.models.owned_mixin import OwnedMixin
|
|
from app.models.permission_delegation import PermissionDelegation
|
|
from app.models.permission_template import PermissionTemplate
|
|
from app.models.plugin import Plugin, PluginMigration
|
|
from app.models.role import Role
|
|
from app.models.saved_view import SavedView
|
|
from app.models.sequence import Sequence
|
|
from app.models.session import Session
|
|
from app.models.system_settings import SystemSettings
|
|
from app.models.tax import TaxRate
|
|
from app.models.tenant import Tenant
|
|
from app.models.user import User, UserTenant
|
|
from app.models.webhook import Webhook
|
|
from app.models.workflow import Workflow, WorkflowInstance, WorkflowStepHistory
|
|
|
|
__all__ = [
|
|
"Tenant",
|
|
"User",
|
|
"UserTenant",
|
|
"Role",
|
|
"Group",
|
|
"UserGroup",
|
|
"Session",
|
|
"AuditLog",
|
|
"Notification",
|
|
"NotificationType",
|
|
"NotificationPreference",
|
|
"PasswordResetToken",
|
|
"ApiToken",
|
|
"ComplianceIncident",
|
|
"Contact",
|
|
"ContactPerson",
|
|
"ContactFolder",
|
|
"ContactMergeHistory",
|
|
"EntityPermission",
|
|
"ConsumerInbox",
|
|
"PermissionDelegation",
|
|
"PermissionTemplate",
|
|
"EntityPolicy",
|
|
"OwnedMixin",
|
|
"EntityHistory",
|
|
"Currency",
|
|
"TaxRate",
|
|
"Sequence",
|
|
"SystemSettings",
|
|
"Attachment",
|
|
"Address",
|
|
"BankAccount",
|
|
"Plugin",
|
|
"PluginMigration",
|
|
"Backup",
|
|
"CustomFieldDefinition",
|
|
"Webhook",
|
|
"Workflow",
|
|
"WorkflowInstance",
|
|
"WorkflowStepHistory",
|
|
"SavedView",
|
|
"Dashboard",
|
|
]
|
|
from app.models.entity_attachment import EntityAttachment # noqa: F401
|
|
from app.models.workspace import ( # noqa: F401
|
|
Workspace,
|
|
WorkspaceModule,
|
|
WorkspaceUser,
|
|
WorkspaceWidget,
|
|
)
|
|
|
|
|
|
# ── 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}")
|