Update session cleanup logic, pyproject.toml, and Makefile for consistency and improved tooling support

- Replaced `not UserSession.is_active` with `UserSession.is_active == False` in cleanup queries for explicit comparison.
- Added `mypy` overrides for `app.alembic` and external libraries (`starlette`).
- Refactored `Makefile` to use virtual environment binaries for commands like `ruff`, `mypy`, and `pytest`.
This commit is contained in:
2025-11-10 12:28:10 +01:00
parent 8a343580ce
commit 1f45ca2b50
3 changed files with 26 additions and 10 deletions

View File

@@ -309,7 +309,7 @@ class CRUDSession(CRUDBase[UserSession, SessionCreate, SessionUpdate]):
# Use bulk DELETE with WHERE clause - single query
stmt = delete(UserSession).where(
and_(
not UserSession.is_active,
UserSession.is_active == False, # noqa: E712
UserSession.expires_at < now,
UserSession.created_at < cutoff_date,
)
@@ -356,7 +356,7 @@ class CRUDSession(CRUDBase[UserSession, SessionCreate, SessionUpdate]):
stmt = delete(UserSession).where(
and_(
UserSession.user_id == uuid_obj,
not UserSession.is_active,
UserSession.is_active == False, # noqa: E712
UserSession.expires_at < now,
)
)