Add endpoint 'get_one_station_dates'

master
gtitov 4 years ago
parent 08a61f7d04
commit 8086c6b13c

@ -180,6 +180,32 @@ async def get_one_station_values(station_id: int, start_datetime: datetime, end_
for row in one_station_values for row in one_station_values
] ]
@app.get("/station/{station_id}/dates")
async def get_one_station_dates(station_id: int):
"""Возращает даты, для которых на данной станции есть данные.
"""
# Wide form
cur.execute(
"""SELECT
DISTINCT(date(datetime, 'unixepoch'))
FROM
stations_all_params
WHERE
station_id = :station_id
""",
{
"station_id": station_id
}
)
one_station_dates = cur.fetchall()
return [
row[0]
for row in one_station_dates
]
@app.get("/stations/dates") @app.get("/stations/dates")
async def get_stations_dates(): async def get_stations_dates():
"""Возращает минимальную и максимальную даты, которые есть в таблице сетки. """Возращает минимальную и максимальную даты, которые есть в таблице сетки.

Loading…
Cancel
Save