diff --git a/server/controllers/api/claim/publish/publish.js b/server/controllers/api/claim/publish/publish.js index 5f0d01a1..88d774dc 100644 --- a/server/controllers/api/claim/publish/publish.js +++ b/server/controllers/api/claim/publish/publish.js @@ -44,7 +44,8 @@ const publish = (publishParams, fileName, fileType) => { }) .then(([fileRecord, claimRecord]) => { // upsert the records - const {name, claim_id: claimId} = publishParams; + const {name} = publishParams; + const {claim_id: claimId} = publishResults; const upsertCriteria = { name, claimId, diff --git a/server/models/claim.js b/server/models/claim.js index 1763ac84..3a841a58 100644 --- a/server/models/claim.js +++ b/server/models/claim.js @@ -403,8 +403,19 @@ module.exports = (sequelize, { STRING, BOOLEAN, INTEGER, TEXT, DECIMAL }) => { }; Claim.getCurrentHeight = function () { - return this - .max('height'); + return new Promise((resolve, reject) => { + return this + .max('height') + .then(result => { + if (result) { + return resolve(result); + } + return resolve(100000); + }) + .catch(error => { + return reject(error); + }); + }); }; return Claim;