mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
fix: Fix problem saving workflow when tags disabled (#3792)
* ⚡ Add @AfterLoad nullCheck for WorkflowEntity tags * ⚡ Make tags optional in Entity * Fix workflows api typing issue Co-authored-by: Omar Ajoue <krynble@gmail.com>
This commit is contained in:
parent
2cab8e7779
commit
f0dddaa2a5
|
@ -144,7 +144,7 @@ export interface IWorkflowBase extends IWorkflowBaseWorkflow {
|
|||
// Almost identical to editor-ui.Interfaces.ts
|
||||
export interface IWorkflowDb extends IWorkflowBase {
|
||||
id: number | string;
|
||||
tags: ITagDb[];
|
||||
tags?: ITagDb[];
|
||||
}
|
||||
|
||||
export interface IWorkflowToImport extends IWorkflowBase {
|
||||
|
|
|
@ -993,7 +993,7 @@ class App {
|
|||
);
|
||||
}
|
||||
|
||||
if (updatedWorkflow.tags.length && tags?.length) {
|
||||
if (updatedWorkflow.tags?.length && tags?.length) {
|
||||
updatedWorkflow.tags = TagHelpers.sortByRequestOrder(updatedWorkflow.tags, {
|
||||
requestOrder: tags,
|
||||
});
|
||||
|
|
|
@ -69,7 +69,7 @@ workflowsController.post(
|
|||
throw new ResponseHelper.ResponseError('Failed to save workflow');
|
||||
}
|
||||
|
||||
if (tagIds && !config.getEnv('workflowTagsDisabled')) {
|
||||
if (tagIds && !config.getEnv('workflowTagsDisabled') && savedWorkflow.tags) {
|
||||
savedWorkflow.tags = TagHelpers.sortByRequestOrder(savedWorkflow.tags, {
|
||||
requestOrder: tagIds,
|
||||
});
|
||||
|
|
|
@ -112,7 +112,7 @@ export class WorkflowEntity implements IWorkflowDb {
|
|||
referencedColumnName: 'id',
|
||||
},
|
||||
})
|
||||
tags: TagEntity[];
|
||||
tags?: TagEntity[];
|
||||
|
||||
@OneToMany(() => SharedWorkflow, (sharedWorkflow) => sharedWorkflow.workflow)
|
||||
shared: SharedWorkflow[];
|
||||
|
|
Loading…
Reference in a new issue