Resolve channels #150
2 changed files with 4 additions and 4 deletions
|
@ -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));
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue