documents page fixed
This commit is contained in:
1 parent
eed3a3c007
commit
ed9dae3760
13 files changed
+156
-105
No files matched your search
@@ -1,12 +1,12 @@
|
||||
const Data = require('./Data')
|
||||
const Image = require('./Image')
|
||||
const { find, findOne } = require('../lib/store')
|
||||
import Data from './Data'
|
||||
import Image from './Image'
|
||||
import { find, findOne } from '../lib/store'
|
||||
|
||||
const store = () => Data.getStore(Document)
|
||||
const store = () => Data.getStore('Document')
|
||||
|
||||
class Document {
|
||||
export default class Document {
|
||||
static async find(query, options = {}) {
|
||||
const items = await find(store(), query, options)
|
||||
const items = await find(store(), query, options as any)
|
||||
|
||||
return Promise.all(items.map(processDocument))
|
||||
}
|
||||
@@ -18,6 +18,17 @@ class Document {
|
||||
return processDocument(data)
|
||||
}
|
||||
|
||||
public id: any
|
||||
public hash: any
|
||||
public file: any
|
||||
public fileInfo: any
|
||||
public type: any
|
||||
public title: any
|
||||
public category: any
|
||||
public url: any
|
||||
public preview: any
|
||||
public viewUrl: any
|
||||
|
||||
constructor(data) {
|
||||
this.id = data.id
|
||||
this.hash = data.hash
|
||||
@@ -37,6 +48,9 @@ class Document {
|
||||
}
|
||||
|
||||
class DocumentFile {
|
||||
public name: any
|
||||
public size: any
|
||||
|
||||
constructor(data) {
|
||||
this.name = data.name
|
||||
this.size = data.size
|
||||
@@ -52,5 +66,3 @@ const processDocument = async data => {
|
||||
preview,
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = Document
|
||||
+1
-1
@@ -41,7 +41,7 @@ function init(db) {
|
||||
Data.setStore('Album', db.collection('albums'))
|
||||
Data.setStore('Image', db.collection('images'))
|
||||
Data.setStore('Teacher', db.collection('collective'))
|
||||
Data.setStore(Document, db.collection('documents'))
|
||||
Data.setStore('Document', db.collection('documents'))
|
||||
Data.setStore('Settings', db.collection('settings'))
|
||||
|
||||
return db
|
||||
|
||||
Reference in new issue
Block a user