core Data typings
This commit is contained in:
1 parent
bf1fd90133
commit
717540682d
2 files changed
+9
-8
No files matched your search
+8
-7
@@ -1,17 +1,18 @@
|
||||
const db = require('./db')
|
||||
import { Collection } from 'mongodb'
|
||||
import * as db from './db'
|
||||
|
||||
const store = new Map()
|
||||
const store = new Map<string, Collection>()
|
||||
|
||||
export default class Data {
|
||||
static setStore(Class, collection) {
|
||||
store.set(Class, collection)
|
||||
static setStore(key: string, collection: Collection) {
|
||||
store.set(key, collection)
|
||||
}
|
||||
|
||||
static getStore(Class) {
|
||||
return store.get(Class)
|
||||
static getStore(key: string): Collection {
|
||||
return store.get(key)
|
||||
}
|
||||
|
||||
static getCollection(name) {
|
||||
static getCollection(name: string): Collection {
|
||||
return db.collection(name)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { find as storeFind, findOne, total } from '../lib/store'
|
||||
const Image = require('./Image')
|
||||
const Config = require('./Config')
|
||||
|
||||
const store = () => Data.getStore(Page)
|
||||
const store = () => Data.getStore('Page')
|
||||
|
||||
export default class Page {
|
||||
static async find(query, options = {}): Promise<Page[]> {
|
||||
|
||||
Reference in new issue
Block a user