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' });
|
Tenant.hasMany(Device, { foreignKey: 'tenant_id', as: 'devices' });
|
||||||
Device.belongsTo(Tenant, { foreignKey: 'tenant_id', as: 'tenant' });
|
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 = {
|
module.exports = {
|
||||||
sequelize,
|
sequelize,
|
||||||
Device,
|
Device,
|
||||||
|
|||||||
Reference in New Issue
Block a user