From 0b795dc7a70104bd301730ed4c0bfb23a0ee02a4 Mon Sep 17 00:00:00 2001 From: bigcat88 Date: Sun, 14 Sep 2025 15:14:24 +0300 Subject: [PATCH] removed non-needed code --- app/database/helpers/__init__.py | 4 ---- app/database/helpers/tags.py | 25 +------------------------ 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/app/database/helpers/__init__.py b/app/database/helpers/__init__.py index 19d7507fa..310583607 100644 --- a/app/database/helpers/__init__.py +++ b/app/database/helpers/__init__.py @@ -2,10 +2,8 @@ from .filters import apply_metadata_filter, apply_tag_filters from .ownership import visible_owner_clause from .projection import is_scalar, project_kv from .tags import ( - add_missing_tag_for_asset_hash, add_missing_tag_for_asset_id, ensure_tags_exist, - remove_missing_tag_for_asset_hash, remove_missing_tag_for_asset_id, ) @@ -16,8 +14,6 @@ __all__ = [ "project_kv", "ensure_tags_exist", "add_missing_tag_for_asset_id", - "add_missing_tag_for_asset_hash", "remove_missing_tag_for_asset_id", - "remove_missing_tag_for_asset_hash", "visible_owner_clause", ] diff --git a/app/database/helpers/tags.py b/app/database/helpers/tags.py index c8f9e5074..b3e006c0e 100644 --- a/app/database/helpers/tags.py +++ b/app/database/helpers/tags.py @@ -6,7 +6,7 @@ from sqlalchemy.dialects import sqlite as d_sqlite from sqlalchemy.ext.asyncio import AsyncSession from ..._assets_helpers import normalize_tags -from ..models import Asset, AssetInfo, AssetInfoTag, Tag +from ..models import AssetInfo, AssetInfoTag, Tag from ..timeutil import utcnow @@ -77,18 +77,6 @@ async def add_missing_tag_for_asset_id( return len(to_add) -async def add_missing_tag_for_asset_hash( - session: AsyncSession, - *, - asset_hash: str, - origin: str = "automatic", -) -> int: - asset = (await session.execute(select(Asset).where(Asset.hash == asset_hash).limit(1))).scalars().first() - if not asset: - return 0 - return await add_missing_tag_for_asset_id(session, asset_id=asset.id, origin=origin) - - async def remove_missing_tag_for_asset_id( session: AsyncSession, *, @@ -107,14 +95,3 @@ async def remove_missing_tag_for_asset_id( ) await session.flush() return int(res.rowcount or 0) - - -async def remove_missing_tag_for_asset_hash( - session: AsyncSession, - *, - asset_hash: str, -) -> int: - asset = (await session.execute(select(Asset).where(Asset.hash == asset_hash).limit(1))).scalars().first() - if not asset: - return 0 - return await remove_missing_tag_for_asset_id(session, asset_id=asset.id)