add 历史记录API

This commit is contained in:
jxxghp
2023-06-19 17:21:09 +08:00
parent c7f897fdcd
commit 686c0dec05
6 changed files with 109 additions and 3 deletions

View File

@ -29,3 +29,7 @@ class DownloadHistory(Base):
@staticmethod
def get_by_hash(db: Session, download_hash: str):
return db.query(DownloadHistory).filter(DownloadHistory.download_hash == download_hash).first()
@staticmethod
def list_by_page(db: Session, page: int = 1, count: int = 30):
return db.query(DownloadHistory).offset((page - 1) * count).limit(count).all()