This commit is contained in:
jxxghp
2023-07-02 14:37:36 +08:00
parent d21296b724
commit 96c7a3fc92
2 changed files with 8 additions and 3 deletions

View File

@ -46,12 +46,14 @@ class TransferHistory(Base):
@staticmethod
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()
@staticmethod
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
def get_by_hash(db: Session, download_hash: str):