removed unused files

This commit is contained in:
bill bittner 2017-08-16 13:36:16 -07:00
parent ed68514b8f
commit cd0b19f798
2 changed files with 0 additions and 107 deletions

View file

@ -1,11 +0,0 @@
const logger = require('winston');
module.exports = ({ value }) => {
if (!value.stream.metadata.fee || value.stream.metadata.fee.amount === 0) {
logger.debug('isFreeClaim?', true);
return true;
} else {
logger.debug('isFreePublicClaim?', false);
return false;
}
};

View file

@ -1,96 +0,0 @@
const logger = require('winston');
const db = require('../models');
module.exports = {
getLocalClaimList (name) {
logger.debug(`db.Claim >> Getting claim_list for "${name}"`);
return db.Claim.findAll({ name })
.then(result => {
logger.debug('db.claim result length', result.length);
if (result.length >= 1) {
result = result.map(claim => {
return claim.dataValues;
});
return result;
} else {
return null;
}
})
.catch(error => {
return error;
});
},
resolveLocalUri (name, claimId) {
logger.debug(`db.Claim >> Resolving "${name}#${claimId}"`);
db.Claim.findAll({ name, claimId })
.then(result => {
if (result) {
if (result.length > 1) {
result = result.sort((a, b) => {
return (a.dataValues.height < b.dataValues.height);
});
}
return result[0].dataValues;
} else {
return null;
}
})
.catch(error => {
return error;
});
},
updateLocalClaimRecordFromResolve (claim) {
logger.debug('db.Claim >> creating claim entry from lbry resolve results');
// parse the resolved data
let claimData = {};
claimData['address'] = claim.address;
claimData['amount'] = claim.amount;
claimData['claimId'] = claim.claim_id;
claimData['claimSequence'] = claim.claim_sequence;
claimData['decodedClaim'] = claim.decoded_claim;
claimData['depth'] = claim.depth;
claimData['effectiveAmount'] = claim.effective_amount;
claimData['hasSignature'] = claim.has_signature;
claimData['height'] = claim.height;
claimData['hex'] = claim.hex;
claimData['name'] = claim.name;
claimData['nout'] = claim.nout;
claimData['txid'] = claim.txid;
claimData['validAtHeight'] = claim.valid_at_height;
claimData['outpoint'] = `${claim.txid}:${claim.nout}`;
if (claim.value) {
claimData['claimType'] = claim.value.claimType;
if (claim.value.stream) {
if (claim.value.stream.metadata) {
claimData['author'] = claim.value.stream.metadata.author;
claimData['description'] = claim.value.stream.metadata.description;
claimData['language'] = claim.value.stream.metadata.language;
claimData['licenseUrl'] = claim.value.stream.metadata.licenseUrl;
claimData['nsfw'] = claim.value.stream.metadata.nsfw;
claimData['preview'] = claim.value.stream.metadata.preview;
claimData['thumbnail'] = claim.value.stream.metadata.thumbnail;
claimData['title'] = claim.value.stream.metadata.title;
claimData['metadataVersion'] = claim.value.stream.metadata.version;
}
if (claim.value.stream.source) {
claimData['contentType'] = claim.value.stream.source.contentType;
claimData['source'] = claim.value.stream.source.source;
claimData['sourceType'] = claim.value.stream.source.sourceType;
claimData['sourceVersion'] = claim.value.stream.source.version;
}
claimData['streamVersion'] = claim.value.stream.version;
}
claimData['valueVersion'] = claim.value.version;
}
// create search criteria
const updateCriteria = { name: claimData.name, claimId: claimData.claimId };
// create entry in db
db.Claim.update(claimData, updateCriteria)
.then((rows, result) => {
logger.debug('successfully updated record in db.Claim');
})
.catch(error => {
logger.error('db.Claim.update error', error);
});
},
};