feat: Paket 1 - Token-based invites, event & deadline management with live countdown, printable distribution sheet

This commit is contained in:
2026-09-21 11:16:44 +02:00
parent 4f5ef164c3
commit 83393e363e
7 changed files with 1203 additions and 358 deletions
+18 -1
View File
@@ -17,6 +17,7 @@ class Tenant(Base):
events = relationship("Event", back_populates="tenant", cascade="all, delete-orphan")
orders = relationship("Order", back_populates="tenant", cascade="all, delete-orphan")
users = relationship("User", back_populates="tenant", cascade="all, delete-orphan")
invitations = relationship("Invitation", back_populates="tenant", cascade="all, delete-orphan")
class User(Base):
@@ -29,7 +30,7 @@ class User(Base):
password_hash = Column(String(255), default="")
first_name = Column(String(100), nullable=False)
last_name = Column(String(100), nullable=False)
role = Column(String(20), default="user")
role = Column(String(20), default="user") # 'admin', 'user'
is_active = Column(Boolean, default=True)
created_at = Column(DateTime, default=func.now())
@@ -37,6 +38,22 @@ class User(Base):
orders = relationship("Order", back_populates="user")
class Invitation(Base):
__tablename__ = "invitations"
id = Column(Integer, primary_key=True, index=True)
tenant_id = Column(Integer, ForeignKey("tenants.id", ondelete="CASCADE"), nullable=False)
token = Column(String(64), unique=True, index=True, nullable=False)
email = Column(String(191), nullable=True)
role = Column(String(20), default="user", nullable=False)
created_by = Column(Integer, nullable=True)
expires_at = Column(DateTime, nullable=False)
used_at = Column(DateTime, nullable=True)
created_at = Column(DateTime, default=func.now())
tenant = relationship("Tenant", back_populates="invitations")
class Product(Base):
__tablename__ = "products"