  1. 可能有一些遗留问题, 比如工作流状态同步显示的问题, 以及后续需要配置. 2. 目前没有时间仔细核对, 需要先做其他事情 Reviewed-on: daoyoucloud/tachybase#1037 Co-authored-by: bai.zixv <bai.zixv@foxmail.com> Co-committed-by: bai.zixv <bai.zixv@foxmail.com>
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import WorkflowPlugin from '@tachybase/plugin-workflow';
|
|
import { Plugin } from '@tachybase/server';
|
|
import path from 'path';
|
|
import { NOTICE_INSTRUCTION_NAMESPACE } from '../common/constants';
|
|
import NoticeInstruction from './NoticeInstruction';
|
|
import { init } from './actions';
|
|
import { COLLECTION_WORKFLOWS_NAME } from './collections/workflowNotice';
|
|
import { COLLECTION_NOTICE_NAME } from '../common/constants';
|
|
|
|
export class PluginWorkflowNoticeServer extends Plugin {
|
|
workflow;
|
|
async afterAdd() {}
|
|
|
|
async beforeLoad() {
|
|
this.app.on('afterLoadPlugin', (plugin) => {
|
|
if (!(plugin instanceof WorkflowPlugin)) {
|
|
return;
|
|
}
|
|
this.workflow = plugin;
|
|
plugin.instructions.register(NOTICE_INSTRUCTION_NAMESPACE, new NoticeInstruction(plugin));
|
|
});
|
|
}
|
|
|
|
async load() {
|
|
const { db } = this;
|
|
db.addMigrations({
|
|
namespace: NOTICE_INSTRUCTION_NAMESPACE,
|
|
directory: path.resolve(__dirname, 'migrations'),
|
|
context: {
|
|
plugin: this,
|
|
},
|
|
});
|
|
await db.import({
|
|
directory: path.resolve(__dirname, 'collections'),
|
|
});
|
|
|
|
init(this);
|
|
|
|
this.app.acl.allow(COLLECTION_WORKFLOWS_NAME, ['listWorkflowNoticeFlows'], 'loggedIn');
|
|
this.app.acl.allow(COLLECTION_NOTICE_NAME, ['get', 'list', 'listCentralized', 'submit'], 'loggedIn');
|
|
}
|
|
|
|
async install() {}
|
|
async afterEnable() {}
|
|
async afterDisable() {}
|
|
async remove() {}
|
|
}
|
|
|
|
export default PluginWorkflowNoticeServer;
|