rebase
This commit is contained in:
@@ -49,9 +49,16 @@ async def list_worlds(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
user: User = Depends(get_current_user),
|
||||
) -> dict:
|
||||
"""List the current user's worlds."""
|
||||
"""List the current user's worlds.
|
||||
|
||||
By default, archived worlds are excluded. Pass status_filter='archived'
|
||||
to see only archived, or status_filter='all' to see everything.
|
||||
"""
|
||||
stmt = select(World).where(World.owner_id == user.id)
|
||||
if status_filter and status_filter != "all":
|
||||
if not status_filter or status_filter == "active":
|
||||
# Default: exclude archived
|
||||
stmt = stmt.where(World.status != "archived")
|
||||
elif status_filter != "all":
|
||||
stmt = stmt.where(World.status == status_filter)
|
||||
total = (await db.execute(select(func.count()).select_from(stmt.subquery()))).scalar_one()
|
||||
stmt = stmt.order_by(World.last_played_at.desc().nullslast(), World.created_at.desc())
|
||||
|
||||
Reference in New Issue
Block a user