12345678910111213141516171819202122232425262728 |
- 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)
- }
- }
|