Fix jwt-token
This commit is contained in:
@@ -15,6 +15,14 @@ module.exports = (sequelize) => {
|
|||||||
key: 'id'
|
key: 'id'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
tenant_id: {
|
||||||
|
type: DataTypes.UUID,
|
||||||
|
allowNull: true, // Allow null for testing
|
||||||
|
references: {
|
||||||
|
model: 'tenants',
|
||||||
|
key: 'id'
|
||||||
|
}
|
||||||
|
},
|
||||||
name: {
|
name: {
|
||||||
type: DataTypes.STRING,
|
type: DataTypes.STRING,
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ async function setupTestEnvironment() {
|
|||||||
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' });
|
||||||
|
|
||||||
|
Tenant.hasMany(AlertRule, { foreignKey: 'tenant_id', as: 'alertRules' });
|
||||||
|
AlertRule.belongsTo(Tenant, { foreignKey: 'tenant_id', as: 'tenant' });
|
||||||
|
|
||||||
// Create models object
|
// Create models object
|
||||||
models = {
|
models = {
|
||||||
sequelize,
|
sequelize,
|
||||||
|
|||||||
Reference in New Issue
Block a user