| 57 | |
| 58 | |
| 59 | class User(Base): |
| 60 | __tablename__: str = "user" |
| 61 | |
| 62 | id: Mapped[int] = mapped_column(primary_key=True) |
| 63 | email: Mapped[str] = mapped_column( |
| 64 | String(320), index=True, unique=True, nullable=False |
| 65 | ) |
| 66 | username: Mapped[str] = mapped_column( |
| 67 | String(50), index=True, unique=True, nullable=False |
| 68 | ) |
| 69 | name: Mapped[str | None] = mapped_column(String(256), index=True, nullable=True) |
| 70 | email_verified: Mapped[bool] = mapped_column(Boolean, default=False) |
| 71 | has_avatar: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False) |
| 72 | status: Mapped[str] = mapped_column( |
| 73 | SQLAEnum("active", "deleted", name="team_status"), |
| 74 | nullable=False, |
| 75 | default="active", |
| 76 | ) |
| 77 | created_at: Mapped[datetime] = mapped_column( |
| 78 | index=True, nullable=False, default=utc_now |
| 79 | ) |
| 80 | updated_at: Mapped[datetime] = mapped_column( |
| 81 | index=True, nullable=False, default=utc_now, onupdate=utc_now |
| 82 | ) |
| 83 | tokens_invalid_before: Mapped[datetime | None] = mapped_column(nullable=True) |
| 84 | default_team_id: Mapped[str] = mapped_column(ForeignKey("team.id"), nullable=True) |
| 85 | |
| 86 | # Relationships |
| 87 | default_team: Mapped["Team"] = relationship(foreign_keys=[default_team_id]) |
| 88 | identities: Mapped[list["UserIdentity"]] = relationship(back_populates="user") |
| 89 | |
| 90 | @override |
| 91 | def __repr__(self): |
| 92 | return f"<User {self.email}>" |
| 93 | |
| 94 | |
| 95 | class UserIdentity(Base): |
no outgoing calls
no test coverage detected