[fedi] comment/instance/user moderation

This commit is contained in:
les
2019-11-13 10:56:01 +01:00
parent fe9057e343
commit c944541d04
20 changed files with 545 additions and 177 deletions

View File

@@ -6,10 +6,21 @@ module.exports = (sequelize, DataTypes) => {
index: true,
unique: true
},
hidden: DataTypes.BOOLEAN,
fedUserApId: {
type: DataTypes.STRING,
references: {
model: 'fed_users',
key: 'ap_id'
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE'
},
data: DataTypes.JSON
}, {})
comment.associate = function (models) {
comment.belongsTo(models.event)
comment.belongsTo(models.fed_users)
}
return comment
}

View File

@@ -4,11 +4,13 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.STRING,
primaryKey: true
},
blocked: DataTypes.BOOLEAN,
object: DataTypes.JSON
}, {})
fed_users.associate = function (models) {
fed_users.belongsTo(models.instances)
fed_users.belongsToMany(models.user, { through: 'user_followers', as: 'followers' })
fed_users.hasMany(models.comment, { foreignKey: 'fedUserApId' })
}
return fed_users
}