Remove all saves from workflows (#14283)

- replace save by insert
- if the insert output is needed, cast the generatedMaps
- remove transactions from trigger services. Doing it manually would be
complex and not reliable
This commit is contained in:
Thomas Trompette
2025-09-03 15:41:03 +02:00
committed by GitHub
parent 6ee41f33c6
commit 7ac7f52510
8 changed files with 55 additions and 149 deletions
@@ -47,18 +47,16 @@ export class WorkflowCreateManyPostQueryHook
workspaceId: workspace.id,
});
const workflowVersionsToCreate = payload.map((workflow) => {
return workflowVersionRepository.create({
workflowId: workflow.id,
status: WorkflowVersionStatus.DRAFT,
name: 'v1',
position,
});
});
const workflowVersionsToCreate = payload.map((workflow) => ({
workflowId: workflow.id,
status: WorkflowVersionStatus.DRAFT,
name: 'v1',
position,
}));
await Promise.all(
workflowVersionsToCreate.map((workflowVersion) => {
return workflowVersionRepository.save(workflowVersion);
return workflowVersionRepository.insert(workflowVersion);
}),
);
}
@@ -49,13 +49,11 @@ export class WorkflowCreateOnePostQueryHook
workspaceId: workspace.id,
});
const workflowVersionToCreate = workflowVersionRepository.create({
await workflowVersionRepository.insert({
workflowId: workflow.id,
status: WorkflowVersionStatus.DRAFT,
name: 'v1',
position,
});
await workflowVersionRepository.save(workflowVersionToCreate);
}
}