Fix jwt-token

This commit is contained in:
2025-09-12 12:36:58 +02:00
parent e45905165f
commit 3d10d0e894

View File

@@ -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;