Files
lan-clipboard/backend/app/models/login_attempt.py
T
dbildhauerandClaude Opus 5.5 d4cf8bdddd feat: datenmodell für benutzer, sessions und login-versuche
- Tabellen users, sessions, login_attempts (Migration 0002)
- UTCDateTime speichert UTC in SQLite und liefert aware datetimes
- Tests legen das Schema über die echten Migrationen an
- Test prüft, dass Migrationen und Modelle übereinstimmen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 11:04:33 +01:00

21 lines
681 B
Python

from datetime import datetime
from sqlalchemy import Index, String
from sqlalchemy.orm import Mapped, mapped_column
from app.models.base import Base, UTCDateTime, utcnow
class LoginAttempt(Base):
__tablename__ = "login_attempts"
__table_args__ = (
Index("ix_login_attempts_username_time", "username", "attempted_at"),
Index("ix_login_attempts_ip_time", "ip", "attempted_at"),
)
id: Mapped[int] = mapped_column(primary_key=True)
username: Mapped[str] = mapped_column(String(255))
ip: Mapped[str | None] = mapped_column(String(45))
attempted_at: Mapped[datetime] = mapped_column(UTCDateTime, default=utcnow)
success: Mapped[bool]