get channel data from publish params
This commit is contained in:
parent
34a66f1968
commit
3935715e29
1 changed files with 2 additions and 14 deletions
|
@ -7,7 +7,6 @@ const deleteFile = require('./deleteFile.js');
|
|||
|
||||
const publish = async (publishParams, fileName, fileType) => {
|
||||
let publishResults;
|
||||
let channel;
|
||||
let fileRecord;
|
||||
let filePath = publishParams.file_path;
|
||||
let newFile = Boolean(filePath);
|
||||
|
@ -16,19 +15,8 @@ const publish = async (publishParams, fileName, fileType) => {
|
|||
publishResults = await publishClaim(publishParams);
|
||||
logger.info(`Successfully published ${publishParams.name} ${fileName}`, publishResults);
|
||||
|
||||
// get the channel information
|
||||
if (publishParams.channel_name) {
|
||||
logger.debug(`this claim was published in channel: ${publishParams.channel_name}`);
|
||||
channel = await db.Channel.findOne({
|
||||
where: {
|
||||
channelName: publishParams.channel_name,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
channel = null;
|
||||
}
|
||||
const certificateId = channel ? channel.channelClaimId : null;
|
||||
const channelName = channel ? channel.channelName : null;
|
||||
const certificateId = publishParams.channel_id || null;
|
||||
const channelName = publishParams.channel_name || null;
|
||||
|
||||
const claimRecord = await createClaimRecordDataAfterPublish(certificateId, channelName, fileName, fileType, publishParams, publishResults);
|
||||
const {claimId} = claimRecord;
|
||||
|
|
Loading…
Reference in a new issue