fix: handle workflow generation in loadFixtures for templates
- Fixed loadFixtures to properly generate workflow object from template nodes - Ensured workflow_json is never NULL when saving templates from fixtures - Maintains compatibility with both TemplateWorkflow and TemplateDetail formats This resolves the database constraint error in fixture loading tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -414,7 +414,17 @@ export async function loadFixtures(
|
|||||||
description: template.description,
|
description: template.description,
|
||||||
views: template.views || template.totalViews || 0,
|
views: template.views || template.totalViews || 0,
|
||||||
createdAt: template.createdAt,
|
createdAt: template.createdAt,
|
||||||
workflow: template.workflow
|
workflow: template.workflow || {
|
||||||
|
nodes: template.nodes?.map((n: any, i: number) => ({
|
||||||
|
id: `node_${i}`,
|
||||||
|
name: n.name,
|
||||||
|
type: `n8n-nodes-base.${n.name.toLowerCase()}`,
|
||||||
|
position: [250 + i * 200, 300],
|
||||||
|
parameters: {}
|
||||||
|
})) || [],
|
||||||
|
connections: {},
|
||||||
|
settings: {}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
await templateRepo.saveTemplate(template, detail);
|
await templateRepo.saveTemplate(template, detail);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user