Add playlists and collections feature (Issue #223)#428
Merged
filthyrake merged 3 commits intodevfrom Dec 28, 2025
Merged
Conversation
Implements comprehensive playlist/collection functionality for organizing
videos into ordered groups.
## Backend Changes
- Add database migration (020_add_playlists.py) for playlists and playlist_items tables
- Add table definitions to database.py with support for:
- Visibility: public, private, unlisted
- Types: playlist, collection, series, course
- Featured flag for homepage display
- Soft delete support
- Add Pydantic schemas for playlist CRUD operations
- Add playlist audit actions for activity logging
## Admin API Endpoints
- GET /api/playlists - List all playlists with video counts
- POST /api/playlists - Create new playlist
- GET /api/playlists/{id} - Get playlist with videos
- PUT /api/playlists/{id} - Update playlist metadata
- DELETE /api/playlists/{id} - Soft delete playlist
- GET /api/playlists/{id}/videos - Get videos in playlist
- POST /api/playlists/{id}/videos - Add video to playlist
- DELETE /api/playlists/{id}/videos/{video_id} - Remove video
- POST /api/playlists/{id}/reorder - Reorder videos
## Public API Endpoints
- GET /api/playlists - List public playlists with filtering
- GET /api/playlists/{slug} - Get playlist detail with videos
- GET /api/playlists/{slug}/videos - Get playlist videos
## Admin UI
- Add Playlists tab with list and edit views
- TypeScript types for playlist models
- Playlist store with full CRUD operations
- Create playlist form with type/visibility selectors
- Playlist editor with metadata editing
- Drag-to-reorder video functionality
- Add video modal with search
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes identified issues from comprehensive code review: ## Critical - Add playlist_type validation in public API to prevent invalid values ## Important - Fix race condition in add_video_to_playlist with FOR UPDATE locking - Use transaction for atomic position shift + insert operations - Replace N+1 query in reorder with batch UPDATE using PostgreSQL unnest - Add composite index (playlist_id, position) for efficient ordered retrieval ## Improvements - Add pagination to admin list_playlists endpoint (limit/offset params) - Remove unused RemoveVideoFromPlaylistRequest schema - Fix TypeScript any type with proper CombinedStoreContext interface - Optimize drag-drop to skip API call when order unchanged - Make created_at NOT NULL in migration (always has default value) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Sort imports in api/admin.py (ruff I001) - Remove unused response variable in worker/remote_transcoder.py (ruff F841) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements comprehensive playlist/collection functionality for organizing videos into ordered groups.
playlistsandplaylist_itemstables with support for visibility (public/private/unlisted), types (playlist/collection/series/course), featured flag, and soft deleteAPI Endpoints Added
Admin (authenticated)
Public
Test Plan
Closes #223
🤖 Generated with Claude Code