cleaning up getClaimByName route
This commit is contained in:
parent
c89061c83f
commit
6b7bea6471
1 changed files with 6 additions and 4 deletions
|
@ -24,13 +24,15 @@ module.exports = {
|
|||
// get all free public claims
|
||||
getAllFreePublicClaims(claimName)
|
||||
.then(function(freePublicClaimList){
|
||||
console.log(">> Decided on public claim id:", freePublicClaimList[0].claim_id);
|
||||
var claimId = freePublicClaimList[0].claim_id;
|
||||
var name = freePublicClaimList[0].name;
|
||||
var freePublicClaimOutpoint = freePublicClaimList[0].txid + ":" + freePublicClaimList[0].nout;
|
||||
var freePublicClaimUri = freePublicClaimList[0].name + "#" + freePublicClaimList[0].claim_id;
|
||||
var freePublicClaimUri = name + "#" + claimId;
|
||||
console.log(">> Decided on public claim id:", claimId);
|
||||
// check to see if the file is available locally
|
||||
db.File.findOne({where: { claim_id: freePublicClaimList[0].claim_id }})
|
||||
db.File.findOne({where: { name: name, claim_id: claimId }})
|
||||
.then(function(claim){
|
||||
// if a found locally...
|
||||
// if a matching claim is found locally...
|
||||
if (claim){
|
||||
console.log(">> A matching claim_id was found locally");
|
||||
// if the outpoint's match return it
|
||||
|
|
Loading…
Reference in a new issue