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:
@@ -3,6 +3,7 @@
|
||||
The aggregate daily budget lives in ApiQuotaUsage; here we read the per-spend audit log
|
||||
(QuotaEvent) to attribute units to the user who triggered them (NULL actor = system).
|
||||
"""
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
@@ -18,18 +19,11 @@ router = APIRouter(prefix="/api/quota", tags=["quota"])
|
||||
|
||||
|
||||
def _sum(db: Session, *conds) -> int:
|
||||
return int(
|
||||
db.scalar(
|
||||
select(func.coalesce(func.sum(QuotaEvent.units), 0)).where(*conds)
|
||||
)
|
||||
or 0
|
||||
)
|
||||
return int(db.scalar(select(func.coalesce(func.sum(QuotaEvent.units), 0)).where(*conds)) or 0)
|
||||
|
||||
|
||||
@router.get("/my-usage")
|
||||
def my_usage(
|
||||
user: User = Depends(current_user), db: Session = Depends(get_db)
|
||||
) -> dict:
|
||||
def my_usage(user: User = Depends(current_user), db: Session = Depends(get_db)) -> dict:
|
||||
now = datetime.now(timezone.utc)
|
||||
mine = QuotaEvent.user_id == user.id
|
||||
by_action = {
|
||||
|
||||
Reference in New Issue
Block a user