feat(activity): Simplify query statements and improve code readability

This commit is contained in:
Abhimanyu Saharan
2026-02-05 00:21:33 +05:30
parent 79155e9067
commit 51313a9272
12 changed files with 65 additions and 151 deletions

View File

@@ -22,9 +22,5 @@ def list_activity(
statement = select(ActivityEvent)
if actor.actor_type == "agent" and actor.agent:
statement = statement.where(ActivityEvent.agent_id == actor.agent.id)
statement = (
statement.order_by(desc(col(ActivityEvent.created_at)))
.offset(offset)
.limit(limit)
)
statement = statement.order_by(desc(col(ActivityEvent.created_at))).offset(offset).limit(limit)
return list(session.exec(statement))