mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
parent
fb8eadb4a8
commit
df99e724e3
@ -3,6 +3,27 @@ const debug = require('ghost-ignition').debug('api:v2:utils:serializers:input:pa
|
||||
const converters = require('../../../../../lib/mobiledoc/converters');
|
||||
const url = require('./utils/url');
|
||||
const localUtils = require('../../index');
|
||||
const mongo = require('./utils/mongo');
|
||||
|
||||
/*
|
||||
* Replaces references of "page" in filters
|
||||
* with the correct column "type"
|
||||
*/
|
||||
function replacePageWithType(mongoJSON) {
|
||||
return mongo.mapKeysAndValues(mongoJSON, {
|
||||
key: {
|
||||
from: 'page',
|
||||
to: 'type'
|
||||
},
|
||||
values: [{
|
||||
from: false,
|
||||
to: 'post'
|
||||
}, {
|
||||
from: true,
|
||||
to: 'page'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
function removeMobiledocFormat(frame) {
|
||||
if (frame.options.formats && frame.options.formats.includes('mobiledoc')) {
|
||||
@ -86,6 +107,8 @@ module.exports = {
|
||||
defaultRelations(frame);
|
||||
}
|
||||
|
||||
frame.options.mongoTransformer = replacePageWithType;
|
||||
|
||||
debug(frame.options);
|
||||
},
|
||||
|
||||
|
@ -4,6 +4,27 @@ const url = require('./utils/url');
|
||||
const localUtils = require('../../index');
|
||||
const labs = require('../../../../../services/labs');
|
||||
const converters = require('../../../../../lib/mobiledoc/converters');
|
||||
const mongo = require('./utils/mongo');
|
||||
|
||||
/*
|
||||
* Replaces references of "page" in filters
|
||||
* with the correct column "type"
|
||||
*/
|
||||
function replacePageWithType(mongoJSON) {
|
||||
return mongo.mapKeysAndValues(mongoJSON, {
|
||||
key: {
|
||||
from: 'page',
|
||||
to: 'type'
|
||||
},
|
||||
values: [{
|
||||
from: false,
|
||||
to: 'post'
|
||||
}, {
|
||||
from: true,
|
||||
to: 'page'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
function removeMobiledocFormat(frame) {
|
||||
if (frame.options.formats && frame.options.formats.includes('mobiledoc')) {
|
||||
@ -108,6 +129,8 @@ module.exports = {
|
||||
defaultRelations(frame);
|
||||
}
|
||||
|
||||
frame.options.mongoTransformer = replacePageWithType;
|
||||
|
||||
debug(frame.options);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user