forked from DebaucheryLibrarian/traxxx
24 lines
395 B
JavaScript
24 lines
395 B
JavaScript
|
'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,
|
||
|
};
|