fix(core): Use trx manager instead of repository for tags overwrite (#8557)

This commit is contained in:
Iván Ovejero 2024-02-06 10:40:32 +01:00 committed by GitHub
parent c4e39451db
commit abddbb6227
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,12 +9,12 @@ export class WorkflowTagMappingRepository extends Repository<WorkflowTagMapping>
} }
async overwriteTaggings(workflowId: string, tagIds: string[]) { async overwriteTaggings(workflowId: string, tagIds: string[]) {
return await this.manager.transaction(async () => { return await this.manager.transaction(async (tx) => {
await this.delete({ workflowId }); await tx.delete(WorkflowTagMapping, { workflowId });
const taggings = tagIds.map((tagId) => this.create({ workflowId, tagId })); const taggings = tagIds.map((tagId) => this.create({ workflowId, tagId }));
return await this.insert(taggings); return await tx.insert(WorkflowTagMapping, taggings);
}); });
} }
} }