feat: v1.7 overhaul - identity hash, triple wallet, financial ledger, and security audit system

This commit is contained in:
2026-02-16 00:42:49 +00:00
parent bb02d4ed59
commit d574d3297d
63 changed files with 3710 additions and 565 deletions

View File

@@ -61,6 +61,11 @@ class Organization(Base):
status = Column(String(30), default="pending_verification")
is_deleted = Column(Boolean, default=False)
# --- ÚJ: Előfizetés és Méret korlátok ---
subscription_plan = Column(String(30), server_default=text("'FREE'"), index=True)
base_asset_limit = Column(Integer, server_default=text("1"))
purchased_extra_slots = Column(Integer, server_default=text("0"))
notification_settings = Column(JSON, server_default=text("'{\"notify_owner\": true, \"alert_days_before\": [30, 15, 7, 1]}'::jsonb"))
external_integration_config = Column(JSON, server_default=text("'{}'::jsonb"))
@@ -70,6 +75,10 @@ class Organization(Base):
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
# --- ÚJ: Dual Twin Tulajdonjog logika ---
# Individual esetén False, Business esetén True
is_ownership_transferable = Column(Boolean, server_default=text("true"))
# Kapcsolatok
assets = relationship("AssetAssignment", back_populates="organization", cascade="all, delete-orphan")
@@ -77,6 +86,7 @@ class Organization(Base):
owner = relationship("User", back_populates="owned_organizations")
financials = relationship("OrganizationFinancials", back_populates="organization", cascade="all, delete-orphan")
service_profile = relationship("ServiceProfile", back_populates="organization", uselist=False)
branches = relationship("Branch", back_populates="organization", cascade="all, delete-orphan")
class OrganizationFinancials(Base):
"""Cégek éves gazdasági adatai elemzéshez."""
@@ -111,4 +121,15 @@ class OrganizationMember(Base):
organization = relationship("Organization", back_populates="members")
user = relationship("User")
person = relationship("Person", back_populates="memberships")
person = relationship("Person", back_populates="memberships")
class OrganizationSalesAssignment(Base):
"""Összeköti a céget az aktuális üzletkötővel a jutalék miatt."""
__tablename__ = "org_sales_assignments"
__table_args__ = {"schema": "data"}
id = Column(Integer, primary_key=True)
organization_id = Column(Integer, ForeignKey("data.organizations.id"))
agent_user_id = Column(Integer, ForeignKey("data.users.id")) # Ő kapja a Farming díjat
assigned_at = Column(DateTime(timezone=True), server_default=func.now())
is_active = Column(Boolean, default=True)