diff --git a/src/core/Article.ts b/src/core/Article.ts index bb39d87d..c951dbc6 100644 --- a/src/core/Article.ts +++ b/src/core/Article.ts @@ -124,7 +124,7 @@ async function processArticle(article) { if (previewId) { preview = await Image.findById(previewId) } else { - // preview = await resolveDefaultPreview() + preview = await resolveDefaultPreview() } return new Article({ diff --git a/src/core/Config.ts b/src/core/Config.ts index dd6ca3f0..db3188ff 100644 --- a/src/core/Config.ts +++ b/src/core/Config.ts @@ -1,18 +1,16 @@ import Data from './Data' import { findOne } from '../lib/store' -export default class Config { - static get store() { - return Data.getStore('Settings') - } +const store = () => Data.getStore('Settings') +export default class Config { static async findConfig() { const config = await Config.findById('settings') return config || new Config({} as any) } - static async findById(id) { - const data = await findOne(Config.store, { id }) + static async findById(id: string) { + const data = await findOne(store(), { id }) if (!data) return null return new Config(data) diff --git a/src/core/db.ts b/src/core/db.ts index 4d30ad8f..b3da9561 100644 --- a/src/core/db.ts +++ b/src/core/db.ts @@ -42,7 +42,7 @@ function init(db) { Data.setStore('Image', db.collection('images')) Data.setStore(Teacher, db.collection('collective')) Data.setStore(Document, db.collection('documents')) - Data.setStore(Settings, db.collection('settings')) + Data.setStore('Settings', db.collection('settings')) return db }