Fix jwt-token

This commit is contained in:
2025-09-13 12:26:21 +02:00
parent fb02eae663
commit f18bac2db5
2 changed files with 8 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ const Heartbeat = require('./Heartbeat')(sequelize);
const User = require('./User')(sequelize);
const AlertRule = require('./AlertRule')(sequelize);
const AlertLog = require('./AlertLog')(sequelize);
const Tenant = require('./Tenant')(sequelize);
// Define associations
Device.hasMany(DroneDetection, { foreignKey: 'device_id', as: 'detections' });
@@ -43,6 +44,10 @@ AlertLog.belongsTo(AlertRule, { foreignKey: 'alert_rule_id', as: 'rule' });
DroneDetection.hasMany(AlertLog, { foreignKey: 'detection_id', as: 'alerts' });
AlertLog.belongsTo(DroneDetection, { foreignKey: 'detection_id', as: 'detection' });
// Tenant associations
Tenant.hasMany(User, { foreignKey: 'tenant_id', as: 'users' });
User.belongsTo(Tenant, { foreignKey: 'tenant_id', as: 'tenant' });
module.exports = {
sequelize,
Device,
@@ -50,5 +55,6 @@ module.exports = {
Heartbeat,
User,
AlertRule,
AlertLog
AlertLog,
Tenant
};