updated publish logging

This commit is contained in:
bill bittner 2017-06-30 17:28:53 -07:00
parent 8bf91368ef
commit 35f9551533
2 changed files with 7 additions and 2 deletions

View file

@ -8,8 +8,10 @@ function upsert (Model, values, condition) {
.findOne({ where: condition }) .findOne({ where: condition })
.then(function (obj) { .then(function (obj) {
if (obj) { // update if (obj) { // update
logger.silly(`updating ${values.name}:${values.claimId} in File db`);
return obj.update(values); return obj.update(values);
} else { // insert } else { // insert
logger.silly(`creating ${values.name}:${values.claimId} in File db`);
return Model.create(values); return Model.create(values);
} }
}).catch(function (error) { }).catch(function (error) {
@ -38,7 +40,10 @@ module.exports = {
fileType, fileType,
nsfw : publishParams.metadata.nsfw, nsfw : publishParams.metadata.nsfw,
}, },
{ name: publishParams.name, claimId: result.claim_id } {
name : publishParams.name,
claimId: result.claim_id,
}
).then(() => { ).then(() => {
// resolve the promise with the result from lbryApi.publishClaim; // resolve the promise with the result from lbryApi.publishClaim;
resolve(result); resolve(result);

View file

@ -75,7 +75,7 @@ function getClaimAndHandleResponse (uri, height, resolve, reject) {
.getClaim(uri) .getClaim(uri)
.then(({ name, claim_id, outpoint, file_name, download_path, mime_type, metadata }) => { .then(({ name, claim_id, outpoint, file_name, download_path, mime_type, metadata }) => {
// create entry in the db // create entry in the db
logger.debug('creating new record in db'); logger.silly(`creating "${name}" record in File db`);
db.File db.File
.create({ .create({
name, name,