Tweak routes
This commit is contained in:
+9
-18
@@ -32,34 +32,25 @@ async def list_cities_in_country(
|
||||
return cities
|
||||
|
||||
|
||||
@api.get('/diyanet/location/{country}', response_model=List[Location])
|
||||
async def list_locations_for_country(
|
||||
@api.get('/diyanet/locations', response_model=List[Location])
|
||||
async def list_locations(
|
||||
country: str,
|
||||
conn: sqlite3.Connection = Depends(get_connection)
|
||||
):
|
||||
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,
|
||||
city: str = None,
|
||||
conn: sqlite3.Connection = Depends(get_connection)
|
||||
):
|
||||
items = diyanetdb.find_locations(conn, country=country, city=city)
|
||||
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])
|
||||
async def search_location(
|
||||
q: str,
|
||||
conn: sqlite3.Connection = Depends(get_connection)):
|
||||
locations = diyanetdb.find_location_by_name(conn, q)
|
||||
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