fix(core): Fix workflow activation with history and workflow history for EE (no-changelog) (#7508)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
@@ -6,6 +6,7 @@ import { SharedWorkflowRepository } from '@/databases/repositories';
|
||||
import { WorkflowHistoryRepository } from '@db/repositories/workflowHistory.repository';
|
||||
import { Service } from 'typedi';
|
||||
import { isWorkflowHistoryEnabled } from './workflowHistoryHelper.ee';
|
||||
import { getLogger } from '@/Logger';
|
||||
|
||||
export class SharedWorkflowNotFoundError extends Error {}
|
||||
export class HistoryVersionNotFoundError extends Error {}
|
||||
@@ -66,13 +67,20 @@ export class WorkflowHistoryService {
|
||||
|
||||
async saveVersion(user: User, workflow: WorkflowEntity, workflowId: string) {
|
||||
if (isWorkflowHistoryEnabled()) {
|
||||
await this.workflowHistoryRepository.insert({
|
||||
authors: user.firstName + ' ' + user.lastName,
|
||||
connections: workflow.connections,
|
||||
nodes: workflow.nodes,
|
||||
versionId: workflow.versionId,
|
||||
workflowId,
|
||||
});
|
||||
try {
|
||||
await this.workflowHistoryRepository.insert({
|
||||
authors: user.firstName + ' ' + user.lastName,
|
||||
connections: workflow.connections,
|
||||
nodes: workflow.nodes,
|
||||
versionId: workflow.versionId,
|
||||
workflowId,
|
||||
});
|
||||
} catch (e) {
|
||||
getLogger().error(
|
||||
`Failed to save workflow history version for workflow ${workflowId}`,
|
||||
e as Error,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user