High priority: - Fix concurrent race condition for view_count/like_count (atomic update) - Add route request ID tracking to prevent race conditions - Filter get_joke by status=approved (no pending content leak) - Add error feedback for like button Performance: - Optimize random joke query (avoid full table sort) - Limit page_size max to 100 (DoS prevention) Medium: - Add localStorage quota error handling - Handle empty AI response gracefully - Fix generate content title extraction Low: - Add rejected_jokes to stats API - Update dashboard to show rejected count
14 lines
453 B
Python
14 lines
453 B
Python
from fastapi import APIRouter, Depends
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.database import get_db
|
|
from app.models.link import Link
|
|
from app.schemas.link import LinkCreate, LinkResponse
|
|
|
|
router = APIRouter(tags=["友情链接"])
|
|
|
|
|
|
@router.get("/links", response_model=list[LinkResponse])
|
|
def list_links(db: Session = Depends(get_db)):
|
|
"""公开:获取所有友情链接"""
|
|
return db.query(Link).order_by(Link.sort_order, Link.id).all() |