make Config working right. Article model looks restored
This commit is contained in:
1 parent
d4f6568269
commit
f72652440e
3 files changed
+6
-8
No files matched your search
+1
-1
@@ -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({
|
||||
|
||||
+4
-6
@@ -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)
|
||||
|
||||
+1
-1
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user