Fix jwt-token
This commit is contained in:
@@ -154,42 +154,57 @@ function defineModels() {
|
||||
]
|
||||
});
|
||||
|
||||
// SecurityLog model (optional, might not exist in all installations)
|
||||
// SecurityLog model - IMPORTANT: Security logs have different retention policies (much longer)
|
||||
models.SecurityLog = sequelize.define('SecurityLog', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
type: DataTypes.UUID,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
defaultValue: DataTypes.UUIDV4
|
||||
},
|
||||
tenant_id: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: true
|
||||
},
|
||||
timestamp: {
|
||||
type: DataTypes.DATE,
|
||||
event_type: {
|
||||
type: DataTypes.STRING(50),
|
||||
allowNull: false
|
||||
},
|
||||
level: {
|
||||
severity: {
|
||||
type: DataTypes.STRING(20),
|
||||
allowNull: false
|
||||
},
|
||||
username: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: true
|
||||
},
|
||||
ip_address: {
|
||||
type: DataTypes.INET,
|
||||
allowNull: true
|
||||
},
|
||||
country_code: {
|
||||
type: DataTypes.STRING(2),
|
||||
allowNull: true
|
||||
},
|
||||
message: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: false
|
||||
},
|
||||
metadata: {
|
||||
type: DataTypes.JSONB,
|
||||
defaultValue: {}
|
||||
created_at: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false
|
||||
}
|
||||
}, {
|
||||
tableName: 'security_logs',
|
||||
timestamps: false,
|
||||
indexes: [
|
||||
{
|
||||
fields: ['tenant_id', 'timestamp']
|
||||
fields: ['tenant_id', 'created_at']
|
||||
},
|
||||
{
|
||||
fields: ['timestamp']
|
||||
fields: ['event_type', 'created_at']
|
||||
},
|
||||
{
|
||||
fields: ['ip_address', 'created_at']
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user