v0.9.17
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { event: Event, place: Place } = require('../models')
|
||||
const { event: Event, place: Place, tag: Tag } = require('../models')
|
||||
const { Op } = require('sequelize')
|
||||
const moment = require('moment')
|
||||
const ics = require('ics')
|
||||
@@ -9,11 +9,15 @@ const exportController = {
|
||||
const type = req.params.type
|
||||
const tags = req.query.tags
|
||||
const places = req.query.places
|
||||
|
||||
const where = {}
|
||||
const yesterday = moment().subtract('1', 'day').unix()
|
||||
let where_tags = {}
|
||||
|
||||
if (tags) {
|
||||
where.tag = tags.split(',')
|
||||
where_tags = { where: { tag: tags.split(',') } }
|
||||
}
|
||||
|
||||
if (places) {
|
||||
where.placeId = places.split(',')
|
||||
}
|
||||
@@ -27,7 +31,7 @@ const exportController = {
|
||||
attributes: {
|
||||
exclude: ['createdAt', 'updatedAt']
|
||||
},
|
||||
include: [{ model: Place, attributes: ['name', 'id', 'address'] }]
|
||||
include: [ { model: Tag, ...where_tags }, { model: Place, attributes: ['name', 'id', 'address'] }]
|
||||
})
|
||||
switch (type) {
|
||||
case 'feed':
|
||||
|
||||
@@ -2,6 +2,7 @@ const Email = require('email-templates')
|
||||
const path = require('path')
|
||||
const moment = require('moment')
|
||||
const config = require('config')
|
||||
const settings = require('./controller/settings')
|
||||
|
||||
moment.locale('it')
|
||||
const mail = {
|
||||
@@ -23,7 +24,10 @@ const mail = {
|
||||
send: true,
|
||||
i18n: {
|
||||
directory: path.join(__dirname, '..', '..', 'locales', 'email'),
|
||||
defaultLocale: 'it'
|
||||
syncFiles: false,
|
||||
updateFiles: false,
|
||||
defaultLocale: settings.locale,
|
||||
objectNotation: true
|
||||
},
|
||||
transport: config.smtp
|
||||
})
|
||||
|
||||
@@ -8,7 +8,7 @@ const db = {}
|
||||
|
||||
const sequelize = new Sequelize(config.db)
|
||||
sequelize.authenticate().catch( e => {
|
||||
consola.error('Error connecting to DB: ', e)
|
||||
consola.error('Error connecting to DB: ', String(e))
|
||||
process.exit(-1)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user