2017-11-04 10:08:27 +08:00
|
|
|
const sql = require('./sql');
|
|
|
|
const utils = require('./utils');
|
2017-11-06 10:56:42 +08:00
|
|
|
const log = require('./log');
|
2017-11-04 10:08:27 +08:00
|
|
|
|
2017-11-29 06:24:08 +08:00
|
|
|
async function addEvent(comment) {
|
|
|
|
await addNoteEvent(null, comment);
|
2017-11-04 10:08:27 +08:00
|
|
|
}
|
|
|
|
|
2017-11-29 06:24:08 +08:00
|
|
|
async function addNoteEvent(noteId, comment) {
|
|
|
|
await sql.insert('event_log', {
|
2018-01-29 08:30:14 +08:00
|
|
|
noteId : noteId,
|
2017-11-04 10:08:27 +08:00
|
|
|
comment: comment,
|
2018-01-29 08:30:14 +08:00
|
|
|
dateAdded: utils.nowDate()
|
2017-11-04 10:08:27 +08:00
|
|
|
});
|
2017-11-06 10:56:42 +08:00
|
|
|
|
|
|
|
log.info("Event log for " + noteId + ": " + comment);
|
2017-11-04 10:08:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
addEvent,
|
|
|
|
addNoteEvent
|
|
|
|
};
|