traxxx/src/alerts.js

24 lines
395 B
JavaScript
Raw Normal View History

'use strict';
const knex = require('./knex');
async function addAlert(alert, user) {
console.log(alert);
const alertId = await knex('alerts').insert({
user_id: user.id,
notify: alert.notify,
email: alert.notify,
});
console.log(alertId);
}
async function removeAlert(alertId) {
await knex('alerts').where('id', alertId).delete();
}
module.exports = {
addAlert,
removeAlert,
};