Files
CFDivePlatform/openspec/specs/admin-offer-management/spec.md
T
a620906209 ad2c05779d feat:實作 Admin Panel — 平台管理後台
後端:
- AdminStatsController:總會員/教練/課程數統計 API
- AdminUserController:會員與教練列表、詳情、啟用/停用、教練驗證(toggle 反轉語意)
- AdminOfferController:全平台課程列表與刪除
- routes/api.php:新增 /api/admin/stats、members、providers、offers 等路由

前端(frontend/):
- adminAuth store、adminAxios(第三套獨立認證)
- /admin/* 路由群組 + requiresAdmin guard
- AdminNavBar、AdminLayout
- App.vue:isCoachPage → isBackofficePage(/coach/* 和 /admin/* 皆隱藏會員 NavBar)
- LoginView、DashboardView(統計卡片)
- MembersView、ProvidersView(含驗證操作)、OffersView(含刪除確認)

OpenSpec:
- 新增 specs:admin-auth / admin-user-management / admin-offer-management / admin-stats / admin-panel-ui
- 歸檔:openspec/changes/archive/2026-05-10-admin-panel

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-05-10 04:07:13 +08:00

26 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## ADDED Requirements
### Requirement: 管理員查看全平台課程列表
後端 SHALL 提供 `GET /api/admin/offers`(需 Bearer tokenrole=admin),回傳所有課程,支援關鍵字搜尋與分頁。
#### Scenario: 取得全部課程列表
- **WHEN** 管理員送出 GET 請求不帶參數
- **THEN** 回傳 HTTP 200`{ status: true, data: [...offers], meta: { total, per_page, current_page, last_page } }`,預設每頁 15 筆,含 provider_id
#### Scenario: 搜尋課程
- **WHEN** 管理員送出 `?q=墾丁`
- **THEN** 只回傳 title 或 location 包含「墾丁」的課程
---
### Requirement: 管理員刪除課程
後端 SHALL 提供 `DELETE /api/admin/offers/{id}`(需 Bearer tokenrole=admin),可刪除任意課程,不受 provider_id 限制。
#### Scenario: 刪除存在的課程
- **WHEN** 管理員送出有效 id 的 DELETE 請求
- **THEN** 回傳 HTTP 200`{ status: true, message: "課程已刪除" }`,資料庫記錄移除
#### Scenario: 課程不存在
- **WHEN** 指定 id 的課程不存在
- **THEN** 回傳 HTTP 404`{ status: false, message: "課程不存在" }`