mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Added benefits, offers and snippets to exporter
- These are more things that we should write an importer for
This commit is contained in:
parent
3471f6cca0
commit
d6d6841186
@ -1,5 +1,8 @@
|
||||
const {BACKUP_TABLES, TABLES_ALLOWLIST} = require('./table-lists');
|
||||
|
||||
module.exports = {
|
||||
doExport: require('./exporter'),
|
||||
fileName: require('./export-filename'),
|
||||
BACKUP_TABLES: require('./table-lists').BACKUP_TABLES
|
||||
BACKUP_TABLES,
|
||||
TABLES_ALLOWLIST
|
||||
};
|
||||
|
@ -17,10 +17,7 @@ const BACKUP_TABLES = [
|
||||
'permissions',
|
||||
'permissions_roles',
|
||||
'permissions_users',
|
||||
'benefits',
|
||||
'products_benefits',
|
||||
'webhooks',
|
||||
'snippets',
|
||||
'tokens',
|
||||
'sessions',
|
||||
'mobiledoc_revisions',
|
||||
@ -34,9 +31,8 @@ const BACKUP_TABLES = [
|
||||
'members_paid_subscription_events',
|
||||
'members_subscribe_events',
|
||||
'members_product_events',
|
||||
'members_newsletters',
|
||||
'offers',
|
||||
'offer_redemptions'
|
||||
'members_newsletters'
|
||||
|
||||
];
|
||||
|
||||
// NOTE: exposing only tables which are going to be included in a "default" export file
|
||||
@ -57,7 +53,12 @@ const TABLES_ALLOWLIST = [
|
||||
'stripe_products',
|
||||
'stripe_prices',
|
||||
'posts_products',
|
||||
'newsletters'
|
||||
'newsletters',
|
||||
'benefits',
|
||||
'products_benefits',
|
||||
'offers',
|
||||
'offer_redemptions',
|
||||
'snippets'
|
||||
];
|
||||
|
||||
// NOTE: these are settings keys which should never end up in the export file
|
||||
|
@ -14,6 +14,8 @@ const localUtils = require('./utils');
|
||||
let request;
|
||||
let eventsTriggered;
|
||||
|
||||
const TABLE_ALLOWLIST_LENGTH = 20;
|
||||
|
||||
describe('DB API (canary)', function () {
|
||||
let backupKey;
|
||||
let schedulerKey;
|
||||
@ -52,8 +54,8 @@ describe('DB API (canary)', function () {
|
||||
should.exist(jsonResponse.db);
|
||||
jsonResponse.db.should.have.length(1);
|
||||
|
||||
// NOTE: 16 default tables + 1 from include parameters
|
||||
Object.keys(jsonResponse.db[0].data).length.should.eql(16);
|
||||
// NOTE: default tables + 1 from include parameters
|
||||
Object.keys(jsonResponse.db[0].data).length.should.eql(TABLE_ALLOWLIST_LENGTH + 1);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -40,7 +40,7 @@ describe('Exporter', function () {
|
||||
it('should try to export all the correct tables (without excluded)', function (done) {
|
||||
exporter.doExport().then(function (exportData) {
|
||||
// NOTE: 15 default tables
|
||||
const expectedCallCount = 15;
|
||||
const expectedCallCount = exporter.TABLES_ALLOWLIST.length;
|
||||
|
||||
should.exist(exportData);
|
||||
|
||||
@ -67,7 +67,12 @@ describe('Exporter', function () {
|
||||
'stripe_products',
|
||||
'stripe_prices',
|
||||
'posts_products',
|
||||
'newsletters'
|
||||
'newsletters',
|
||||
'benefits',
|
||||
'products_benefits',
|
||||
'offers',
|
||||
'offer_redemptions',
|
||||
'snippets'
|
||||
];
|
||||
|
||||
for (let call = 0; call < expectedCallCount; call++) {
|
||||
@ -86,7 +91,7 @@ describe('Exporter', function () {
|
||||
|
||||
exporter.doExport({include}).then(function (exportData) {
|
||||
// NOTE: 15 default tables + 2 includes
|
||||
const expectedCallCount = 17;
|
||||
const expectedCallCount = exporter.TABLES_ALLOWLIST.length + 2;
|
||||
|
||||
should.exist(exportData);
|
||||
|
||||
@ -114,7 +119,12 @@ describe('Exporter', function () {
|
||||
'stripe_products',
|
||||
'stripe_prices',
|
||||
'posts_products',
|
||||
'newsletters'
|
||||
'newsletters',
|
||||
'benefits',
|
||||
'products_benefits',
|
||||
'offers',
|
||||
'offer_redemptions',
|
||||
'snippets'
|
||||
].concat(include);
|
||||
|
||||
for (let call = 0; call < expectedCallCount; call++) {
|
||||
|
@ -141,17 +141,22 @@ const exportedBodyLatest = () => {
|
||||
version: '4.1.2'
|
||||
},
|
||||
data: {
|
||||
benefits: [],
|
||||
custom_theme_settings: [],
|
||||
newsletters: [],
|
||||
offers: [],
|
||||
offer_redemptions: [],
|
||||
posts: [],
|
||||
posts_authors: [],
|
||||
posts_meta: [],
|
||||
posts_products: [],
|
||||
posts_tags: [],
|
||||
products: [],
|
||||
products_benefits: [],
|
||||
roles: [],
|
||||
roles_users: [],
|
||||
settings: [],
|
||||
snippets: [],
|
||||
stripe_prices: [],
|
||||
stripe_products: [],
|
||||
tags: [],
|
||||
|
Loading…
Reference in New Issue
Block a user