21 lines
549 B
TypeScript
21 lines
549 B
TypeScript
import { Plugin } from '@tachybase/server';
|
|
|
|
export class PluginTodoPageServer extends Plugin {
|
|
async load() {
|
|
// 定义一个 todo 数据表,包含 title 和 completed 字段
|
|
this.app.db.collection({
|
|
name: 'todo',
|
|
fields: [
|
|
{ type: 'string', name: 'title' },
|
|
{ type: 'boolean', name: 'completed', default: false },
|
|
],
|
|
});
|
|
await this.app.db.sync();
|
|
|
|
// 设置 todos 数据表的访问权限为公开
|
|
this.app.acl.allow('todo', '*', 'public');
|
|
}
|
|
}
|
|
|
|
export default PluginTodoPageServer;
|