[AP] unfollow, tags, attachment, sign

This commit is contained in:
les
2019-09-11 12:00:13 +02:00
parent a026e5738d
commit 939e19bb0d
4 changed files with 64 additions and 23 deletions

View File

@@ -4,7 +4,7 @@ const config = require('config')
const cors = require('cors')
const Follows = require('./follows')
const Users = require('./users')
const { event: Event, user: User } = require('../api/models')
const { event: Event, user: User, tag: Tag, place: Place } = require('../api/models')
const Comments = require('./comments')
const Helpers = require('./helpers')
const Ego = require('./ego')
@@ -19,9 +19,9 @@ router.use(express.json({type: ['application/json', 'application/activity+json',
router.get('/m/:event_id', async (req, res) => {
const event_id = req.params.event_id
if (req.accepts('html')) return res.redirect(301, `/event/${event_id}`)
// if (req.accepts('html')) return res.redirect(301, `/event/${event_id}`)
const event = await Event.findByPk(req.params.event_id, { include: [ User ] })
const event = await Event.findByPk(req.params.event_id, { include: [ User, Tag, Place ] })
if (!event) return res.status(404).send('Not found')
return res.json(event.toAP(event.user.username))
})