feat: vehicle catalog system and harvester robot implementation

This commit is contained in:
2026-02-07 01:29:46 +00:00
parent cd171d3289
commit cab8706980
4 changed files with 52 additions and 7 deletions

View File

@@ -16,14 +16,14 @@ class Organization(Base):
id = Column(Integer, primary_key=True, index=True)
name = Column(String, nullable=False)
org_type = Column(Enum(OrgType), default=OrgType.INDIVIDUAL)
# A stabilitás miatt VARCHAR-ként kezeljük a DB-ben
org_type = Column(String(50), default="individual")
# A flotta technikai tulajdonosa (User)
owner_id = Column(Integer, ForeignKey("data.users.id"), nullable=True)
# Üzleti szabályok
is_active = Column(Boolean, default=True)
# Privát flotta (INDIVIDUAL) esetén False, cégeknél True
is_transferable = Column(Boolean, default=True)
# Verifikáció
@@ -33,7 +33,20 @@ class Organization(Base):
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
# Kapcsolatok
vehicles = relationship("Vehicle", back_populates="current_org")
# Kapcsolatok (Asset-re hivatkozunk a Vehicle helyett)
assets = relationship("Asset", back_populates="organization", cascade="all, delete-orphan")
members = relationship("OrganizationMember", back_populates="organization")
owner = relationship("User", back_populates="owned_organizations")
owner = relationship("User", back_populates="owned_organizations")
class OrganizationMember(Base):
__tablename__ = "organization_members"
__table_args__ = {"schema": "data"}
id = Column(Integer, primary_key=True, index=True)
organization_id = Column(Integer, ForeignKey("data.organizations.id"), nullable=False)
user_id = Column(Integer, ForeignKey("data.users.id"), nullable=False)
role = Column(String, default="driver")
organization = relationship("Organization", back_populates="members")
# --- EZT A SORT TEDD KÍVÜLRE, A MARGÓRA ---
Organization.vehicles = Organization.assets