Full support for message attachments
This commit is contained in:
parent
bfc6983c93
commit
35bce32529
6 changed files with 229 additions and 106 deletions
|
@ -374,7 +374,10 @@ module.exports.getAttachments = (campaign, callback) => {
|
|||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
connection.query('SELECT `id`, `filename`, `size`, `created` FROM `attachments` WHERE `campaign`=?', [campaign], (err, rows) => {
|
||||
|
||||
let keys = ['id', 'filename', 'content_type', 'size', 'created'];
|
||||
|
||||
connection.query('SELECT `' + keys.join('`, `') + '` FROM `attachments` WHERE `campaign`=?', [campaign], (err, rows) => {
|
||||
connection.release();
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
@ -455,14 +458,14 @@ module.exports.deleteAttachment = (id, attachment, callback) => {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.getAttachment = (id, attachment, callback) => {
|
||||
module.exports.getAttachment = (campaign, attachment, callback) => {
|
||||
db.getConnection((err, connection) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
let query = 'SELECT `filename`, `content_type`, `content` FROM `attachments` WHERE `id`=? AND `campaign`=? LIMIT 1';
|
||||
connection.query(query, [attachment, id], (err, rows) => {
|
||||
let query = 'SELECT * FROM `attachments` WHERE `id`=? AND `campaign`=? LIMIT 1';
|
||||
connection.query(query, [attachment, campaign], (err, rows) => {
|
||||
connection.release();
|
||||
if (err) {
|
||||
return callback(err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue