mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-06 19:42:34 +08:00
Architecture changes: - API Routes -> manager.py (thin adapter) -> services/ (business logic) -> queries/ (atomic DB ops) - Services own session lifecycle via create_session() - Queries accept Session as parameter, do single-table atomic operations New app/assets/services/ layer: - __init__.py - exports all service functions - ingest.py - ingest_file_from_path(), register_existing_asset() - asset_management.py - get_asset_detail(), update_asset_metadata(), delete_asset_reference(), set_asset_preview() - tagging.py - apply_tags(), remove_tags(), list_tags() Removed from queries/asset_info.py: - ingest_fs_asset (moved to services/ingest.py as ingest_file_from_path) - update_asset_info_full (moved to services/asset_management.py as update_asset_metadata) - create_asset_info_for_existing_asset (moved to services/ingest.py as register_existing_asset) Updated manager.py: - Now a thin adapter that transforms API schemas to/from service calls - Delegates all business logic to services layer - No longer imports sqlalchemy.orm.Session or models directly Test updates: - Fixed test_cache_state.py import of pick_best_live_path (moved to helpers.py) - Added comprehensive service layer tests (41 new tests) - All 112 query + service tests pass Amp-Thread-ID: https://ampcode.com/threads/T-019c24e2-7ae4-707f-ad19-c775ed8b82b5 Co-authored-by: Amp <amp@ampcode.com>
35 lines
796 B
Python
35 lines
796 B
Python
# Asset services layer
|
|
# Business logic that orchestrates database queries and filesystem operations
|
|
# Services own session lifecycle via create_session()
|
|
|
|
from app.assets.services.ingest import (
|
|
ingest_file_from_path,
|
|
register_existing_asset,
|
|
)
|
|
from app.assets.services.asset_management import (
|
|
get_asset_detail,
|
|
update_asset_metadata,
|
|
delete_asset_reference,
|
|
set_asset_preview,
|
|
)
|
|
from app.assets.services.tagging import (
|
|
apply_tags,
|
|
remove_tags,
|
|
list_tags,
|
|
)
|
|
|
|
__all__ = [
|
|
# ingest.py
|
|
"ingest_file_from_path",
|
|
"register_existing_asset",
|
|
# asset_management.py
|
|
"get_asset_detail",
|
|
"update_asset_metadata",
|
|
"delete_asset_reference",
|
|
"set_asset_preview",
|
|
# tagging.py
|
|
"apply_tags",
|
|
"remove_tags",
|
|
"list_tags",
|
|
]
|