insert labels on name conflict do nothing

This commit is contained in:
Hongbo Wu 2023-12-29 16:11:11 +08:00
parent 943db3332e
commit 6e32c1247d

View file

@ -73,13 +73,12 @@ export const labelRepository = appDataSource.getRepository(Label).extend({
},
createLabels(labels: CreateLabelInput[], userId: string) {
return this.upsert(
labels.map((l) => convertToLabel(l, userId)),
{
conflictPaths: ['name', 'user'],
skipUpdateIfNoValuesChanged: true,
}
)
return this.createQueryBuilder()
.insert()
.into(Label)
.values(labels.map((l) => convertToLabel(l, userId)))
.orIgnore()
.execute()
},
deleteById(id: string) {