keep going with federation

This commit is contained in:
lesion
2019-08-03 00:48:48 +02:00
parent 9b2015f46f
commit 202e59c1bc
4 changed files with 13 additions and 9 deletions

View File

@@ -5,12 +5,14 @@ module.exports = {
async boost (req, res) {
const event_id = req.body.object.match(`${config.baseurl}/federation/m/(.*)`)[1]
const event = await Event.findByPk(event_id)
if (!event) return res.status(404).send('Event not found!')
await event.update({ boost: [...event.boost, req.body.actor]})
res.sendStatus(201)
},
async like (req, res) {
const event_id = req.body.object.match(`${config.baseurl}/federation/m/(.*)`)[1]
const event = await Event.findByPk(event_id)
if (!event) return res.status(404).send('Event not found!')
await event.update({ likes: [...event.likes, req.body.actor]})
res.sendStatus(201)
}