Added sqlite db and email queue.
This commit is contained in:
parent
5a5c70cfb1
commit
03271573be
8 changed files with 169 additions and 12 deletions
server/services
20
server/services/mailService.js
Normal file
20
server/services/mailService.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ffffng')
|
||||
.service('MailService', function (Database, _) {
|
||||
return {
|
||||
enqueue: function (sender, recipient, email, data, callback) {
|
||||
if (!_.isPlainObject(data)) {
|
||||
return callback(new Error('Unexpected data: ' + data));
|
||||
}
|
||||
Database.run(
|
||||
'INSERT INTO email_queue (failures, sender, recipient, email, data) VALUES (?, ?, ?, ?, ?)',
|
||||
[0, sender, recipient, email, JSON.stringify(data)],
|
||||
function (err, res) {
|
||||
debugger;
|
||||
callback(err, res);
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue