forked from UKSOURCE/cms.hailearning.edu.vn
feat: Remove file
This commit is contained in:
@@ -1,64 +0,0 @@
|
|||||||
const mongoose = require("mongoose");
|
|
||||||
const AUDIT_ACTIONS = require("../constants/auditAction");
|
|
||||||
|
|
||||||
const auditLogSchema = new mongoose.Schema({
|
|
||||||
model: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
documentId: {
|
|
||||||
type: mongoose.Schema.Types.ObjectId,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
action: {
|
|
||||||
type: String,
|
|
||||||
enum: Object.values(AUDIT_ACTIONS),
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
before: {
|
|
||||||
type: mongoose.Schema.Types.Mixed,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
|
|
||||||
after: {
|
|
||||||
type: mongoose.Schema.Types.Mixed,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
|
|
||||||
changes: {
|
|
||||||
type: [
|
|
||||||
{
|
|
||||||
field: String,
|
|
||||||
before: mongoose.Schema.Types.Mixed,
|
|
||||||
after: mongoose.Schema.Types.Mixed,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
default: [],
|
|
||||||
},
|
|
||||||
|
|
||||||
ipAddress: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
userAgent: {
|
|
||||||
type: String,
|
|
||||||
default: "",
|
|
||||||
},
|
|
||||||
|
|
||||||
performedBy: {
|
|
||||||
type: mongoose.Schema.Types.ObjectId,
|
|
||||||
ref: "User",
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
|
|
||||||
createdAt: {
|
|
||||||
type: Date,
|
|
||||||
default: Date.now,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = mongoose.model("AuditLog", auditLogSchema); // Index for faster queries
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
const mongoose = require('mongoose');
|
|
||||||
|
|
||||||
const HeaderMenuSchema = new mongoose.Schema({
|
|
||||||
title: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
trim: true
|
|
||||||
},
|
|
||||||
slug: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
trim: true,
|
|
||||||
lowercase: true
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
trim: true
|
|
||||||
},
|
|
||||||
parentId: {
|
|
||||||
type: mongoose.Schema.Types.ObjectId,
|
|
||||||
ref: 'HeaderMenu',
|
|
||||||
default: null
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
status: {
|
|
||||||
type: String,
|
|
||||||
enum: ['active', 'inactive'],
|
|
||||||
default: 'active'
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: String,
|
|
||||||
enum: ['internal', 'external'],
|
|
||||||
default: 'internal'
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
timestamps: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// Indexes for optimization
|
|
||||||
HeaderMenuSchema.index({ order: 1 });
|
|
||||||
HeaderMenuSchema.index({ status: 1 });
|
|
||||||
HeaderMenuSchema.index({ parentId: 1, order: 1 });
|
|
||||||
|
|
||||||
module.exports = mongoose.model('HeaderMenu', HeaderMenuSchema);
|
|
||||||
Reference in New Issue
Block a user