2、前台判断用户是管理人,左下角显示团队管理 3、团队管理可以看到团队的人员、分配人员积分、人员的积分情况的功能 4、团队管理还可以邀请用户,比如生成个链接,未注册需要注册绑定团队,已注册用户访问弹窗是否加入这个团队,然后都需要管理同意才可以加入团队
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
from sqlalchemy import ForeignKey, Index, Integer, String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.enums.team import TeamStatus
|
|
from app.models.base import Base, SoftDeleteMixin, TimestampMixin
|
|
|
|
|
|
class Team(Base, TimestampMixin, SoftDeleteMixin):
|
|
__tablename__ = "teams"
|
|
__table_args__ = (
|
|
Index("ix_teams_status_sort", "status", "sort_order", "created_at"),
|
|
Index("ix_teams_code", "code"),
|
|
)
|
|
|
|
id: Mapped[str] = mapped_column(String(32), primary_key=True)
|
|
name: Mapped[str] = mapped_column(String(128), nullable=False, index=True, comment="团队名称")
|
|
code: Mapped[str | None] = mapped_column(String(64), nullable=True, comment="团队编码")
|
|
description: Mapped[str | None] = mapped_column(String(512), nullable=True, comment="团队备注")
|
|
status: Mapped[str] = mapped_column(
|
|
String(16),
|
|
default=TeamStatus.ACTIVE.value,
|
|
server_default=TeamStatus.ACTIVE.value,
|
|
nullable=False,
|
|
index=True,
|
|
comment="团队状态:active启用,disabled禁用",
|
|
)
|
|
sort_order: Mapped[int] = mapped_column(
|
|
Integer,
|
|
default=0,
|
|
server_default="0",
|
|
nullable=False,
|
|
index=True,
|
|
comment="排序值,越小越靠前",
|
|
)
|
|
manager_id: Mapped[str | None] = mapped_column(
|
|
String(32), ForeignKey("users.id"), nullable=True, index=True, comment="团队管理人ID"
|
|
)
|