save user queries in redis so that user can refresh the page and still come back to their latest task

This commit is contained in:
Viktor Barzin 2025-07-06 12:02:25 +00:00
parent a055c92dea
commit d4b22deda0
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
7 changed files with 114 additions and 4 deletions

View file

@ -1,4 +1,5 @@
from datetime import datetime, timedelta
import logging
from data_access import Listing
from models.listing import (
BuyListing,
@ -13,6 +14,8 @@ from sqlmodel import Sequence, Session, and_, col, select
from sqlmodel.sql.expression import SelectOfScalar
from tqdm import tqdm
logger = logging.getLogger("uvicorn.error")
class ListingRepository:
engine: Engine
@ -51,7 +54,9 @@ class ListingRepository:
with Session(self.engine) as session:
# query = select(modelListing)
return list(session.exec(query).all())
rows = list(session.exec(query).all())
logging.debug(f"Found {len(rows)} listings")
return rows
def _add_where_from_query_parameters(
self,