feat:實作 Coach Portal — 教練後台課程管理
後端: - Migration:diving_offers 新增 provider_id(nullable FK) - Migration:users.role ENUM 加入 provider 值 - Migration:diving_offers.spot 改為 nullable - AuthController:registerProvider business_name 改為選填 - AuthController:updateProviderProfile 補上 certifications / dive_sites / services / facilities / website / social_media - ProviderOfferController:教練課程 CRUD(index/show/store/update/destroy),實作 provider_id 所有權不變式(404 → 403 兩步驟) 前端(frontend/): - coachAuth store、coachAxios(獨立於 member auth) - /coach/* 路由群組 + beforeEach guard - CoachNavBar、CoachLayout(教練頁隱藏會員 NavBar) - LoginView、RegisterView、DashboardView(表格 + 刪除確認) - OfferFormView(新增/編輯共用)、ProfileView OpenSpec: - openspec/config.yaml 補入專案 context 與 rules - 新增 specs:coach-offers-api / coach-portal-ui / provider-auth - 更新 spec:diving-offers-api 加入 provider_id - 歸檔:openspec/changes/archive/2026-05-10-coach-portal Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
## Why
|
||||
|
||||
會員端課程列表目前依賴手動塞入的測試資料,平台無法規模化運作。需要 Coach Portal 讓教練能自行上架、編輯、下架課程,使平台內容自給自足。
|
||||
|
||||
## What Changes
|
||||
|
||||
- **後端**:`diving_offers` 表新增 `provider_id` 欄位,綁定課程與教練
|
||||
- **後端**:補完 Provider Auth API(register / login / logout / profile CRUD)
|
||||
- **後端**:新增 Coach 課程管理 API(CRUD,需 provider 角色驗證)
|
||||
- **前端**:在現有 Vue 3 SPA 新增 `/coach/*` 路由群組,整合教練登入與課程管理介面
|
||||
- **修改** `diving-offers-api`:公開課程列表 API 新增 `provider_id` 欄位於 response,供未來關聯展示使用
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
|
||||
- `provider-auth`:教練帳號的註冊、登入、登出、個人資料讀取與更新 API
|
||||
- `coach-offers-api`:教練專屬課程管理 API(列出自己課程、新增、更新、刪除)
|
||||
- `coach-portal-ui`:教練後台前端介面(登入、課程 Dashboard、新增/編輯表單、個人資料頁)
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `diving-offers-api`:`diving_offers` 資料表新增 `provider_id` 欄位,response 加入此欄位(向後相容,nullable)
|
||||
|
||||
## Impact
|
||||
|
||||
**後端**
|
||||
- 新增 migration:`diving_offers.provider_id`
|
||||
- 補完 `AuthController` 中 Provider 相關方法(現有路由佔位但方法未實作)
|
||||
- 新增 `ProviderOfferController`
|
||||
|
||||
**前端(frontend/ 目錄)**
|
||||
- 新增 `src/stores/coachAuth.js`
|
||||
- 新增 `src/views/coach/` 目錄下各頁面
|
||||
- `src/router/index.js` 新增 `/coach/*` 路由與 guard
|
||||
|
||||
**資料庫**
|
||||
- `diving_offers` 表結構變更(新增 nullable 欄位,不影響現有資料)
|
||||
Reference in New Issue
Block a user