This commit is contained in:
Mikan
2026-06-21 02:41:48 +03:00
parent c21a13d2a3
commit bd85e186dc
31 changed files with 1372 additions and 319 deletions

View File

@@ -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())