2018-08-03 00:54:23 +02:00
|
|
|
const db = require('../index.js');
|
|
|
|
|
2018-07-27 02:57:26 +02:00
|
|
|
const createClaimRecordDataAfterPublish = (certificateId, channelName, fileName, fileType, publishParams, publishResults) => {
|
2018-07-26 22:48:53 +02:00
|
|
|
const {
|
|
|
|
name,
|
|
|
|
metadata: {
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
thumbnail,
|
|
|
|
nsfw,
|
|
|
|
},
|
|
|
|
claim_address: address,
|
|
|
|
bid: amount,
|
|
|
|
} = publishParams;
|
2018-07-27 02:57:26 +02:00
|
|
|
|
2018-07-26 22:48:53 +02:00
|
|
|
const {
|
|
|
|
claim_id: claimId,
|
|
|
|
txid,
|
|
|
|
nout,
|
|
|
|
} = publishResults;
|
2018-07-27 02:57:26 +02:00
|
|
|
|
2018-08-03 00:54:23 +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,
|
|
|
|
};
|
|
|
|
});
|
2018-07-26 22:48:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
createClaimRecordDataAfterPublish,
|
|
|
|
};
|