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

+9 -7
View File
@@ -67,10 +67,12 @@ def library_storage_key(
"""
Relativer Speicherpfad unter MEDIA_ROOT für lokale media_assets.
Layout (Mandantentrennung, globale Medien getrennt):
- private → library/private/{sha256}{ext}
- club → library/club/c{club_id}/{sha256}{ext}
Layout (nach Verein gegliedert, globale Medien getrennt):
- private → library/club/c{club_id}/private/{sha256}{ext}
- club (Vereinssichtbarkeit) → library/club/c{club_id}/shared/{sha256}{ext}
- official → library/official/{sha256}{ext}
club_id ist bei private/club zwingend (Vereinsordner); bei official nicht genutzt.
"""
vis = (visibility or "private").strip().lower()
if vis not in ("private", "club", "official"):
@@ -90,16 +92,16 @@ def library_storage_key(
raise ValueError("Ungültige Dateiendung")
blob = f"{sha}{e}"
if vis == "private":
return f"library/private/{blob}"
if vis == "official":
return f"library/official/{blob}"
if club_id is None:
raise ValueError("club_id ist für Sichtbarkeit „Verein“ erforderlich")
raise ValueError("Verein (club_id) ist für diese Sichtbarkeit auf der Platte erforderlich")
cid = int(club_id)
if cid < 1:
raise ValueError("club_id muss eine positive Ganzzahl sein")
return f"library/club/c{cid}/{blob}"
if vis == "private":
return f"library/club/c{cid}/private/{blob}"
return f"library/club/c{cid}/shared/{blob}"
def relocate_local_media_file(media_root: Path, old_storage_key: str, new_storage_key: str) -> None: