Fix jwt-token

This commit is contained in:
2025-09-13 15:32:50 +02:00
parent 3a6e98d792
commit cd159239ed
7 changed files with 539 additions and 67 deletions

View File

@@ -39,6 +39,15 @@ module.exports = (sequelize) => {
defaultValue: false,
comment: 'Whether the device is approved to send data'
},
tenant_id: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'tenants',
key: 'id'
},
comment: 'Foreign key to tenants table for multi-tenant isolation'
},
last_heartbeat: {
type: DataTypes.DATE,
allowNull: true,

View File

@@ -49,6 +49,9 @@ AlertLog.belongsTo(DroneDetection, { foreignKey: 'detection_id', as: 'detection'
Tenant.hasMany(User, { foreignKey: 'tenant_id', as: 'users' });
User.belongsTo(Tenant, { foreignKey: 'tenant_id', as: 'tenant' });
Tenant.hasMany(Device, { foreignKey: 'tenant_id', as: 'devices' });
Device.belongsTo(Tenant, { foreignKey: 'tenant_id', as: 'tenant' });
module.exports = {
sequelize,
Device,