mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
19 lines
458 B
JavaScript
19 lines
458 B
JavaScript
|
var Promise = require('bluebird'),
|
||
|
dbPool = require('./dbPool');
|
||
|
|
||
|
function storeEvent(event) {
|
||
|
var sql = 'INSERT INTO events(type, user, data) VALUES ($1, $2, $3)';
|
||
|
var params = [event.type,event.user,event.data];
|
||
|
|
||
|
return new Promise(function (resolve, reject) {
|
||
|
dbPool.query(sql, params, function (err) {
|
||
|
if (err) {reject(err);}
|
||
|
resolve();
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
|
||
|
module.exports = {
|
||
|
store: storeEvent()
|
||
|
};
|