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:
@@ -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,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user