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: { tenant_id: {
type: DataTypes.UUID, type: DataTypes.UUID,
allowNull: true, allowNull: true,
references: {
model: 'tenants',
key: 'id'
},
comment: 'Tenant this user belongs to (null for default tenant)' comment: 'Tenant this user belongs to (null for default tenant)'
}, },
external_provider: { external_provider: {
@@ -109,29 +105,17 @@ module.exports = (sequelize) => {
}, },
{ {
fields: ['phone_number'] 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 // Associations
User.associate = (models) => { User.associate = (models) => {
// User belongs to a tenant // User belongs to a tenant (will be added after migration)
User.belongsTo(models.Tenant, { // User.belongsTo(models.Tenant, {
foreignKey: 'tenant_id', // foreignKey: 'tenant_id',
as: 'tenant' // as: 'tenant'
}); // });
}; };
return User; return User;