feat: Identity & Company Sync v1.2, Admin hiearchia és Pénzügyi logika véglegesítése

This commit is contained in:
2026-02-05 00:11:33 +00:00
parent a57d5333d4
commit 5d0dc2433c
9 changed files with 238 additions and 44 deletions

View File

@@ -1,3 +1,4 @@
# /opt/docker/dev/service_finder/backend/app/models/organization.py
import enum
from sqlalchemy import Column, Integer, String, Boolean, Enum, DateTime, ForeignKey
from sqlalchemy.orm import relationship
@@ -18,11 +19,22 @@ class Organization(Base):
name = Column(String, nullable=False)
org_type = Column(Enum(OrgType), default=OrgType.INDIVIDUAL)
# Spec 2.2: Az owner_id a magánszemély flottájának tulajdonosát jelöli
owner_id = Column(Integer, ForeignKey("data.users.id"), nullable=True)
# MASTER BOOK v1.2 kiegészítések
is_active = Column(Boolean, default=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
# Kapcsolatok (UserVehicle modell megléte esetén)
vehicles = relationship("UserVehicle", back_populates="current_org", cascade="all, delete-orphan")
# Csak cégek (nem INDIVIDUAL) esetén adható el a flotta
is_transferable = Column(Boolean, default=True)
# Hitelesítési adatok
is_verified = Column(Boolean, default=False)
# Türelmi idő vagy hitelesítés lejárata
verification_expires_at = Column(DateTime(timezone=True), nullable=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
# Kapcsolatok
vehicles = relationship("UserVehicle", back_populates="current_org")
members = relationship("OrganizationMember", back_populates="organization")