add 站点、订阅API

This commit is contained in:
jxxghp
2023-06-12 09:27:39 +08:00
parent 6e8b687545
commit e10776cf1d
5 changed files with 69 additions and 47 deletions

View File

@ -1,4 +1,4 @@
from fastapi import APIRouter, Depends, HTTPException, BackgroundTasks
from fastapi import APIRouter, Depends, BackgroundTasks
from app import schemas
from app.chain.douban_sync import DoubanSyncChain
@ -18,14 +18,9 @@ def start_douban_chain():
@router.get("/sync", response_model=schemas.Response)
async def sync_douban(
background_tasks: BackgroundTasks,
current_user: User = Depends(get_current_active_superuser)):
_: User = Depends(get_current_active_superuser)):
"""
查询所有订阅
"""
if not current_user:
raise HTTPException(
status_code=400,
detail="需要授权",
)
background_tasks.add_task(start_douban_chain)
return {"success": True}