mirror of https://github.com/requarks/wiki
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
555 B
29 lines
555 B
import { Model } from 'objection'
|
|
|
|
/**
|
|
* Block model
|
|
*/
|
|
export class Block extends Model {
|
|
static get tableName () { return 'blocks' }
|
|
|
|
static get jsonAttributes () {
|
|
return ['config']
|
|
}
|
|
|
|
static async addBlock (data) {
|
|
return WIKI.db.blocks.query().insertAndFetch({
|
|
block: data.block,
|
|
name: data.name,
|
|
description: data.description,
|
|
icon: data.icon,
|
|
isEnabled: true,
|
|
isCustom: true,
|
|
config: {}
|
|
})
|
|
}
|
|
|
|
static async deleteBlock (id) {
|
|
return WIKI.db.blocks.query().deleteById(id)
|
|
}
|
|
}
|