feat: 教練審核流程完整版——四狀態機、證照送審、Admin 裁決、通知(含測試清空 DB 重大修復) #36
Reference in New Issue
Block a user
Delete Branch "feat/provider-verification-workflow"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
摘要
實作 openspec change
provider-verification-workflow(25/25 tasks,路線圖第一優先項目),加上一個過程中抓到的重大測試基礎設施修復。🔴 重大修復(commit 3714055,建議先看)
容器內每次跑測試都在清空開發用 MySQL——docker compose 把
DB_CONNECTION=mysql注入為真實環境變數(存在$_SERVER),PHPUnit 的<env force>只覆蓋$_ENV/putenv,而 Laravelenv()優先讀$_SERVER→ RefreshDatabase 一直打在真 DB 上。這就是先前兩次「DB 神秘清空」的元凶。修法:tests/bootstrap.php在載入前三者同步強制 sqlite。已驗證全套件跑完 MySQL 資料存活。教練審核流程
狀態機:
unsubmitted →(送審)→ pending →(裁決)→ approved / rejected →(重送)→ pending,approved 可被撤銷(原因必填)。is_verifiedboolean 移除,migration 自動轉換,API 以 accessor 保留相容輸出。教練端(
/coach/verification新頁):證照上傳 ≤3 張(複用 CompressesImages 壓縮)、送審、駁回原因顯示、重新送審;pending/approved 期間證照鎖定(審核依據不可變)。Admin 端:審核佇列(待審 filter)、查看證照、通過/駁回(原因必填並通知);移除 toggle-verified 端點(單鍵切換可繞過狀態機)。
通知:審核結果站內+Email,駁回含原因。
政策延續:可見性與預約入口改判
approved(行為等價);既有預約不受狀態變動影響。驗證
部署注意
🤖 Generated with Claude Code