21 lines
834 B
Python
21 lines
834 B
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import Boolean, Integer, String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.core.db import Base, TimestampMixin, UTCDateTime
|
|
|
|
|
|
class User(TimestampMixin, Base):
|
|
__tablename__ = "users"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
|
username: Mapped[str] = mapped_column(String(64), unique=True, index=True)
|
|
password_hash: Mapped[str] = mapped_column(String(255))
|
|
must_change_password: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
failed_login_count: Mapped[int] = mapped_column(Integer, default=0)
|
|
locked_until: Mapped[datetime | None] = mapped_column(UTCDateTime(), nullable=True)
|
|
last_login: Mapped[datetime | None] = mapped_column(UTCDateTime(), nullable=True)
|