This commit is contained in:
Ccjcarkbla
2026-06-13 08:03:45 -04:00
parent cfcd6ae11e
commit a2c300678b
121 changed files with 8639 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const AuditLog = sequelize.define('AuditLog', {
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
organizationId: { type: DataTypes.INTEGER },
userId: { type: DataTypes.INTEGER },
userRole: { type: DataTypes.STRING },
action: { type: DataTypes.STRING, allowNull: false },
entityType: { type: DataTypes.STRING },
entityId: { type: DataTypes.INTEGER },
details: {
type: DataTypes.TEXT,
get() { try { return JSON.parse(this.getDataValue('details') || '{}'); } catch { return {}; } },
set(v) { this.setDataValue('details', JSON.stringify(v)); },
},
ipAddress: { type: DataTypes.STRING },
userAgent: { type: DataTypes.STRING },
}, {
updatedAt: false,
createdAt: 'createdAt',
});
return { AuditLog };
};