Merge branch 'dev'

This commit is contained in:
les
2019-09-13 10:18:43 +02:00
14 changed files with 225 additions and 72 deletions

View File

@@ -0,0 +1,13 @@
module.exports = (sequelize, DataTypes) => {
const fed_users = sequelize.define('fed_users', {
ap_id: {
type: DataTypes.STRING,
primaryKey: true
},
object: DataTypes.JSON
}, {})
fed_users.associate = function(models) {
// associations can be defined here
};
return fed_users
}

View File

@@ -28,10 +28,6 @@ module.exports = (sequelize, DataTypes) => {
is_admin: DataTypes.BOOLEAN,
is_active: DataTypes.BOOLEAN,
rsa: DataTypes.JSON,
followers: {
type: DataTypes.JSON,
defaultValue: []
}
}, {
scopes: {
withoutPassword: {
@@ -43,6 +39,7 @@ module.exports = (sequelize, DataTypes) => {
user.associate = function (models) {
// associations can be defined here
user.hasMany(models.event)
user.belongsToMany(models.fed_users, { through: 'user_followers', as: 'followers' })
}
user.prototype.comparePassword = async function (pwd) {