nomadro/apps/api/services/ebook_svc/routers/social_blog_admin.py
Eric 5271aabc98 Ship social selfie face-check, avatar UX by device, blog/admin, and notify polish.
Add InsightFace/OpenCV challenge upload, PC vs mobile capture branching, and fix avatar persistence into roster/profile pages.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-04 14:38:20 +08:00

43 lines
1.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""admin.nomadro.com · Nomad Blog 运营(AdSense / 显隐 / 置顶)"""
from __future__ import annotations
from typing import Any
from fastapi import APIRouter, Depends
from pydantic import BaseModel, Field
from ebook_svc.core.security import require_admin
from ebook_svc.services import social_blog_ops as blog
router = APIRouter(prefix="/api/admin/social/blog", tags=["social-blog-admin"])
class BlogOpsPatch(BaseModel):
featuredSlug: str | None = None
hiddenSlugs: list[str] | None = None
hideSlug: str | None = None
showSlug: str | None = None
note: str | None = None
heroLead: str | None = None
moduleEnabled: bool | None = None
adsenseEnabled: bool | None = None
adsenseClientId: str | None = None
adsensePublisherId: str | None = None
adsenseSlotBlogMid: str | None = None
adsenseSlotBlogEnd: str | None = None
@router.get("/overview")
async def get_overview(_: str = Depends(require_admin)) -> dict[str, Any]:
return blog.overview()
@router.get("/posts")
async def get_posts(_: str = Depends(require_admin)) -> dict[str, Any]:
return blog.list_posts()
@router.patch("/ops")
async def patch_ops(body: BlogOpsPatch, _: str = Depends(require_admin)) -> dict[str, Any]:
return blog.patch_ops(body.model_dump(exclude_none=True))