comment from mastodon to gancio

This commit is contained in:
lesion
2019-04-30 01:04:24 +02:00
parent ac5ef6e324
commit e50e5434bc
7 changed files with 81 additions and 67 deletions

View File

@@ -72,7 +72,12 @@ ${event.description.length > 200 ? event.description.substr(0, 200) + '...' : ev
// const comment = await Comment.findOne( {where: { }})
return
}
const comment = await Comment.create({activitypub_id: msg.data.last_status.id, text: msg.data.last_status.content, author: msg.data.accounts[0].username })
const comment = await Comment.create({
activitypub_id: msg.data.last_status.id,
text: msg.data.last_status.content,
data: msg.data,
author: msg.data.accounts[0].username
})
event.addComment(comment)
console.log(event)
// const comment = await Comment.findOne( { where: {activitypub_id: msg.data.in_reply_to}} )

View File

@@ -1,5 +1,5 @@
const Sequelize = require('sequelize')
const conf = require('./config.js')
const db = new Sequelize(conf.db)
// db.sync({force: true})
db.sync()
module.exports = db

View File

@@ -10,7 +10,7 @@ const Event = db.define('event', {
end_datetime: { type: Sequelize.DATE, index: true },
image_path: Sequelize.STRING,
is_visible: Sequelize.BOOLEAN,
activitypub_id: { type: Sequelize.INTEGER, index: true },
activitypub_id: { type: Sequelize.STRING, index: true },
// activitypub_ids: { type: Sequelize.ARRAY, index}
})
@@ -20,9 +20,9 @@ const Tag = db.define('tag', {
})
const Comment = db.define('comment', {
activitypub_id: { type: Sequelize.INTEGER, index: true },
activitypub_id: { type: Sequelize.STRING, index: true },
data: Sequelize.JSON,
url: Sequelize.STRING,
media_attachments: { type: Sequelize.ARRAY(Sequelize.STRING) },
author: Sequelize.STRING,
text: Sequelize.STRING
})