Upload refactor #242

Merged
bones7242 merged 24 commits from upload-refactor into master 2017-11-13 21:39:21 +01:00
Showing only changes of commit fc5d8510ad - Show all commits

View file

@ -15,13 +15,19 @@ module.exports = {
publishResults = tx; publishResults = tx;
if (publishParams.channel_name) { if (publishParams.channel_name) {
logger.debug(`this claim was published in channel: ${publishParams.channel_name}`); logger.debug(`this claim was published in channel: ${publishParams.channel_name}`);
return db.Channel.findOne({where: {channelName: publishParams.channel_name}}).then(channel => { return channel.channelClaimId }); return db.Channel.findOne({where: {channelName: publishParams.channel_name}});
} else { } else {
logger.debug('this claim was published in channel: n/a'); logger.debug('this claim was published in channel: n/a');
return null; return null;
} }
}) })
.then(certificateId => { .then(channel => {
let certificateId = null;
let channelName = null;
if (channel) {
certificateId = channel.channelClaimId;
channelName = channel.channelName;
}
logger.debug(`certificateId: ${certificateId}`); logger.debug(`certificateId: ${certificateId}`);
kauffj commented 2017-11-10 18:28:28 +01:00 (Migrated from github.com)
Review

Missing let?

Missing `let`?
bones7242 commented 2017-11-13 20:26:24 +01:00 (Migrated from github.com)
Review

defined on line 9 to hoist and make available further down promise chain

defined on line 9 to hoist and make available further down promise chain
const fileRecord = { const fileRecord = {
name : publishParams.name, name : publishParams.name,
@ -47,8 +53,9 @@ module.exports = {
height : 0, height : 0,
contentType: fileType, contentType: fileType,
nsfw : publishParams.metadata.nsfw, nsfw : publishParams.metadata.nsfw,
certificateId,
amount : publishParams.bid, amount : publishParams.bid,
certificateId,
channelName,
}; };
const upsertCriteria = { const upsertCriteria = {
name : publishParams.name, name : publishParams.name,