Files
video-gen/video-gen-api/app/models/team.py
T
2026-06-30 11:31:54 +08:00

35 lines
1.2 KiB
Python

from sqlalchemy import 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="排序值,越小越靠前",
)