undo assignment of certId and channelName
This commit is contained in:
parent
bd1424acff
commit
53676e6bc0
1 changed files with 14 additions and 2 deletions
|
@ -7,6 +7,7 @@ const deleteFile = require('./deleteFile.js');
|
||||||
|
|
||||||
const publish = async (publishParams, fileName, fileType) => {
|
const publish = async (publishParams, fileName, fileType) => {
|
||||||
let publishResults;
|
let publishResults;
|
||||||
|
let channel;
|
||||||
let fileRecord;
|
let fileRecord;
|
||||||
let filePath = publishParams.file_path;
|
let filePath = publishParams.file_path;
|
||||||
let newFile = Boolean(filePath);
|
let newFile = Boolean(filePath);
|
||||||
|
@ -15,8 +16,19 @@ const publish = async (publishParams, fileName, fileType) => {
|
||||||
publishResults = await publishClaim(publishParams);
|
publishResults = await publishClaim(publishParams);
|
||||||
logger.info(`Successfully published ${publishParams.name} ${fileName}`, publishResults);
|
logger.info(`Successfully published ${publishParams.name} ${fileName}`, publishResults);
|
||||||
|
|
||||||
const certificateId = publishParams.channel_id || null;
|
// get the channel information
|
||||||
const channelName = publishParams.channel_name || null;
|
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 claimRecord = await createClaimRecordDataAfterPublish(certificateId, channelName, fileName, fileType, publishParams, publishResults);
|
const claimRecord = await createClaimRecordDataAfterPublish(certificateId, channelName, fileName, fileType, publishParams, publishResults);
|
||||||
const {claimId} = claimRecord;
|
const {claimId} = claimRecord;
|
||||||
|
|
Loading…
Add table
Reference in a new issue