send notification when event is confirmed
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gancio",
|
"name": "gancio",
|
||||||
"version": "0.9.26",
|
"version": "0.9.27",
|
||||||
"description": "A shared agenda for local communities",
|
"description": "A shared agenda for local communities",
|
||||||
"author": "lesion",
|
"author": "lesion",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ const { Op } = require('sequelize')
|
|||||||
const lodash = require('lodash')
|
const lodash = require('lodash')
|
||||||
const { event: Event, comment: Comment, tag: Tag, place: Place, notification: Notification } = require('../models')
|
const { event: Event, comment: Comment, tag: Tag, place: Place, notification: Notification } = require('../models')
|
||||||
const Sequelize = require('sequelize')
|
const Sequelize = require('sequelize')
|
||||||
|
const notifier = require('../../notifier')
|
||||||
|
|
||||||
const eventController = {
|
const eventController = {
|
||||||
|
|
||||||
@@ -113,10 +114,11 @@ const eventController = {
|
|||||||
try {
|
try {
|
||||||
event.is_visible = true
|
event.is_visible = true
|
||||||
await event.save()
|
await event.save()
|
||||||
// insert notification
|
|
||||||
const notifications = await eventController.getNotifications(event)
|
|
||||||
await event.setNotifications(notifications)
|
|
||||||
res.sendStatus(200)
|
res.sendStatus(200)
|
||||||
|
|
||||||
|
// send notification
|
||||||
|
notifier.notifyEvent(event.id)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.sendStatus(404)
|
res.sendStatus(404)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user