fix db session

This commit is contained in:
jxxghp
2023-10-18 18:30:09 +08:00
parent 68e16d18fe
commit 2e4536edb6
10 changed files with 48 additions and 48 deletions

View File

@ -3,7 +3,7 @@ import time
from sqlalchemy import Column, Integer, String, Sequence, Boolean, func
from sqlalchemy.orm import Session
from app.db.models import Base
from app.db.models import Base, db_persist
class TransferHistory(Base):
@ -154,10 +154,10 @@ class TransferHistory(Base):
TransferHistory.type == mtype).first()
@staticmethod
@db_persist
def update_download_hash(db: Session, historyid: int = None, download_hash: str = None):
db.query(TransferHistory).filter(TransferHistory.id == historyid).update(
{
"download_hash": download_hash
}
)
Base.commit(db)