.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
const config = require('config')
|
||||
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
const event = sequelize.define('event', {
|
||||
id: {
|
||||
@@ -35,5 +37,21 @@ module.exports = (sequelize, DataTypes) => {
|
||||
event.hasMany(models.comment)
|
||||
}
|
||||
|
||||
event.prototype.toAP = function (username) {
|
||||
return {
|
||||
id: `${config.baseurl}/federation/m/c_${this.id}`,
|
||||
type: 'Create',
|
||||
actor: `${config.baseurl}/federation/u/${username}`,
|
||||
object: {
|
||||
id: `${config.baseurl}/federation/m/${this.id}`,
|
||||
type: 'Note',
|
||||
published: this.createdAt,
|
||||
attributedTo: `${config.baseurl}/federation/u/${username}`,
|
||||
to: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
content: this.title
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return event
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user