feat(tags): merge repoints allowlist, embedding, aliases, fandom children
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -368,18 +368,46 @@ class TagService:
|
||||
)
|
||||
|
||||
async def _repoint_allowlist(self, src: int, tgt: int) -> None:
|
||||
pass
|
||||
tgt_has = await self.session.scalar(
|
||||
select(exists().where(TagAllowlist.tag_id == tgt))
|
||||
)
|
||||
if tgt_has:
|
||||
await self.session.execute(
|
||||
text("DELETE FROM tag_allowlist WHERE tag_id = :src"),
|
||||
{"src": src},
|
||||
)
|
||||
else:
|
||||
await self.session.execute(
|
||||
update(TagAllowlist)
|
||||
.where(TagAllowlist.tag_id == src)
|
||||
.values(tag_id=tgt)
|
||||
)
|
||||
|
||||
async def _repoint_embedding(self, src: int) -> None:
|
||||
pass
|
||||
await self.session.execute(
|
||||
text(
|
||||
"DELETE FROM tag_reference_embedding WHERE tag_id = :src"
|
||||
),
|
||||
{"src": src},
|
||||
)
|
||||
|
||||
async def _repoint_aliases(self, src: int, tgt: int) -> None:
|
||||
pass
|
||||
from ..models.tag_alias import TagAlias
|
||||
|
||||
await self.session.execute(
|
||||
update(TagAlias)
|
||||
.where(TagAlias.canonical_tag_id == src)
|
||||
.values(canonical_tag_id=tgt)
|
||||
)
|
||||
|
||||
async def _repoint_fandom_children(
|
||||
self, src: int, tgt: int, src_kind: TagKind
|
||||
) -> None:
|
||||
pass
|
||||
if src_kind != TagKind.fandom:
|
||||
return
|
||||
await self.session.execute(
|
||||
update(Tag).where(Tag.fandom_id == src).values(fandom_id=tgt)
|
||||
)
|
||||
|
||||
async def _create_protective_aliases(
|
||||
self, src_name: str, src_kind: TagKind, tgt: int
|
||||
|
||||
Reference in New Issue
Block a user