Fix jwt-token
This commit is contained in:
@@ -64,6 +64,15 @@ User.belongsTo(Tenant, { foreignKey: 'tenant_id', as: 'tenant' });
|
||||
Tenant.hasMany(Device, { foreignKey: 'tenant_id', as: 'devices' });
|
||||
Device.belongsTo(Tenant, { foreignKey: 'tenant_id', as: 'tenant' });
|
||||
|
||||
// Auto-sync database in test mode
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
sequelize.sync({ force: true }).then(() => {
|
||||
console.log('🗄️ Test database tables created');
|
||||
}).catch(error => {
|
||||
console.error('❌ Test database sync failed:', error);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sequelize,
|
||||
Device,
|
||||
|
||||
Reference in New Issue
Block a user