diff --git a/knexfile.js b/knexfile.js index b0694f0..c316e43 100644 --- a/knexfile.js +++ b/knexfile.js @@ -34,7 +34,8 @@ module.exports = { pool: { min: 2, max: 10 - } + }, + debug: true }, GENERAL_CONFIGS), production: _.extend({ diff --git a/persistance/storage/MessageWithReadReceiptStore.js b/persistance/storage/MessageWithReadReceiptStore.js index 4dc63d6..f433959 100644 --- a/persistance/storage/MessageWithReadReceiptStore.js +++ b/persistance/storage/MessageWithReadReceiptStore.js @@ -82,7 +82,7 @@ class MessageWithReadReceiptStore .leftJoin(readReceiptStore.TABLE_NAME, function() { this.on(`${messageStore.TABLE_NAME}.messageId`, '=', `${readReceiptStore.TABLE_NAME}.messageId`) - .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', subscriberForReadReceipt); + .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', knex.raw('?', [subscriberForReadReceipt])); }) .whereIn(`${messageStore.TABLE_NAME}.messageId`, messageIds) .orderBy(`${messageStore.TABLE_NAME}.updatedAt`, 'desc') @@ -110,7 +110,7 @@ class MessageWithReadReceiptStore .leftJoin(readReceiptStore.TABLE_NAME, function() { this.on(`${messageStore.TABLE_NAME}.messageId`, '=', `${readReceiptStore.TABLE_NAME}.messageId`) - .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', subscriberForReadReceipt); + .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', knex.raw('?', [subscriberForReadReceipt])); }) .whereIn(`${messageStore.TABLE_NAME}.messageId`, messageIds) .andWhere(`${messageStore.TABLE_NAME}.topicId`, topic.get('topicId')) @@ -140,7 +140,7 @@ class MessageWithReadReceiptStore .leftJoin(readReceiptStore.TABLE_NAME, function() { this.on(`${messageStore.TABLE_NAME}.messageId`, '=', `${readReceiptStore.TABLE_NAME}.messageId`) - .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', subscriberForReadReceipt); + .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', knex.raw('?', [subscriberForReadReceipt])); }) .where(`${messageStore.TABLE_NAME}.topicId`, topic.get('topicId')) .andWhere(`${messageStore.TABLE_NAME}.updatedAt`, '<=', tillTime.toDate()) @@ -172,7 +172,7 @@ class MessageWithReadReceiptStore .leftJoin(readReceiptStore.TABLE_NAME, function() { this.on(`${messageStore.TABLE_NAME}.messageId`, '=', `${readReceiptStore.TABLE_NAME}.messageId`) - .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', subscriberForReadReceipt); + .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', knex.raw('?', [subscriberForReadReceipt])); }) .where(`${messageStore.TABLE_NAME}.topicId`, topic.get('topicId')) .andWhere(`${messageStore.TABLE_NAME}.updatedAt`, '>=', sinceTime.toDate()) @@ -199,7 +199,7 @@ class MessageWithReadReceiptStore .leftJoin(readReceiptStore.TABLE_NAME, function() { this.on(`${messageStore.TABLE_NAME}.messageId`, '=', `${readReceiptStore.TABLE_NAME}.messageId`) - .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', subscriberForReadReceipt); + .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', knex.raw('?', [subscriberForReadReceipt])); }) .where(`${messageStore.TABLE_NAME}.topicId`, topic.get('topicId')) .andWhere(function() @@ -229,7 +229,7 @@ class MessageWithReadReceiptStore .leftJoin(readReceiptStore.TABLE_NAME, function() { this.on(`${messageStore.TABLE_NAME}.messageId`, '=', `${readReceiptStore.TABLE_NAME}.messageId`) - .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', subscriberForReadReceipt); + .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', knex.raw('?', [subscriberForReadReceipt])); }) .where(`${messageStore.TABLE_NAME}.topicId`, topic.get('topicId')) .andWhere(function() @@ -264,7 +264,7 @@ class MessageWithReadReceiptStore .leftJoin(readReceiptStore.TABLE_NAME, function() { this.on(`${messageStore.TABLE_NAME}.messageId`, '=', `${readReceiptStore.TABLE_NAME}.messageId`) - .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', subscriberForReadReceipt); + .andOn(`${readReceiptStore.TABLE_NAME}.subscriber`, '=', knex.raw('?', [subscriberForReadReceipt])); }) .where(`${messageStore.TABLE_NAME}.topicId`, topic.get('topicId')) .orderBy(`${messageStore.TABLE_NAME}.updatedAt`, 'desc')