fix(media): Vereinsordner für private/shared; kein library/private mehr
Deploy Development / deploy (push) Successful in 34s
Test Suite / pytest-backend (push) Successful in 25s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 8s
Test Suite / playwright-tests (push) Successful in 23s

- library/club/c{id}/private/* und …/shared/* (club visibility)
- Private Archiv-Upload: effective_club_id oder club_id Form; Plattform braucht Header
- media_assets.club_id bei private gesetzt; Dedupe pro Verein
- Übungs-Upload: dedupe_club für private aus exercise.club_id oder Mandant
- PATCH: club_id für private erhalten; Relocate inkl. private
- version 0.8.53

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-05-08 09:58:28 +02:00
1 parent 4fb77d6927
commit 3f0d02edab
6 files changed
+111 -37

No files matched your search

+16 -11
View File
@@ -8,24 +8,29 @@ from media_storage import library_storage_key
_HEX64 = "a" * 64
def test_library_storage_key_private() -> None:
assert library_storage_key("private", None, _HEX64, ".jpg") == f"library/private/{_HEX64}.jpg"
def test_library_storage_key_private_under_club() -> None:
assert library_storage_key("private", 7, _HEX64, ".jpg") == f"library/club/c7/private/{_HEX64}.jpg"
def test_library_storage_key_shared_under_club() -> None:
assert library_storage_key("club", 42, _HEX64, ".png") == f"library/club/c42/shared/{_HEX64}.png"
def test_library_storage_key_official() -> None:
assert library_storage_key("official", None, _HEX64, ".mp4") == f"library/official/{_HEX64}.mp4"
def test_library_storage_key_club() -> None:
assert library_storage_key("club", 42, _HEX64, ".png") == f"library/club/c42/{_HEX64}.png"
def test_library_storage_key_normalizes_visibility() -> None:
assert library_storage_key(" CLUB ", 1, _HEX64, "pdf") == f"library/club/c1/{_HEX64}.pdf"
assert library_storage_key(" CLUB ", 1, _HEX64, "pdf") == f"library/club/c1/shared/{_HEX64}.pdf"
def test_library_storage_key_private_requires_club() -> None:
with pytest.raises(ValueError, match="Verein"):
library_storage_key("private", None, _HEX64, ".jpg")
def test_library_storage_key_club_requires_id() -> None:
with pytest.raises(ValueError, match="club_id"):
with pytest.raises(ValueError, match="Verein"):
library_storage_key("club", None, _HEX64, ".jpg")
@@ -36,14 +41,14 @@ def test_library_storage_key_club_id_positive() -> None:
def test_library_storage_key_invalid_visibility() -> None:
with pytest.raises(ValueError, match="Sichtbarkeit"):
library_storage_key("public", None, _HEX64, ".jpg")
library_storage_key("public", 1, _HEX64, ".jpg")
def test_library_storage_key_invalid_sha() -> None:
with pytest.raises(ValueError, match="64"):
library_storage_key("private", None, "deadbeef", ".jpg")
library_storage_key("private", 1, "deadbeef", ".jpg")
def test_library_storage_key_extension_sanitized() -> None:
with pytest.raises(ValueError):
library_storage_key("private", None, _HEX64, "../x")
library_storage_key("private", 1, _HEX64, "../x")
+2 -2
View File
@@ -18,7 +18,7 @@ from tenant_context import TenantContext, get_tenant_context
# Gültige storage_key-Beispiele (64 Hex-Zeichen wie echter SHA-256)
_SK_OFF_A = f"library/official/{'a' * 64}.jpg"
_SK_OFF_B = f"library/official/{'b' * 64}.jpg"
_SK_PRIV_C = f"library/private/{'c' * 64}.mp4"
_SK_PRIV_C = f"library/club/c1/private/{'c' * 64}.mp4"
@pytest.fixture
@@ -331,7 +331,7 @@ def test_media_asset_lifecycle_reactivate_mocked(client: TestClient) -> None:
{
"id": 5,
"visibility": "private",
"club_id": None,
"club_id": 1,
"uploaded_by_profile_id": 1,
"lifecycle_state": "trash_soft",
"storage_key": _SK_PRIV_C,