Fix jwt-token
This commit is contained in:
@@ -71,10 +71,6 @@ module.exports = (sequelize) => {
|
||||
tenant_id: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: true,
|
||||
references: {
|
||||
model: 'tenants',
|
||||
key: 'id'
|
||||
},
|
||||
comment: 'Tenant this user belongs to (null for default tenant)'
|
||||
},
|
||||
external_provider: {
|
||||
@@ -109,29 +105,17 @@ module.exports = (sequelize) => {
|
||||
},
|
||||
{
|
||||
fields: ['phone_number']
|
||||
},
|
||||
{
|
||||
fields: ['tenant_id']
|
||||
},
|
||||
{
|
||||
fields: ['external_provider']
|
||||
},
|
||||
{
|
||||
fields: ['external_id', 'tenant_id'],
|
||||
unique: true,
|
||||
name: 'users_external_id_tenant_unique',
|
||||
where: { external_id: { [Op.ne]: null } }
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// Associations
|
||||
User.associate = (models) => {
|
||||
// User belongs to a tenant
|
||||
User.belongsTo(models.Tenant, {
|
||||
foreignKey: 'tenant_id',
|
||||
as: 'tenant'
|
||||
});
|
||||
// User belongs to a tenant (will be added after migration)
|
||||
// User.belongsTo(models.Tenant, {
|
||||
// foreignKey: 'tenant_id',
|
||||
// as: 'tenant'
|
||||
// });
|
||||
};
|
||||
|
||||
return User;
|
||||
|
||||
Reference in New Issue
Block a user