Skip to content

Commit 45ba2a3

Browse files
authored
Merge pull request #7 from CatalystCode/fix-bug
Fix bugs in getById
2 parents a9103b9 + 04c9f2b commit 45ba2a3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

controllers/features.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ exports.upsert = function(req, res) {
2222

2323
exports.getById = function(req, res) {
2424
let query = {
25-
id: req.query.id.split(','),
25+
id: req.params.id.split(','),
2626
include: req.query.include
2727
};
2828

services/features.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function executeQuery(query, callback) {
3232

3333
function getById(query, callback) {
3434
const ids = query.id.constructor === Array ? query.id : [query.id];
35-
const getQuery = `SELECT ${buildQueryColumns(query)} FROM features WHERE id IN (${escapeSql(ids.join(','))})`;
35+
const getQuery = `SELECT ${buildQueryColumns(query)} FROM features WHERE id IN (${ids.map(escapeSql).join(',')})`;
3636
executeQuery(getQuery, (err, rows) => {
3737
if (err) return callback(err);
3838
if (!rows || rows.length === 0) return callback(null, null);

0 commit comments

Comments
 (0)