fix(core): Fix workflow tagging failure due to unique constraint check (#8505)

This commit is contained in:
Iván Ovejero
2024-02-02 12:36:55 +01:00
committed by GitHub
parent cccdfc73d6
commit 92f939f827
3 changed files with 101 additions and 4 deletions

View File

@@ -7,4 +7,14 @@ export class WorkflowTagMappingRepository extends Repository<WorkflowTagMapping>
constructor(dataSource: DataSource) {
super(WorkflowTagMapping, dataSource.manager);
}
async overwriteTaggings(workflowId: string, tagIds: string[]) {
return await this.manager.transaction(async () => {
await this.delete({ workflowId });
const taggings = tagIds.map((tagId) => this.create({ workflowId, tagId }));
return await this.insert(taggings);
});
}
}