Tweak routes
This commit is contained in:
+9
-18
@@ -32,34 +32,25 @@ async def list_cities_in_country(
|
|||||||
return cities
|
return cities
|
||||||
|
|
||||||
|
|
||||||
@api.get('/diyanet/location/{country}', response_model=List[Location])
|
@api.get('/diyanet/locations', response_model=List[Location])
|
||||||
async def list_locations_for_country(
|
async def list_locations(
|
||||||
country: str,
|
country: str,
|
||||||
conn: sqlite3.Connection = Depends(get_connection)
|
city: str = None,
|
||||||
):
|
|
||||||
items = diyanetdb.find_locations(conn, country=country)
|
|
||||||
return items
|
|
||||||
|
|
||||||
|
|
||||||
@api.get('/diyanet/location/{country}/{city}', response_model=List[Location])
|
|
||||||
async def list_locations_for_city(
|
|
||||||
country: str,
|
|
||||||
city: str,
|
|
||||||
conn: sqlite3.Connection = Depends(get_connection)
|
conn: sqlite3.Connection = Depends(get_connection)
|
||||||
):
|
):
|
||||||
items = diyanetdb.find_locations(conn, country=country, city=city)
|
items = diyanetdb.find_locations(conn, country=country, city=city)
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
|
||||||
@api.get('/diyanet/prayertimes', response_model=List[PrayerTimes])
|
|
||||||
async def get_prayer_times(location_id: int):
|
|
||||||
times = diyanet.get_prayer_times(location_id)
|
|
||||||
return times
|
|
||||||
|
|
||||||
|
|
||||||
@api.get('/diyanet/search', response_model=List[PrayerTimes])
|
@api.get('/diyanet/search', response_model=List[PrayerTimes])
|
||||||
async def search_location(
|
async def search_location(
|
||||||
q: str,
|
q: str,
|
||||||
conn: sqlite3.Connection = Depends(get_connection)):
|
conn: sqlite3.Connection = Depends(get_connection)):
|
||||||
locations = diyanetdb.find_location_by_name(conn, q)
|
locations = diyanetdb.find_location_by_name(conn, q)
|
||||||
return locations
|
return locations
|
||||||
|
|
||||||
|
|
||||||
|
@api.get('/diyanet/prayertimes', response_model=List[PrayerTimes])
|
||||||
|
async def get_prayer_times(location_id: int):
|
||||||
|
times = await diyanet.get_prayer_times(location_id)
|
||||||
|
return times
|
||||||
|
|||||||
Reference in New Issue
Block a user