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
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:
1 parent
4fb77d6927
commit
3f0d02edab
6 files changed
+111
-37
No files matched your search
@@ -2397,12 +2397,30 @@ async def upload_exercise_media(
|
||||
media_root = get_effective_media_root(cur)
|
||||
full_sha = hashlib.sha256(raw).hexdigest()
|
||||
|
||||
if ex_vis == "official":
|
||||
dedupe_club: Optional[int] = None
|
||||
elif ex_vis == "private":
|
||||
dedupe_club = int(ex_club) if ex_club is not None else tenant.effective_club_id
|
||||
if dedupe_club is None:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail=(
|
||||
"Private Übungsmedien werden pro Verein gespeichert. Bitte der Übung einen Verein zuordnen "
|
||||
"oder einen aktiven Verein wählen (X-Active-Club-Id)."
|
||||
),
|
||||
)
|
||||
dedupe_club = int(dedupe_club)
|
||||
else:
|
||||
if ex_club is None:
|
||||
raise HTTPException(status_code=400, detail="Vereinsübung ohne club_id")
|
||||
dedupe_club = int(ex_club)
|
||||
|
||||
cur.execute(
|
||||
"""SELECT id, storage_key, byte_size, lifecycle_state, original_filename FROM media_assets
|
||||
WHERE sha256 = %s AND lower(trim(visibility)) = %s
|
||||
AND (club_id IS NOT DISTINCT FROM %s)
|
||||
LIMIT 1""",
|
||||
(full_sha, ex_vis, ex_club),
|
||||
(full_sha, ex_vis, dedupe_club),
|
||||
)
|
||||
existing_asset = cur.fetchone()
|
||||
|
||||
@@ -2491,7 +2509,7 @@ async def upload_exercise_media(
|
||||
)
|
||||
else:
|
||||
try:
|
||||
storage_key = library_storage_key(ex_vis, ex_club, full_sha, ext)
|
||||
storage_key = library_storage_key(ex_vis, dedupe_club if ex_vis != "official" else None, full_sha, ext)
|
||||
except ValueError as e:
|
||||
raise HTTPException(status_code=400, detail=str(e)) from e
|
||||
dest_path = path_under_media_root(media_root, storage_key)
|
||||
@@ -2513,7 +2531,7 @@ async def upload_exercise_media(
|
||||
full_sha,
|
||||
file.filename,
|
||||
ex_vis,
|
||||
ex_club,
|
||||
dedupe_club,
|
||||
profile_id,
|
||||
storage_key,
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user