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>
This commit is contained in:
dbildhauerandClaude Opus 5.5 committed 2026-10-25 11:04:33 +01:00
1 parent d9b7baf788
commit d4cf8bdddd
12 files changed
+283 -11

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
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]