refactor(backend): select() and an inline now everywhere, held by a test
CLAUDE.md's canonical table names SQLAlchemy 2.0 select() and an inline datetime.now(timezone.utc), and both had drifted: five db.query(...) calls remained in routes/auth.py and routes/me.py (seven before the demo went), and four private now helpers stood in sync/videos.py, utils.py (imported as _now by explore and maintenance), scheduler.py (_now_iso) and the e2e seed. All are the canonical form now. Ruff cannot ban a method call on an instance or a function by name, so tests/test_canonical_patterns.py reads every app module's AST and fails on a .query(...) call or a now/_now/now_utc helper — seen red on a planted file.
This commit is contained in:
@@ -40,7 +40,7 @@ def my_accounts(
|
||||
"""The accounts that have authenticated in this browser session (switchable without a
|
||||
new Google sign-in). The active one is flagged."""
|
||||
ids = request.session.get("account_ids") or [user.id]
|
||||
rows = {u.id: u for u in db.query(User).filter(User.id.in_(ids)).all()}
|
||||
rows = {u.id: u for u in db.execute(select(User).where(User.id.in_(ids))).scalars()}
|
||||
out = []
|
||||
for uid in ids: # preserve recency order from the session
|
||||
u = rows.get(uid)
|
||||
|
||||
Reference in New Issue
Block a user