ego
This commit is contained in:
@@ -2,7 +2,7 @@ const crypto = require('crypto')
|
||||
const moment = require('moment')
|
||||
const { Op } = require('sequelize')
|
||||
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, user: User, notification: Notification } = require('../models')
|
||||
const Sequelize = require('sequelize')
|
||||
const notifier = require('../../notifier')
|
||||
|
||||
@@ -94,6 +94,7 @@ const eventController = {
|
||||
},
|
||||
include: [
|
||||
{ model: Tag, attributes: ['tag', 'weigth'], through: { attributes: [] } },
|
||||
{ model: User, attributes: ['username'] },
|
||||
{ model: Place, attributes: ['name', 'address'] },
|
||||
Comment
|
||||
],
|
||||
|
||||
@@ -122,7 +122,9 @@ const userController = {
|
||||
// send response to client
|
||||
res.json(event)
|
||||
|
||||
federation.sendEvent(event, req.user)
|
||||
if (req.user)
|
||||
federation.sendEvent(event, req.user)
|
||||
|
||||
res.json(200)
|
||||
|
||||
// send notification (mastodon/email/confirmation)
|
||||
|
||||
@@ -101,8 +101,15 @@ api.get('/export/:type', exportController.export)
|
||||
api.get('/event/:month/:year', eventController.getAll)
|
||||
// api.get('/event/:month/:year', eventController.getAfter)
|
||||
|
||||
// mastodon oauth auth
|
||||
//api.post('/settings/getauthurl', jwt, isAuth, isAdmin, settingsController.getAuthURL)
|
||||
//api.get('/settings/oauth', jwt, isAuth, isAdmin, settingsController.code)
|
||||
// Handle 404
|
||||
api.use(function(req, res) {
|
||||
res.send('404: Page not Found', 404)
|
||||
})
|
||||
|
||||
// Handle 500
|
||||
api.use(function(error, req, res, next) {
|
||||
res.send('500: Internal Server Error', 500)
|
||||
})
|
||||
|
||||
|
||||
module.exports = api
|
||||
|
||||
Reference in New Issue
Block a user