notifications: add ack flag in db logic

This commit is contained in:
Girish Ramakrishnan
2019-03-04 20:44:41 -08:00
parent 4bf165efaf
commit 8dfe1fe97f
2 changed files with 4 additions and 3 deletions

View File

@@ -27,8 +27,8 @@ function add(notification, callback) {
assert.strictEqual(typeof notification, 'object');
assert.strictEqual(typeof callback, 'function');
const query = 'INSERT INTO notifications (userId, eventId, title, message) VALUES (?, ?, ?, ?)';
const args = [ notification.userId, notification.eventId, notification.title, notification.message ];
const query = 'INSERT INTO notifications (userId, eventId, title, message, acknowledged) VALUES (?, ?, ?, ?, ?)';
const args = [ notification.userId, notification.eventId, notification.title, notification.message, notification.acknowledged ];
database.query(query, args, function (error, result) {
if (error && error.code === 'ER_NO_REFERENCED_ROW_2') return callback(new DatabaseError(DatabaseError.NOT_FOUND, 'no such eventlog entry'));