# Bulk Operations ## User Perspective Bulk operations allow users to apply a metadata change to many videos at once — without pushing to YouTube individually. Changes go through a **preview → confirm** flow. ### Supported Bulk Actions - **Set Privacy Status** — change privacy on all/selected videos - **Assign Template** — apply a template to multiple videos - **Add Tags** — append tags without replacing existing ones - **Remove Tags** — remove specific tags from videos - **Search & Replace in Title** — find and replace text in video titles ### Push Pending Bulk Sync The "Push Pending" feature batch-syncs all videos with pending changes to YouTube. Accessible via the Push Pending tab. Users preview field-level diffs before confirming. ### Rollback Completed bulk jobs can be rolled back from the Bulk Jobs page (`/bulk-jobs`). Rollback restores the `beforeSnapshot` values for each affected video. ### Bulk Job Lifecycle `PENDING → DRY_RUN → CONFIRMED → RUNNING → DONE` (or `FAILED` / `ROLLED_BACK`) ## Developer Perspective ### Backend - **Module**: `backend/src/modules/bulk-jobs/` - **Endpoints**: `GET /bulk-jobs`, `GET /bulk-jobs/:id`, `POST /bulk-jobs/:id/rollback`, `GET /bulk-jobs/push-pending/preview`, `POST /bulk-jobs/push-pending` - **Header bulk change**: The Header component's "Bulk Change" modal calls `POST /bulk-jobs/preview` (via `bulkPreview()` in api.ts) and `POST /bulk-jobs/apply` ### Job Processing The `bulk-metadata.processor.ts` processor: 1. Loads `BulkJob` with all `BulkJobItem` records 2. For each item: saves `beforeSnapshot`, applies change, saves `afterSnapshot` 3. Updates `successCount` / `errorCount` on job 4. On completion: sets `status = DONE` and `completedAt` ### Data Model - `BulkJob` — one per operation. Has `type`, `filterSnapshot`, `rollbackData` - `BulkJobItem` — one per video. Has `beforeSnapshot`, `afterSnapshot`, `status` ## Related - [[11 - Bulk Jobs API]] - [[01 - Video Management]]