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',

View File

@@ -79,6 +79,7 @@ module.exports = {
allow_anon_event: settings.allow_anon_event,
allow_recurrent_event: settings.allow_recurrent_event,
allow_multidate_event: settings.allow_multidate_event,
allow_online_event: settings.allow_online_event,
recurrent_event_visible: settings.recurrent_event_visible,
enable_federation: settings.enable_federation,
enable_resources: settings.enable_resources,
@@ -99,8 +100,6 @@ module.exports = {
tilelayer_provider_attribution: settings.tilelayer_provider_attribution,
footerLinks: settings.footerLinks,
about: settings.about,
allow_event_only_online: settings.allow_event_only_online,
allow_event_also_online: settings.allow_event_also_online
}
next()
},