2、前台判断用户是管理人,左下角显示团队管理 3、团队管理可以看到团队的人员、分配人员积分、人员的积分情况的功能 4、团队管理还可以邀请用户,比如生成个链接,未注册需要注册绑定团队,已注册用户访问弹窗是否加入这个团队,然后都需要管理同意才可以加入团队
23 lines
1.1 KiB
Python
23 lines
1.1 KiB
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import ForeignKey, Index, Integer, String, DateTime
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.base import Base, SoftDeleteMixin, TimestampMixin
|
|
|
|
|
|
class TeamInvitation(Base, TimestampMixin, SoftDeleteMixin):
|
|
__tablename__ = "team_invitations"
|
|
__table_args__ = (
|
|
Index("ix_team_invitations_team", "team_id", "status"),
|
|
)
|
|
|
|
id: Mapped[str] = mapped_column(String(32), primary_key=True)
|
|
team_id: Mapped[str] = mapped_column(String(32), ForeignKey("teams.id"), index=True, nullable=False)
|
|
code: Mapped[str] = mapped_column(String(64), unique=True, index=True, nullable=False)
|
|
created_by: Mapped[str] = mapped_column(String(32), ForeignKey("users.id"), nullable=False)
|
|
status: Mapped[str] = mapped_column(String(16), default="active", server_default="active", nullable=False)
|
|
max_uses: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
|
use_count: Mapped[int] = mapped_column(Integer, default=0, server_default="0", nullable=False)
|
|
expires_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|