fix(plugin-workflow): generate workflow key (#6567)

This commit is contained in:
Junyi 2025-03-26 21:40:23 +08:00 committed by GitHub
parent 0349edb42c
commit ec9dbe865a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,7 +15,7 @@ import LRUCache from 'lru-cache';
import { Op } from '@nocobase/database';
import { Plugin } from '@nocobase/server';
import { Registry } from '@nocobase/utils';
import { Registry, uid } from '@nocobase/utils';
import { SequelizeCollectionManager } from '@nocobase/data-source-manager';
import { Logger, LoggerOptions } from '@nocobase/logger';
@ -75,6 +75,10 @@ export default class PluginWorkflowServer extends Plugin {
private onBeforeSave = async (instance: WorkflowModel, { transaction }) => {
const Model = <typeof WorkflowModel>instance.constructor;
if (!instance.key) {
instance.set('key', uid());
}
if (instance.enabled) {
instance.set('current', true);
}