fix(server): tag upsert (#12141)

This commit is contained in:
Jason Rasmussen
2024-08-30 12:44:24 -04:00
committed by GitHub
parent b9e5e40ced
commit 9b1a985d29
14 changed files with 163 additions and 41 deletions

View File

@@ -13,12 +13,7 @@ export const upsertTags = async (repository: ITagRepository, { userId, tags }: U
for (const part of parts) {
const value = parent ? `${parent.value}/${part}` : part;
let tag = await repository.getByValue(userId, value);
if (!tag) {
tag = await repository.create({ userId, value, parent });
}
parent = tag;
parent = await repository.upsertValue({ userId, value, parent });
}
if (parent) {