overleaf/services/web/app/src/models/UserAuditLogEntry.js
Miguel Serrano 74f44e655a Merge pull request #9617 from overleaf/msm-audit-log-collections
Move project/user audit logs to their own collections

GitOrigin-RevId: f6f89b3e2815c0fe5691a79eceb35b77b3c370d8
2022-09-30 08:04:17 +00:00

22 lines
592 B
JavaScript

const mongoose = require('../infrastructure/Mongoose')
const { Schema } = mongoose
const UserAuditLogEntrySchema = new Schema(
{
userId: { type: Schema.Types.ObjectId, index: true },
info: { type: Object },
initiatorId: { type: Schema.Types.ObjectId },
ipAddress: { type: String },
operation: { type: String },
timestamp: { type: Date, default: Date.now },
},
{
collection: 'userAuditLogEntries',
}
)
exports.UserAuditLogEntry = mongoose.model(
'UserAuditLogEntry',
UserAuditLogEntrySchema
)
exports.UserAuditLogEntrySchema = UserAuditLogEntrySchema