feat: 4 new analytics modules

This commit is contained in:
Nick
2019-06-29 16:45:27 -04:00
parent 2890d9ccf0
commit 9cd8657ce6
10 changed files with 138 additions and 0 deletions

View File

@@ -177,6 +177,11 @@ module.exports = class Page extends Model {
}
static async createPage(opts) {
const dupCheck = await WIKI.models.pages.query().select('id').where('localeCode', opts.locale).where('path', opts.path).first()
if (dupCheck) {
throw new WIKI.Error.PageDuplicateCreate()
}
await WIKI.models.pages.query().insert({
authorId: opts.authorId,
content: opts.content,