removes mongoose-hidden, updates globals accordingly

This commit is contained in:
James
2020-10-12 12:41:31 -04:00
parent 5aede8affb
commit 681bba82a9
6 changed files with 57 additions and 558 deletions

View File

@@ -1,5 +1,4 @@
const mongoose = require('mongoose');
const mongooseHidden = require('mongoose-hidden')();
const buildSchema = require('../mongoose/buildSchema');
const localizationPlugin = require('../localization/plugin');
@@ -11,8 +10,6 @@ const buildModel = (config) => {
globalsSchema.plugin(localizationPlugin, config.localization);
}
globalsSchema.plugin(mongooseHidden);
const Globals = mongoose.model('globals', globalsSchema);
Object.values(config.globals).forEach((globalConfig) => {
@@ -22,8 +19,6 @@ const buildModel = (config) => {
globalSchema.plugin(localizationPlugin, config.localization);
}
globalSchema.plugin(mongooseHidden);
Globals.discriminator(globalConfig.slug, globalSchema);
});

View File

@@ -30,6 +30,9 @@ async function findOne(args) {
if (!doc) {
doc = {};
} else if (doc._id) {
doc.id = doc._id;
delete doc._id;
}
// /////////////////////////////////////

View File

@@ -41,6 +41,10 @@ async function update(args) {
const globalJSON = global.toJSON({ virtuals: true });
if (globalJSON._id) {
delete globalJSON._id;
}
let { data } = args;
// /////////////////////////////////////

View File

@@ -107,7 +107,6 @@ module.exports = (config) => {
if (config.paths.scss) {
const overridePath = path.join(config.paths.configDir, config.paths.scss);
webpackConfig.resolve.alias['payload-scss-overrides'] = overridePath;
console.log(overridePath);
} else {
webpackConfig.resolve.alias['payload-scss-overrides'] = path.resolve(__dirname, '../admin/scss/overrides.scss');
}