fix bug
This commit is contained in:
@@ -9,6 +9,8 @@ from app.core.config import settings
|
|||||||
from app.core.security import verify_token
|
from app.core.security import verify_token
|
||||||
from app.db import get_db
|
from app.db import get_db
|
||||||
from app.db.models.subscribe import Subscribe
|
from app.db.models.subscribe import Subscribe
|
||||||
|
from app.db.models.user import User
|
||||||
|
from app.db.userauth import get_current_active_user
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
@@ -56,7 +58,7 @@ async def subscribe_info_by_id(
|
|||||||
async def create_subscribe(
|
async def create_subscribe(
|
||||||
*,
|
*,
|
||||||
subscribe_in: schemas.Subscribe,
|
subscribe_in: schemas.Subscribe,
|
||||||
_: schemas.TokenPayload = Depends(verify_token)
|
current_user: User = Depends(get_current_active_user),
|
||||||
) -> Any:
|
) -> Any:
|
||||||
"""
|
"""
|
||||||
新增订阅
|
新增订阅
|
||||||
@@ -77,6 +79,7 @@ async def create_subscribe(
|
|||||||
tmdbid=subscribe_in.tmdbid,
|
tmdbid=subscribe_in.tmdbid,
|
||||||
season=subscribe_in.season,
|
season=subscribe_in.season,
|
||||||
doubanid=subscribe_in.doubanid,
|
doubanid=subscribe_in.doubanid,
|
||||||
|
username=current_user.name,
|
||||||
exist_ok=True)
|
exist_ok=True)
|
||||||
return schemas.Response(success=True if result else False, message=result)
|
return schemas.Response(success=True if result else False, message=result)
|
||||||
|
|
||||||
|
@@ -46,12 +46,14 @@ class TransferHistory(Base):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def list_by_title(db: Session, title: str, page: int = 1, count: int = 30):
|
def list_by_title(db: Session, title: str, page: int = 1, count: int = 30):
|
||||||
return db.query(TransferHistory).filter(TransferHistory.title == title).offset((page - 1) * count).limit(
|
return db.query(TransferHistory).filter(TransferHistory.title == title).order_by(
|
||||||
|
TransferHistory.date.desc()).offset((page - 1) * count).limit(
|
||||||
count).all()
|
count).all()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def list_by_page(db: Session, page: int = 1, count: int = 30):
|
def list_by_page(db: Session, page: int = 1, count: int = 30):
|
||||||
return db.query(TransferHistory).offset((page - 1) * count).limit(count).all()
|
return db.query(TransferHistory).order_by(TransferHistory.date.desc()).offset((page - 1) * count).limit(
|
||||||
|
count).all()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_by_hash(db: Session, download_hash: str):
|
def get_by_hash(db: Session, download_hash: str):
|
||||||
|
Reference in New Issue
Block a user