feat: themes foundation + editors load improvements

This commit is contained in:
Nicolas Giard
2018-08-09 00:07:15 -04:00
parent 5620419d05
commit 2f26d731fc
30 changed files with 396 additions and 298 deletions

View File

@@ -88,10 +88,12 @@ module.exports = class Page extends Model {
}
static async createPage(opts) {
await WIKI.models.pages.renderPage(opts)
const page = await WIKI.models.pages.query().insertAndFetch({
authorId: opts.authorId,
content: opts.content,
creatorId: opts.authorId,
contentType: _.get(WIKI.data.editors, `${opts.editor}.contentType`, 'text'),
description: opts.description,
editorKey: opts.editor,
isPrivate: opts.isPrivate,
@@ -130,4 +132,11 @@ module.exports = class Page extends Model {
})
return page
}
static async renderPage(opts) {
WIKI.queue.job.renderPage.add(opts, {
removeOnComplete: true,
removeOnFail: true
})
}
}