added title and description to db.Claim upsert and show page

This commit is contained in:
bill bittner 2017-08-20 17:45:29 -07:00
parent bb243cf459
commit 188608818c
3 changed files with 22 additions and 10 deletions

View file

@ -24,15 +24,17 @@ module.exports = {
publishResults = result;
logger.info(`Successfully published ${fileName}`, publishResults);
fileRecord = {
name : publishParams.name,
claimId : publishResults.claim_id,
address : publishParams.claim_address,
outpoint: `${publishResults.txid}:${publishResults.nout}`,
height : 0,
name : publishParams.name,
claimId : publishResults.claim_id,
title : publishParams.metadata.title,
description: publishParams.metadata.description,
address : publishParams.claim_address,
outpoint : `${publishResults.txid}:${publishResults.nout}`,
height : 0,
fileName,
filePath: publishParams.file_path,
filePath : publishParams.file_path,
fileType,
nsfw : publishParams.metadata.nsfw,
nsfw : publishParams.metadata.nsfw,
};
upsertCriteria = {
name : publishParams.name,

View file

@ -1,5 +1,5 @@
const logger = require('winston');
const { serveFile, showFile, showFileLite, getShortIdFromClaimId } = require('../helpers/serveHelpers.js');
const { serveFile, showFile, showFileLite, getShortIdFromClaimId, resolveAgainstClaimTable } = require('../helpers/serveHelpers.js');
const { getAssetByChannel, getAssetByShortId, getAssetByClaimId, getAssetByName } = require('../controllers/serveController.js');
const { handleRequestError } = require('../helpers/errorHandlers.js');
const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js');
@ -48,6 +48,12 @@ function serveOrShowAsset (fileInfo, extension, method, headers, originalUrl, ip
return getShortIdFromClaimId(fileInfo.claimId, fileInfo.height, fileInfo.name)
.then(shortId => {
fileInfo['shortId'] = shortId;
return resolveAgainstClaimTable(fileInfo.name, fileInfo.claimId);
})
.then(resolveResult => {
logger.debug('resolve result', resolveResult);
fileInfo['title'] = resolveResult.title;
fileInfo['description'] = resolveResult.description;
showFile(fileInfo, res);
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
return fileInfo;

View file

@ -1,6 +1,6 @@
<div class="panel">
<h2>Name</h2>
<p>{{fileInfo.name}}</>
<h2>Title</h2>
<p>{{fileInfo.title}}</>
</div>
<div class="panel links">
<h2 class="subheader">Links</h2>
@ -54,6 +54,10 @@
</div>
{{/ifConditional}}
</div>
<div class="panel">
<h2>Description</h2>
<p>{{fileInfo.description}}</>
</div>
<div class="panel">
<h2 class="subheader">Metadata</h2>
<table class="metadata-table" style="table-layout: fixed">