Files
overleaf-cep/services/web/app/src/Features/Project/ProjectAuditLogHandler.js
Dr. Sasha Göbbels fa674a13cb [web] Log messages to the project audit log and do so for enabling/disabling sharing (#10281)
GitOrigin-RevId: d6af26bcbafb4d1789fca6319fd343fe8c2ecd25
2022-12-13 09:04:08 +00:00

29 lines
724 B
JavaScript

const { ProjectAuditLogEntry } = require('../../models/ProjectAuditLogEntry')
const { callbackify } = require('../../util/promises')
module.exports = {
promises: {
addEntry,
},
addEntry: callbackify(addEntry), // callback version of adEntry
}
/**
* 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)
}