Fix jwt-token

This commit is contained in:
2025-09-24 04:57:07 +02:00
parent 02ce9d343b
commit 6c28330af3
6 changed files with 772 additions and 21 deletions

View File

@@ -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']
}
]
});