Fix jwt-token
This commit is contained in:
@@ -23,6 +23,14 @@ module.exports = (sequelize) => {
|
|||||||
key: 'id'
|
key: 'id'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
device_id: {
|
||||||
|
type: DataTypes.UUID,
|
||||||
|
allowNull: true, // Allow null for testing
|
||||||
|
references: {
|
||||||
|
model: 'devices',
|
||||||
|
key: 'id'
|
||||||
|
}
|
||||||
|
},
|
||||||
alert_type: {
|
alert_type: {
|
||||||
type: DataTypes.ENUM('sms', 'email', 'webhook', 'push'),
|
type: DataTypes.ENUM('sms', 'email', 'webhook', 'push'),
|
||||||
allowNull: true, // Allow null for testing
|
allowNull: true, // Allow null for testing
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ async function setupTestEnvironment() {
|
|||||||
DroneDetection.hasMany(AlertLog, { foreignKey: 'detection_id', as: 'alerts' });
|
DroneDetection.hasMany(AlertLog, { foreignKey: 'detection_id', as: 'alerts' });
|
||||||
AlertLog.belongsTo(DroneDetection, { foreignKey: 'detection_id', as: 'detection' });
|
AlertLog.belongsTo(DroneDetection, { foreignKey: 'detection_id', as: 'detection' });
|
||||||
|
|
||||||
|
Device.hasMany(AlertLog, { foreignKey: 'device_id', as: 'alerts' });
|
||||||
|
AlertLog.belongsTo(Device, { foreignKey: 'device_id', as: 'device' });
|
||||||
|
|
||||||
// Tenant associations
|
// Tenant associations
|
||||||
Tenant.hasMany(User, { foreignKey: 'tenant_id', as: 'users' });
|
Tenant.hasMany(User, { foreignKey: 'tenant_id', as: 'users' });
|
||||||
User.belongsTo(Tenant, { foreignKey: 'tenant_id', as: 'tenant' });
|
User.belongsTo(Tenant, { foreignKey: 'tenant_id', as: 'tenant' });
|
||||||
|
|||||||
Reference in New Issue
Block a user