Fixes in migration of templates and campaigns from Mailtrain ver 1

This commit is contained in:
Tomas Bures 2018-07-22 15:02:43 +05:30
parent 189638364c
commit ee786bc8ad
10 changed files with 89 additions and 18 deletions

View file

@ -14,6 +14,12 @@ exports.up = (knex, Promise) => (async() => {
type = 'ckeditor';
}
if (type == 'mosaico') {
type = 'mosaicoWithFsTemplate';
data.mosaicoFsTemplate = data.template;
delete data.template;
}
await knex('templates').where('id', template.id).update({type, data: JSON.stringify(data)});
}

View file

@ -109,23 +109,19 @@ exports.up = (knex, Promise) => (async() => {
campaign.source_type = CampaignSource.CUSTOM;
data.source = {
type: editorType,
data: JSON.stringify(editorData),
data: editorData,
html: campaign.html,
text: campaign.text,
htmlPrepared: campaign.html_prepared
};
} else {
campaign.source_type = CampaignSource.URL;
data.source = {
url: campaign.source_url
};
data.sourceUrl = campaign.source_url;
}
} else if (campaign.type === CampaignType.RSS) {
campaign.source_type = CampaignSource.RSS;
data.source = {
url: campaign.source_url
};
data.feedUrl = campaign.source_url;
data.checkStatus = campaign.checkStatus;
}