1
This commit is contained in:
@@ -80,7 +80,7 @@ router = APIRouter(prefix="/admin", tags=["admin"])
|
|||||||
@router.get("/users")
|
@router.get("/users")
|
||||||
async def list_users(
|
async def list_users(
|
||||||
page: int = Query(1, ge=1),
|
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(""),
|
search: str = Query(""),
|
||||||
admin: User = Depends(get_admin_user),
|
admin: User = Depends(get_admin_user),
|
||||||
db: AsyncSession = Depends(get_db),
|
db: AsyncSession = Depends(get_db),
|
||||||
@@ -320,9 +320,9 @@ async def list_admin_notifications(
|
|||||||
admin: User = Depends(get_admin_user),
|
admin: User = Depends(get_admin_user),
|
||||||
db: AsyncSession = Depends(get_db),
|
db: AsyncSession = Depends(get_db),
|
||||||
):
|
):
|
||||||
"""List all notifications (including broadcasts) with optional user_id filter."""
|
"""List unread notifications with optional user_id filter."""
|
||||||
query = select(Notification).order_by(Notification.created_at.desc())
|
query = select(Notification).where(Notification.is_read == False).order_by(Notification.created_at.desc())
|
||||||
count_query = select(func.count(Notification.id))
|
count_query = select(func.count(Notification.id)).where(Notification.is_read == False)
|
||||||
|
|
||||||
if user_id:
|
if user_id:
|
||||||
query = query.where(Notification.user_id == user_id)
|
query = query.where(Notification.user_id == user_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user