refactoring online events

This commit is contained in:
lesion
2023-04-05 16:14:55 +02:00
parent 121af4872d
commit 8c8103a5ee
12 changed files with 139 additions and 165 deletions

View File

@@ -31,14 +31,14 @@ const eventController = {
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) {
if (!place_name || !place_address && place_name !== 'online') {
throw new Error(`place_id or place_name and place_address are required`)
}
let place = await Place.findOne({ where: Sequelize.where(Sequelize.fn('LOWER', Sequelize.col('name')), Sequelize.Op.eq, place_name.toLocaleLowerCase()) })
if (!place) {
place = await Place.create({
name: place_name,
address: place_address,
address: place_address || '',
latitude: Number(body.place_latitude) || null,
longitude: Number(body.place_longitude) || null
})

View File

@@ -27,9 +27,8 @@ const defaultSettings = {
allow_anon_event: true,
allow_multidate_event: true,
allow_recurrent_event: false,
allow_online_event: true,
recurrent_event_visible: false,
allow_event_only_online: false,
allow_event_also_online: false,
allow_geolocation: false,
geocoding_provider_type: 'Nominatim',
geocoding_provider: 'https://nominatim.openstreetmap.org/search',