Fix remaining chainquery exceptions and bad logic

This commit is contained in:
Shawn 2018-10-10 12:19:51 -05:00
parent bb81441357
commit 2e45314610
4 changed files with 5 additions and 5 deletions

View file

@ -16,7 +16,7 @@ const claimData = async ({ ip, originalUrl, body, params }, res) => {
try {
let resolvedClaim = await chainquery.claim.queries.resolveClaim(claimName, claimId).catch(() => {});
if(!resolvedClaim) {
resolvedClaim = await db.Claim.resolveClaim(claimName, claimId);
}

View file

@ -10,7 +10,7 @@ const chainquery = require('chainquery');
const claimShortId = async ({ ip, originalUrl, body, params }, res) => {
try {
let shortId = await chainquery.claim.queries.getShortClaimIdFromLongClaimId(params.longId, params.name);
let shortId = await chainquery.claim.queries.getShortClaimIdFromLongClaimId(params.longId, params.name).catch(() => {});
if(shortId === null) {
shortId = await db.Claim.getShortClaimIdFromLongClaimId(params.longId, params.name);

View file

@ -25,11 +25,11 @@ const getClaimIdAndServeAsset = (channelName, channelClaimId, claimName, claimId
})
.then(claim => {
if (!claim) {
logger.debug('Full claim id:', fullClaimId);
logger.debug('Full claim id:', claimId);
return db.Claim.findOne({
where: {
name : claimName,
claimId: fullClaimId,
claimId,
},
});
}

View file

@ -28,7 +28,7 @@ const getClaimId = async (channelName, channelClaimId, name, claimId) => {
} else {
let claimIdResult = await chainquery.claim.queries.getLongClaimId(name, claimId);
if(claimIdResult === null) {
if(!claimIdResult) {
claimIdResult = await db.Claim.getLongClaimId(name, claimId);
}