Fix jwt-token
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user