This commit is contained in:
张成
2026-03-24 16:07:02 +08:00
commit aa8eaa6ccd
121 changed files with 34042 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
const Sequelize = require("sequelize");
module.exports = (db) => {
return db.define(
"biz_audit_log",
{
id: {
type: Sequelize.BIGINT.UNSIGNED,
primaryKey: true,
autoIncrement: true,
},
admin_user_id: {
type: Sequelize.BIGINT.UNSIGNED,
allowNull: true,
},
biz_user_id: {
type: Sequelize.BIGINT.UNSIGNED,
allowNull: true,
},
action: {
type: Sequelize.STRING(64),
allowNull: false,
},
resource_type: {
type: Sequelize.STRING(64),
allowNull: false,
defaultValue: "",
},
resource_id: {
type: Sequelize.BIGINT.UNSIGNED,
allowNull: true,
},
detail: {
type: Sequelize.JSON,
allowNull: true,
},
created_at: {
type: Sequelize.DATE,
allowNull: false,
},
},
{
tableName: "biz_audit_log",
timestamps: false,
underscored: true,
comment: "审计日志",
hooks: {
beforeCreate(row) {
if (!row.created_at) row.created_at = new Date();
},
},
}
);
};