style: apply ruff format across backend + scripts (line-length 100)
Mechanical, whole-tree `ruff format` pass — no behaviour change. Recorded in .git-blame-ignore-revs (next commit) so git blame skips it.
This commit is contained in:
@@ -4,6 +4,7 @@ with the client-side transient bell. Read-only listing plus read/dismiss/clear m
|
||||
All endpoints use `current_user` (not `require_human`): notifications and their read/dismiss
|
||||
state are personal UI state with no quota or YouTube involvement, so the shared demo account
|
||||
manages its own inbox normally."""
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||
from sqlalchemy import func, select, update
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -41,9 +42,7 @@ def list_notifications(
|
||||
where = [Notification.user_id == user.id]
|
||||
if not include_dismissed:
|
||||
where.append(Notification.dismissed.is_(False))
|
||||
total = db.scalar(
|
||||
select(func.count()).select_from(Notification).where(*where)
|
||||
) or 0
|
||||
total = db.scalar(select(func.count()).select_from(Notification).where(*where)) or 0
|
||||
rows = (
|
||||
db.execute(
|
||||
select(Notification)
|
||||
@@ -59,9 +58,7 @@ def list_notifications(
|
||||
|
||||
|
||||
@router.get("/unread_count")
|
||||
def unread_count(
|
||||
user: User = Depends(current_user), db: Session = Depends(get_db)
|
||||
) -> dict:
|
||||
def unread_count(user: User = Depends(current_user), db: Session = Depends(get_db)) -> dict:
|
||||
"""Cheap poll target for the nav badge (uses the (user_id, read) index)."""
|
||||
count = db.scalar(
|
||||
select(func.count())
|
||||
@@ -96,9 +93,7 @@ def mark_read(
|
||||
|
||||
|
||||
@router.post("/read_all")
|
||||
def mark_all_read(
|
||||
user: User = Depends(current_user), db: Session = Depends(get_db)
|
||||
) -> dict:
|
||||
def mark_all_read(user: User = Depends(current_user), db: Session = Depends(get_db)) -> dict:
|
||||
db.execute(
|
||||
update(Notification)
|
||||
.where(Notification.user_id == user.id, Notification.read.is_(False))
|
||||
@@ -124,9 +119,7 @@ def dismiss(
|
||||
|
||||
|
||||
@router.post("/clear")
|
||||
def clear_all(
|
||||
user: User = Depends(current_user), db: Session = Depends(get_db)
|
||||
) -> dict:
|
||||
def clear_all(user: User = Depends(current_user), db: Session = Depends(get_db)) -> dict:
|
||||
"""Dismiss every (still-visible) notification for this user."""
|
||||
db.execute(
|
||||
update(Notification)
|
||||
|
||||
Reference in New Issue
Block a user