Create src/models/AuditLog.js
Browse files- src/models/AuditLog.js +15 -0
src/models/AuditLog.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import mongoose from "mongoose";
|
| 2 |
+
|
| 3 |
+
const AuditLogSchema = new mongoose.Schema(
|
| 4 |
+
{
|
| 5 |
+
userId: mongoose.Schema.Types.ObjectId,
|
| 6 |
+
action: String,
|
| 7 |
+
severity: String,
|
| 8 |
+
ip: String,
|
| 9 |
+
userAgent: String,
|
| 10 |
+
isAnomaly: { type: Boolean, default: false },
|
| 11 |
+
},
|
| 12 |
+
{ timestamps: true }
|
| 13 |
+
);
|
| 14 |
+
|
| 15 |
+
export const AuditLog = mongoose.model("AuditLog", AuditLogSchema);
|