Load all the rooms

This commit is contained in:
2024-09-24 16:37:20 +02:00
parent 3a4986e07b
commit 857cf2550a

View File

@@ -70,17 +70,12 @@ class DeletionStatus(BaseModel):
async def rooms_list( async def rooms_list(
user: Annotated[Optional[auth.UserInfo], Depends(auth.current_user_optional)], user: Annotated[Optional[auth.UserInfo], Depends(auth.current_user_optional)],
) -> list[Room]: ) -> list[Room]:
user_id = user["sub"] if user else None
if not user and not settings.PUBLIC_MODE: if not user and not settings.PUBLIC_MODE:
raise HTTPException(status_code=401, detail="Not authenticated") raise HTTPException(status_code=401, detail="Not authenticated")
user_id = user["sub"] if user else None
return await paginate( return await paginate(
database, database,
await rooms_controller.get_all( await rooms_controller.get_all(order_by="-created_at", return_query=True),
user_id=user_id, order_by="-created_at", return_query=True
),
) )