admin felület különválasztva
This commit is contained in:
@@ -22,6 +22,16 @@ class SubscriptionTier(Base):
|
||||
rules: Mapped[dict] = mapped_column(JSONB, server_default=text("'{}'::jsonb")) # pl. {"max_vehicles": 5}
|
||||
is_custom: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
|
||||
# ── P0 3D CAPABILITY MATRIX: feature_capabilities JSONB ──
|
||||
# Defines what features/capabilities this subscription tier unlocks.
|
||||
# Example: {"can_export_data": True, "can_use_analytics": True, "max_vehicles": 50}
|
||||
feature_capabilities: Mapped[dict] = mapped_column(
|
||||
JSONB,
|
||||
nullable=False,
|
||||
default=dict,
|
||||
server_default=text("'{}'::jsonb")
|
||||
)
|
||||
|
||||
class OrganizationSubscription(Base):
|
||||
"""
|
||||
Szervezetek aktuális előfizetései és azok érvényessége.
|
||||
|
||||
@@ -56,6 +56,17 @@ class CostCategory(Base):
|
||||
visibility: Mapped[str] = mapped_column(String(20), default="both", server_default="'both'")
|
||||
min_tier: Mapped[str] = mapped_column(String(20), default="free", server_default="'free'")
|
||||
accounting_code: Mapped[Optional[str]] = mapped_column(String(50), nullable=True)
|
||||
|
||||
# ── P0 3D CAPABILITY MATRIX: required_feature ──
|
||||
# If set, this category is ONLY visible to organizations whose resolved
|
||||
# capability matrix has this feature key set to True.
|
||||
# Example: "can_use_analytics" → only orgs with that capability see this category.
|
||||
required_feature: Mapped[Optional[str]] = mapped_column(
|
||||
String(50),
|
||||
nullable=True,
|
||||
comment="Feature key required to access this cost category"
|
||||
)
|
||||
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), onupdate=func.now(), server_default=func.now())
|
||||
|
||||
|
||||
@@ -151,6 +151,17 @@ class Organization(Base):
|
||||
index=True
|
||||
)
|
||||
|
||||
# ── P0 3D CAPABILITY MATRIX: custom_features JSONB ──
|
||||
# Organization-specific feature overrides on top of the subscription tier defaults.
|
||||
# These values MERGE with (and override) tier.feature_capabilities at runtime.
|
||||
# Example: {"can_export_data": True, "can_use_analytics": False}
|
||||
custom_features: Mapped[dict] = mapped_column(
|
||||
JSONB,
|
||||
nullable=False,
|
||||
default=dict,
|
||||
server_default=text("'{}'::jsonb")
|
||||
)
|
||||
|
||||
notification_settings: Mapped[Any] = mapped_column(JSON, server_default=text("'{\"notify_owner\": true, \"alert_days_before\": [30, 15, 7, 1]}'::jsonb"))
|
||||
external_integration_config: Mapped[Any] = mapped_column(JSON, server_default=text("'{}'::jsonb"))
|
||||
|
||||
@@ -208,6 +219,14 @@ class Organization(Base):
|
||||
|
||||
# Kapcsolat az örök személy rekordhoz
|
||||
legal_owner: Mapped[Optional["Person"]] = relationship("Person", back_populates="owned_business_entities")
|
||||
|
||||
# ── P0 3D CAPABILITY MATRIX: SubscriptionTier relationship ──
|
||||
subscription_tier: Mapped[Optional["SubscriptionTier"]] = relationship(
|
||||
"SubscriptionTier",
|
||||
foreign_keys=[subscription_tier_id],
|
||||
backref="organizations",
|
||||
lazy="selectin"
|
||||
)
|
||||
|
||||
|
||||
class OrganizationFinancials(Base):
|
||||
|
||||
Reference in New Issue
Block a user