Resolve channels #150

Merged
bones7242 merged 23 commits from resolve-channels into master 2017-08-25 18:35:40 +02:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 994b3c6ce4 - Show all commits

View file

@ -85,7 +85,7 @@ module.exports = {
getAssetByChannel (channelName, channelId, claimName) { getAssetByChannel (channelName, channelId, claimName) {
logger.debug('channelId =', channelId); logger.debug('channelId =', channelId);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getClaimIdByChannel(channelName, channelId) getClaimIdByChannel(channelName, channelId, claimName)
.then(claimId => { .then(claimId => {
logger.debug('claim id = ', claimId); logger.debug('claim id = ', claimId);
resolve(getAssetByClaimId(claimId, claimName)); resolve(getAssetByClaimId(claimId, claimName));

View file

@ -49,10 +49,10 @@ function getLongChannelId (channelName, channelId) {
} }
}; };
function getClaimIdByLongChannelId (channelId, name) { function getClaimIdByLongChannelId (channelId, claimName) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logger.debug('finding claim id from channel id and claim name'); logger.debug(`finding claim id for claim "${claimName}" from channel "${channelId}"`);
db.sequelize.query(`SELECT claimId FROM Claim WHERE name = '${name}' AND certificateId = '${channelId}' LIMIT 1;`, { type: db.sequelize.QueryTypes.SELECT }) db.sequelize.query(`SELECT claimId FROM Claim WHERE name = '${claimName}' AND certificateId = '${channelId}' LIMIT 1;`, { type: db.sequelize.QueryTypes.SELECT })
.then(result => { .then(result => {
switch (result.length) { switch (result.length) {
case 0: case 0: