Initial commit - Migrated to Dev environment
This commit is contained in:
26
backend/app/models/organization_member.py
Executable file
26
backend/app/models/organization_member.py
Executable file
@@ -0,0 +1,26 @@
|
||||
import enum
|
||||
from sqlalchemy import Column, Integer, String, Boolean, Enum, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from app.db.base import Base
|
||||
|
||||
# Átnevezve OrgUserRole-ra, hogy ne ütközzön a globális UserRole-al
|
||||
class OrgUserRole(str, enum.Enum):
|
||||
OWNER = "OWNER"
|
||||
ADMIN = "ADMIN"
|
||||
FLEET_MANAGER = "FLEET_MANAGER"
|
||||
DRIVER = "DRIVER"
|
||||
|
||||
class OrganizationMember(Base):
|
||||
__tablename__ = "organization_members"
|
||||
__table_args__ = {"schema": "data"}
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
org_id = Column(Integer, ForeignKey("data.organizations.id", ondelete="CASCADE"))
|
||||
user_id = Column(Integer, ForeignKey("data.users.id", ondelete="CASCADE"))
|
||||
# Itt is frissítjük a hivatkozást
|
||||
role = Column(Enum(OrgUserRole), default=OrgUserRole.DRIVER)
|
||||
|
||||
is_permanent = Column(Boolean, default=False)
|
||||
|
||||
organization = relationship("Organization", back_populates="members")
|
||||
# # # user = relationship("User", back_populates="memberships")
|
||||
Reference in New Issue
Block a user