Files
speaking-practice/docs/superpowers/plans/2026-06-02-speaking-lab-material-edit.md
T
2026-06-03 00:34:42 +08:00

30 lines
1.2 KiB
Markdown

# Speaking Lab Material Edit v1 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Add backend and admin-page support for editing existing materials, including replacing video and subtitle files.
**Architecture:** Extend the existing FastAPI/SQLite content-library path with an update helper and `PATCH /api/videos/{video_id}` endpoint. Reuse the existing admin form as an add/edit form, keeping add mode as the default and switching to edit mode from the material list.
**Tech Stack:** FastAPI multipart forms, SQLite, vanilla JS, existing CSS.
---
## Tasks
1. Backend update helper in `backend/db.py`.
2. PATCH endpoint and safe replacement cleanup in `backend/main.py`.
3. Admin form edit mode in `admin.html` and `admin.js`.
4. Admin list edit action styling in `styles.css`.
5. Static and API smoke verification.
## Verification Commands
```powershell
python -m py_compile backend\main.py backend\db.py
node --check admin.js
node --check app.js
node tests\admin-file-input.test.mjs
node tests\progress-helpers.test.mjs
```