Files
yunke/yunke-server/app/storage/__init__.py
T

35 lines
1.1 KiB
Python
Raw Normal View History

"""Storage layer for the yunke data-mirror system.
Bridges the scrapers (``app.scraper.*``, which yield normalized dicts) to the
database (``app.db.models.*``) and the local media store.
Public surface (M1 / Task 1.7):
* :mod:`app.storage.repos` — idempotent Core upsert helpers that take an
``AsyncSession`` plus scraper-shaped dicts and write to the target table.
The upsert is dialect-aware (SQLite for tests, MySQL for prod) so the same
call path works in both environments.
* :mod:`app.storage.object_store` — a local-filesystem object store with
sha256-content-addressed dedup. The interface (``put_bytes`` / ``put_stream``
/ ``put_by_hash`` / ``exists`` / ``get_path``) is the seam a future MinIO/S3
backend will swap in behind.
"""
from app.storage.object_store import ObjectStore
from app.storage.repos import (
upsert_customer,
upsert_customers,
upsert_messages,
upsert_staff_from_account,
upsert_wechat_account,
)
__all__ = [
"ObjectStore",
"upsert_customer",
"upsert_customers",
"upsert_messages",
"upsert_staff_from_account",
"upsert_wechat_account",
]