location saving is not working when geocoding is disabled, fix #238

This commit is contained in:
lesion
2023-02-22 08:45:18 +01:00
parent 07f9e2d9ee
commit 0fa7769844
2 changed files with 7 additions and 4 deletions

View File

@@ -29,6 +29,8 @@ const eventController = {
return place
}
console.error('dentro findOrCreatePlace', body)
const place_name = body.place_name && body.place_name.trim()
const place_address = body.place_address && body.place_address.trim()
if (!place_address || !place_name) {
@@ -39,8 +41,8 @@ const eventController = {
place = await Place.create({
name: place_name,
address: place_address,
latitude: body.place_latitude,
longitude: body.place_longitude
latitude: Number(body.place_latitude) || null,
longitude: Number(body.place_longitude) || null
})
}
return place
@@ -390,6 +392,7 @@ const eventController = {
return res.status(400).send(`Place not found`)
}
} catch (e) {
log.error(e.message)
return res.status(400).send(e.message)
}