2017-11-03 22:08:27 -04:00
|
|
|
const sql = require('./sql');
|
2018-04-02 20:46:46 -04:00
|
|
|
const dateUtils = require('./date_utils');
|
2017-11-05 21:56:42 -05:00
|
|
|
const log = require('./log');
|
2017-11-03 22:08:27 -04:00
|
|
|
|
2017-11-28 17:24:08 -05:00
|
|
|
async function addEvent(comment) {
|
|
|
|
await addNoteEvent(null, comment);
|
2017-11-03 22:08:27 -04:00
|
|
|
}
|
|
|
|
|
2017-11-28 17:24:08 -05:00
|
|
|
async function addNoteEvent(noteId, comment) {
|
|
|
|
await sql.insert('event_log', {
|
2018-01-28 19:30:14 -05:00
|
|
|
noteId : noteId,
|
2017-11-03 22:08:27 -04:00
|
|
|
comment: comment,
|
2018-05-26 12:38:25 -04:00
|
|
|
dateCreated: dateUtils.nowDate()
|
2017-11-03 22:08:27 -04:00
|
|
|
});
|
2017-11-05 21:56:42 -05:00
|
|
|
|
|
|
|
log.info("Event log for " + noteId + ": " + comment);
|
2017-11-03 22:08:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
addEvent,
|
|
|
|
addNoteEvent
|
|
|
|
};
|