refactor: eliminate manager layer, routes call services directly

- Delete app/assets/manager.py
- Move upload logic (upload_from_temp_path, create_from_hash) to ingest service
- Add HashMismatchError and DependencyMissingError to ingest service
- Add UploadResult schema for upload responses
- Update routes.py to import services directly and do schema conversion inline
- Add asset lookup/listing service functions to asset_management.py

Routes now call the service layer directly, removing an unnecessary
layer of indirection. The manager was only converting between service
dataclasses and Pydantic response schemas.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Luke Mino-Altherr
2026-02-04 14:50:11 -08:00
parent 2da3a09221
commit 7fc59a9c53
6 changed files with 528 additions and 569 deletions

View File

@@ -1,23 +1,36 @@
from app.assets.services.asset_management import (
asset_exists,
delete_asset_reference,
get_asset_by_hash,
get_asset_detail,
get_asset_info_with_tags,
list_assets_page,
resolve_asset_for_download,
set_asset_preview,
update_asset_metadata,
)
from app.assets.services.ingest import (
DependencyMissingError,
HashMismatchError,
create_from_hash,
ingest_file_from_path,
register_existing_asset,
upload_from_temp_path,
)
from app.assets.services.schemas import (
AddTagsResult,
AssetData,
AssetDetailResult,
AssetInfoData,
AssetSummaryData,
DownloadResolutionResult,
IngestResult,
ListAssetsResult,
RegisterAssetResult,
RemoveTagsResult,
SetTagsResult,
TagUsage,
UploadResult,
UserMetadata,
)
from app.assets.services.tagging import (
@@ -29,7 +42,16 @@ from app.assets.services.tagging import (
__all__ = [
"ingest_file_from_path",
"register_existing_asset",
"upload_from_temp_path",
"create_from_hash",
"HashMismatchError",
"DependencyMissingError",
"asset_exists",
"get_asset_by_hash",
"get_asset_detail",
"get_asset_info_with_tags",
"list_assets_page",
"resolve_asset_for_download",
"update_asset_metadata",
"delete_asset_reference",
"set_asset_preview",
@@ -40,10 +62,14 @@ __all__ = [
"AssetData",
"AssetDetailResult",
"AssetInfoData",
"AssetSummaryData",
"DownloadResolutionResult",
"IngestResult",
"ListAssetsResult",
"RegisterAssetResult",
"RemoveTagsResult",
"SetTagsResult",
"TagUsage",
"UploadResult",
"UserMetadata",
]