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) {
|
if (previewId) {
|
||||||
preview = await Image.findById(previewId)
|
preview = await Image.findById(previewId)
|
||||||
} else {
|
} else {
|
||||||
// preview = await resolveDefaultPreview()
|
preview = await resolveDefaultPreview()
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Article({
|
return new Article({
|
||||||
|
|||||||
+4
-6
@@ -1,18 +1,16 @@
|
|||||||
import Data from './Data'
|
import Data from './Data'
|
||||||
import { findOne } from '../lib/store'
|
import { findOne } from '../lib/store'
|
||||||
|
|
||||||
export default class Config {
|
const store = () => Data.getStore('Settings')
|
||||||
static get store() {
|
|
||||||
return Data.getStore('Settings')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class Config {
|
||||||
static async findConfig() {
|
static async findConfig() {
|
||||||
const config = await Config.findById('settings')
|
const config = await Config.findById('settings')
|
||||||
return config || new Config({} as any)
|
return config || new Config({} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
static async findById(id) {
|
static async findById(id: string) {
|
||||||
const data = await findOne(Config.store, { id })
|
const data = await findOne(store(), { id })
|
||||||
if (!data) return null
|
if (!data) return null
|
||||||
|
|
||||||
return new Config(data)
|
return new Config(data)
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@ function init(db) {
|
|||||||
Data.setStore('Image', db.collection('images'))
|
Data.setStore('Image', db.collection('images'))
|
||||||
Data.setStore(Teacher, db.collection('collective'))
|
Data.setStore(Teacher, db.collection('collective'))
|
||||||
Data.setStore(Document, db.collection('documents'))
|
Data.setStore(Document, db.collection('documents'))
|
||||||
Data.setStore(Settings, db.collection('settings'))
|
Data.setStore('Settings', db.collection('settings'))
|
||||||
|
|
||||||
return db
|
return db
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user