This commit is contained in:
2026-06-16 10:25:00 +08:00
parent 29ce114588
commit 077fd3cdc6
+4 -4
View File
@@ -80,7 +80,7 @@ router = APIRouter(prefix="/admin", tags=["admin"])
@router.get("/users")
async def list_users(
page: int = Query(1, ge=1),
page_size: int = Query(20, ge=1, le=500),
page_size: int = Query(20, ge=1, le=1000),
search: str = Query(""),
admin: User = Depends(get_admin_user),
db: AsyncSession = Depends(get_db),
@@ -320,9 +320,9 @@ async def list_admin_notifications(
admin: User = Depends(get_admin_user),
db: AsyncSession = Depends(get_db),
):
"""List all notifications (including broadcasts) with optional user_id filter."""
query = select(Notification).order_by(Notification.created_at.desc())
count_query = select(func.count(Notification.id))
"""List unread notifications with optional user_id filter."""
query = select(Notification).where(Notification.is_read == False).order_by(Notification.created_at.desc())
count_query = select(func.count(Notification.id)).where(Notification.is_read == False)
if user_id:
query = query.where(Notification.user_id == user_id)