Fix not being able to remove all owners of badges

This commit is contained in:
Kalle
2023-11-05 19:22:24 +02:00
parent a2644afeb9
commit 9006d92819

View File

@@ -119,14 +119,16 @@ export function replaceOwners({
.where("badgeId", "=", badgeId)
.execute();
await trx
.insertInto("TournamentBadgeOwner")
.values(
ownerIds.map((userId) => ({
badgeId,
userId,
})),
)
.execute();
if (ownerIds.length > 0) {
await trx
.insertInto("TournamentBadgeOwner")
.values(
ownerIds.map((userId) => ({
badgeId,
userId,
})),
)
.execute();
}
});
}