api Page update

This commit is contained in:
tmshv committed 2020-03-02 00:36:22 +03:00
1 parent af7f32b1c0
commit 68b7f4225d
3 files changed
+56 -21

No files matched your search

+5 -15
View File
@@ -1,6 +1,7 @@
import Data from './Data'
import { find as storeFind, findOne, total } from '../lib/store'
import Image from './Image'
import { Tag } from './Tag'
const store = () => Data.getStore('Page')
@@ -37,6 +38,8 @@ export default class Page {
public url: string
public content: any
public title: any
public date: Date
public tags: Tag[]
public data: any
public images: any
public documents: any
@@ -52,27 +55,14 @@ export default class Page {
this.content = data.content
this.title = data.title
this.data = data.data
this.date = data.date
this.images = data.images
this.documents = data.documents
this.preview = data.preview
this.tokens = data.tokens
this.tags = (data.tags || []).map(x => new Tag(x))
this.description = data.description
}
plain() {
return {
id: this.id,
images: this.images,
documents: this.documents,
data: this.data,
title: this.title,
content: this.content,
hash: this.hash,
file: this.file,
preview: this.preview,
url: this.url,
}
}
}
const previewFromImage = (imgs = []) => imgs.length