'commit'
This commit is contained in:
@@ -53,3 +53,32 @@ class PriceComparisonResponse(BaseModel):
|
||||
class PriceComparisonSummary(BaseModel):
|
||||
summary: str
|
||||
|
||||
|
||||
from DbKit.Db import Db
|
||||
|
||||
class YltAnalyticsModel:
|
||||
def __init__(self):
|
||||
self.db = Db()
|
||||
|
||||
async def get_operators_price_trends(self, days: int):
|
||||
return await self.db.find("YltAnalytics.getOperatorsPriceTrends", {"days": days})
|
||||
|
||||
async def list_ylt_stations(self, q: str = None):
|
||||
params = {}
|
||||
if q:
|
||||
params["q"] = True
|
||||
params["kw"] = f"%{q}%"
|
||||
return await self.db.find("YltAnalytics.listYltStations", params)
|
||||
|
||||
async def fetch_current_stations(self):
|
||||
return await self.db.find("YltAnalytics.fetchCurrentStations")
|
||||
|
||||
async def fetch_station_schedule_json(self, station_hash: str):
|
||||
rows = await self.db.find("YltAnalytics.fetchStationScheduleJson", {"h": station_hash})
|
||||
if not rows:
|
||||
return None
|
||||
return rows[0].get("schedule_json")
|
||||
|
||||
async def fetch_current_station_rows(self, operator: str):
|
||||
return await self.db.find("YltAnalytics.fetchCurrentStationRows", {"op": operator})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user