Add clip pinning test coverage

This commit is contained in:
Codex
2026-04-22 08:33:47 -05:00
parent 0a13aedbef
commit 58efca9a9f
9 changed files with 124 additions and 6 deletions

View File

@@ -41,6 +41,7 @@ def clip_to_response(clip: AudioClip) -> AudioClipResponse:
start_ms=clip.start_ms,
end_ms=clip.end_ms,
sort_order=clip.sort_order,
hidden=clip.hidden,
normalization_status=clip.normalization_status,
normalized_url=normalized_url,
waveform_duration_ms=waveform["duration_ms"] if waveform else None,
@@ -340,6 +341,8 @@ def update_clip(
clip.end_ms = payload.end_ms
if payload.sort_order is not None:
clip.sort_order = payload.sort_order
if payload.hidden is not None:
clip.hidden = payload.hidden
db.commit()
db.refresh(clip)
return clip_to_response(clip)
@@ -376,6 +379,7 @@ def delete_clip(
def list_clips(
external_team_id: str,
owner_external_player_id: str | None = None,
include_hidden: bool = False,
_: UserSession = Depends(require_session),
db: Session = Depends(get_db),
) -> list[AudioClipResponse]:
@@ -387,6 +391,8 @@ def list_clips(
)
if owner_external_player_id:
query = query.where(AudioAsset.owner_external_player_id == owner_external_player_id)
if not include_hidden:
query = query.where(AudioClip.hidden.is_(False))
clips = db.scalars(query).all()
return [clip_to_response(clip) for clip in clips]