diff --git a/controllers/serveController.js b/controllers/serveController.js index 3f6d010c..b781a521 100644 --- a/controllers/serveController.js +++ b/controllers/serveController.js @@ -85,7 +85,7 @@ module.exports = { getAssetByChannel (channelName, channelId, claimName) { logger.debug('channelId =', channelId); return new Promise((resolve, reject) => { - getClaimIdByChannel(channelName, channelId) + getClaimIdByChannel(channelName, channelId, claimName) .then(claimId => { logger.debug('claim id = ', claimId); resolve(getAssetByClaimId(claimId, claimName)); diff --git a/helpers/serveHelpers.js b/helpers/serveHelpers.js index 914d27f6..ffd02642 100644 --- a/helpers/serveHelpers.js +++ b/helpers/serveHelpers.js @@ -49,10 +49,10 @@ function getLongChannelId (channelName, channelId) { } }; -function getClaimIdByLongChannelId (channelId, name) { +function getClaimIdByLongChannelId (channelId, claimName) { return new Promise((resolve, reject) => { - logger.debug('finding claim id from channel id and claim name'); - db.sequelize.query(`SELECT claimId FROM Claim WHERE name = '${name}' AND certificateId = '${channelId}' LIMIT 1;`, { type: db.sequelize.QueryTypes.SELECT }) + logger.debug(`finding claim id for claim "${claimName}" from channel "${channelId}"`); + db.sequelize.query(`SELECT claimId FROM Claim WHERE name = '${claimName}' AND certificateId = '${channelId}' LIMIT 1;`, { type: db.sequelize.QueryTypes.SELECT }) .then(result => { switch (result.length) { case 0: