fix removable tasks

This commit is contained in:
les
2020-01-30 17:48:09 +01:00
parent 2828642515
commit c6e4569009
4 changed files with 25 additions and 27 deletions

View File

@@ -1,14 +1,15 @@
const mail = require('./api/mail')
// const bot = require('./api/controller/fediverse')
const config = require('config')
const debug = require('debug')('notifier')
const fediverseHelpers = require('./federation/helpers')
const { event: Event, notification: Notification, event_notification: EventNotification,
const {
event: Event, notification: Notification, event_notification: EventNotification,
user: User, place: Place, tag: Tag, ap_user: APUser } = require('./api/models')
const eventController = require('./api/controller/event')
const notifier = {
sendNotification (notification, event) {
const promises = []
debug('Send %s notification %s', notification.type, notification.action)
@@ -26,6 +27,7 @@ const notifier = {
}
return Promise.all(promises)
},
async notifyEvent (action, eventId) {
const event = await Event.findByPk(eventId, {
include: [Tag, Place, Notification, { model: User }]
@@ -51,6 +53,7 @@ const notifier = {
})
return Promise.all(promises)
},
async notify () {
// get all event notification in queue
const eventNotifications = await EventNotification.findAll({ where: { status: 'new' } })