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,4 +1,3 @@
# backend/app/models/identity.py
import uuid
import enum
from sqlalchemy import Column, Integer, String, Boolean, DateTime, ForeignKey, JSON, Numeric, text, Enum
@@ -40,7 +39,6 @@ class User(Base):
email = Column(String, unique=True, index=True, nullable=False)
hashed_password = Column(String, nullable=False)
# Technikai mezők átmentése a régi user.py-ból
role = Column(Enum(UserRole), default=UserRole.USER)
is_active = Column(Boolean, default=True)
is_superuser = Column(Boolean, default=False)
@@ -58,7 +56,6 @@ class User(Base):
person = relationship("Person", back_populates="users")
wallet = relationship("Wallet", back_populates="user", uselist=False)
# Az Organization kapcsolathoz (ha szükséges az import miatt)
owned_organizations = relationship("Organization", backref="owner")
class Wallet(Base):

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")