Files
overleaf-cep/services/web/app/src/Features/Project/ProjectAuditLogHandler.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

27 lines
603 B
JavaScript

const { ProjectAuditLogEntry } = require('../../models/ProjectAuditLogEntry')
module.exports = {
promises: {
addEntry,
},
}
/**
* Add an audit log entry
*
* The entry should include at least the following fields:
*
* - operation: a string identifying the type of operation
* - userId: the user on behalf of whom the operation was performed
* - message: a string detailing what happened
*/
async function addEntry(projectId, operation, initiatorId, info = {}) {
const entry = {
projectId,
operation,
initiatorId,
info,
}
await ProjectAuditLogEntry.create(entry)
}