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