fixed filter #800

This commit is contained in:
Joan 2018-11-07 14:20:58 +01:00
parent d0f1c582a4
commit 8db866339c
2 changed files with 4 additions and 3 deletions

View File

@ -22,6 +22,7 @@ module.exports = Self => {
}); });
Self.getTransactions = async filter => { Self.getTransactions = async filter => {
let conn = Self.dataSource.connector;
let stmt = new ParameterizedSQL(` let stmt = new ParameterizedSQL(`
SELECT SELECT
t.id, t.id,
@ -36,7 +37,7 @@ module.exports = Self => {
LEFT JOIN hedera.tpvResponse tt ON tt.id = t.response LEFT JOIN hedera.tpvResponse tt ON tt.id = t.response
LEFT JOIN hedera.tpvError te ON te.code = errorCode`); LEFT JOIN hedera.tpvError te ON te.code = errorCode`);
stmt.merge(Self.buildSuffix(filter, 't')); stmt.merge(conn.makeSuffix(filter, 't'));
return await Self.rawStmt(stmt); return await Self.rawStmt(stmt);
}; };

View File

@ -1,6 +1,6 @@
const ParameterizedSQL = require('vn-loopback/node_modules/loopback-connector').ParameterizedSQL; const ParameterizedSQL = require('vn-loopback/node_modules/loopback-connector').ParameterizedSQL;
module.exports = (Self) => { module.exports = Self => {
Self.remoteMethod('filter', { Self.remoteMethod('filter', {
description: 'Find all instances of the model matched by filter from the data source.', description: 'Find all instances of the model matched by filter from the data source.',
accessType: 'READ', accessType: 'READ',
@ -22,7 +22,7 @@ module.exports = (Self) => {
}, },
}); });
Self.filter = async (filter) => { Self.filter = async filter => {
const stmt = new ParameterizedSQL( const stmt = new ParameterizedSQL(
`SELECT `SELECT
e.id, e.id,