feat: consolidate media service, add merchant users page, fix metrics overlap

- Merge ImageService into MediaService with WebP variant generation,
  DB-backed storage stats, and module-driven media usage discovery
  via new MediaUsageProviderProtocol
- Add merchant users admin page with scoped user listing, stats
  endpoint, template, JS, and i18n strings (de/en/fr/lb)
- Fix merchant user metrics so Owners and Team Members are mutually
  exclusive (filter team_members on user_type="member" and exclude
  owner IDs) ensuring stat cards add up correctly
- Update billing and monitoring services to use media_service
- Update subscription-billing and feature-gating docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-07 21:17:11 +01:00
parent 4cb2bda575
commit 2250054ba2
30 changed files with 1220 additions and 805 deletions

View File

@@ -122,6 +122,22 @@ class ContentServiceProtocol(Protocol):
...
@runtime_checkable
class MediaUsageProviderProtocol(Protocol):
"""Protocol for modules that track media file usage."""
def get_media_usage(self, db: "Session", media_id: int) -> list[dict]:
"""Return list of usage records.
Each dict should contain:
entity_type: str (e.g. "product")
entity_id: int
entity_name: str
usage_type: str (e.g. "main_image", "gallery")
"""
...
@runtime_checkable
class MediaServiceProtocol(Protocol):
"""