feat: use drink api in front and more #16

Merged
Clement merged 47 commits from feat/use-drink-api-in-front into master 2024-06-07 17:09:58 +00:00
Showing only changes of commit 9a935a922d - Show all commits

View File

@ -13,7 +13,7 @@ const key = process.env.OPEN_TRIP_MAPS_KEY
* @param {string} lat2 Latitude of the 2nd point of the box
* @returns {FeatureCollection} a list of POIs with their type, id, etc. (cf: [opentripmap](https://dev.opentripmap.org/docs#))
*/
async function callBox(lon1:string, lat1:string, lon2: string, lat2: string) {
async function callBox(lon1:string, lat1:string, lon2: string, lat2: string, rate: string) {
const lonMin = Math.min(parseFloat(lon1), parseFloat(lon2))
const lonMax = Math.max(parseFloat(lon1), parseFloat(lon2))
const latMin = Math.min(parseFloat(lat1), parseFloat(lat2))
@ -27,6 +27,7 @@ async function callBox(lon1:string, lat1:string, lon2: string, lat2: string) {
lon_max: lonMax,
lat_min: latMin,
lat_max: latMax,
rate: rate,
apikey: key,
kinds: 'bars,cafes,pubs,biergartens'
},
@ -183,11 +184,12 @@ export async function getBox(req:express.Request, res: express.Response) {
const lat1 = req.query["lat1"] as string
const lon2 = req.query["lon2"] as string
const lat2 = req.query["lat2"] as string
const rate = req.query["rate"] as string
if(!lon1 || !lat1 || !lon2 || !lat2){
res.status(400).send("Missing Argument")
return
}
res.send( await callBox(lon1, lat1, lon2, lat2))
res.send( await callBox(lon1, lat1, lon2, lat2, rate))
}