tachybase_todo/packages/plugin-system-settings/src/server.ts
ChengLei Shao 8e4336cbe1
feat(server): improve application (#177)
* feat: getRepository

* getRepository return type

* export action

* refactor(plugin-acl): plugin

* refactor(plugin-action-logs): plugin class

* refactor(plugin-china-region): plugin class

* refactor: plugin class

* fix: cli start command

* feat: pass install-command options into app.install

* fix: cli args

Co-authored-by: chenos <chenlinxh@gmail.com>
2022-02-07 01:14:00 +08:00

28 lines
767 B
TypeScript

import path from 'path';
import { Plugin, PluginOptions } from '@nocobase/server';
export default class PluginSystemSettings extends Plugin {
async beforeLoad() {
this.app.on('installing', async () => {
await this.db.getRepository('system_settings').create({
values: {
title: 'NocoBase',
logo: {
title: 'nocobase-logo',
filename: '682e5ad037dd02a0fe4800a3e91c283b.png',
extname: '.png',
mimetype: 'image/png',
url: 'https://nocobase.oss-cn-beijing.aliyuncs.com/682e5ad037dd02a0fe4800a3e91c283b.png',
},
},
});
});
}
async load() {
await this.app.db.import({
directory: path.resolve(__dirname, 'collections'),
});
}
}