tachybase_todo/packages/samples/shop-modeling/src/server/index.ts

34 lines
637 B
TypeScript
Raw Normal View History

import path from 'path';
import { InstallOptions, Plugin } from '@nocobase/server';
import SnowflakeField from './fields/SnowflakeField';
export class ShopPlugin extends Plugin {
afterAdd() {
this.db.registerFieldTypes({
2023-01-03 15:17:20 +08:00
snowflake: SnowflakeField,
});
}
beforeLoad() {
// TODO
}
async load() {
await this.db.import({
directory: path.resolve(__dirname, 'collections'),
});
this.app.acl.allow('products', '*');
this.app.acl.allow('categories', '*');
this.app.acl.allow('orders', '*');
}
async install(options: InstallOptions) {
// TODO
}
}
export default ShopPlugin;