spee.ch/server/models/utils/createClaimRecordData.js

45 lines
768 B
JavaScript
Raw Normal View History

const db = require('../index.js');
const createClaimRecordDataAfterPublish = (
certificateId,
channelName,
fileName,
fileType,
publishParams,
2019-05-24 22:39:46 +02:00
publishResultsOutput
) => {
const {
name,
2019-05-24 22:39:46 +02:00
title,
description,
thumbnail,
nsfw,
claim_address: address,
bid: amount,
} = publishParams;
2018-07-27 02:57:26 +02:00
2019-05-24 22:39:46 +02:00
const { claim_id: claimId, txid, nout } = publishResultsOutput;
2018-07-27 02:57:26 +02:00
return db.Claim.getCurrentHeight().then(height => {
return {
name,
claimId,
title,
description,
address,
thumbnail,
outpoint: `${txid}:${nout}`,
height,
contentType: fileType,
nsfw,
amount,
certificateId,
channelName,
};
});
};
module.exports = {
createClaimRecordDataAfterPublish,
};