43720482c4
Run Tests / test (pull_request) Successful in 2m3s
實作 openspec change provider-verification-workflow(25/25 tasks): - is_verified 升級為 verification_status 四狀態機(unsubmitted/pending/ approved/rejected),migration 自動轉換既有資料,API 以 accessor 保留 is_verified 相容輸出 - 教練端:證照上傳(≤3 張、複用 CompressesImages)、送審、駁回原因 顯示與重送(/coach/verification 新頁面) - Admin 端:審核佇列、通過/駁回(原因必填)、撤銷 approved;移除 toggle-verified 端點(防繞過狀態機);裁決後 flush 課程快取 - 通知:審核通過/駁回(站內+Email,駁回含原因) - 可見性與預約入口改判 approved(行為等價) - 測試 +18(ProviderVerificationTest 10、AdminVerificationTest 8), 既有 4 個測試檔 helper 遷移;Swagger 同步 - 規格同步:provider-verification 全面改寫、admin-user-management toggle 段落改為移除聲明 容器內全套件 173 passed / 439 assertions。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
71 lines
3.4 KiB
JavaScript
71 lines
3.4 KiB
JavaScript
import { createRouter, createWebHistory } from 'vue-router'
|
|
import { useAuthStore } from '../stores/auth'
|
|
import { useCoachAuthStore } from '../stores/coachAuth'
|
|
import { useAdminAuthStore } from '../stores/adminAuth'
|
|
|
|
const routes = [
|
|
// Member
|
|
{ path: '/', component: () => import('../views/HomeView.vue') },
|
|
{ path: '/courses', component: () => import('../views/CoursesView.vue') },
|
|
{ path: '/courses/:id', component: () => import('../views/CourseDetailView.vue') },
|
|
{ path: '/login', component: () => import('../views/LoginView.vue') },
|
|
{ path: '/register', component: () => import('../views/RegisterView.vue') },
|
|
{ path: '/auth/callback', component: () => import('../views/AuthCallbackView.vue') },
|
|
{ path: '/profile', component: () => import('../views/ProfileView.vue'), meta: { requiresAuth: true } },
|
|
{ path: '/my-bookings', component: () => import('../views/MyBookingsView.vue'), meta: { requiresAuth: true } },
|
|
|
|
// Coach (public)
|
|
{ path: '/coach/login', component: () => import('../views/coach/LoginView.vue') },
|
|
{ path: '/coach/register', component: () => import('../views/coach/RegisterView.vue') },
|
|
// Coach (protected)
|
|
{
|
|
path: '/coach',
|
|
component: () => import('../layouts/CoachLayout.vue'),
|
|
meta: { requiresCoach: true },
|
|
children: [
|
|
{ path: 'dashboard', component: () => import('../views/coach/DashboardView.vue') },
|
|
{ path: 'offers/new', component: () => import('../views/coach/OfferFormView.vue') },
|
|
{ path: 'offers/:id/edit', component: () => import('../views/coach/OfferFormView.vue') },
|
|
{ path: 'profile', component: () => import('../views/coach/ProfileView.vue') },
|
|
{ path: 'schedules', component: () => import('../views/coach/ScheduleManagerView.vue') },
|
|
{ path: 'bookings', component: () => import('../views/coach/BookingManagerView.vue') },
|
|
{ path: 'reviews', component: () => import('../views/coach/ReviewsView.vue') },
|
|
{ path: 'verification', component: () => import('../views/coach/VerificationView.vue') },
|
|
],
|
|
},
|
|
|
|
// Admin (public)
|
|
{ path: '/admin/login', component: () => import('../views/admin/LoginView.vue') },
|
|
// Admin (protected)
|
|
{
|
|
path: '/admin',
|
|
component: () => import('../layouts/AdminLayout.vue'),
|
|
meta: { requiresAdmin: true },
|
|
children: [
|
|
{ path: 'dashboard', component: () => import('../views/admin/DashboardView.vue') },
|
|
{ path: 'members', component: () => import('../views/admin/MembersView.vue') },
|
|
{ path: 'providers', component: () => import('../views/admin/ProvidersView.vue') },
|
|
{ path: 'offers', component: () => import('../views/admin/OffersView.vue') },
|
|
{ path: 'bookings', component: () => import('../views/admin/BookingsView.vue') },
|
|
{ path: 'reviews', component: () => import('../views/admin/ReviewsView.vue') },
|
|
],
|
|
},
|
|
]
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes,
|
|
})
|
|
|
|
router.beforeEach((to) => {
|
|
const auth = useAuthStore()
|
|
const coachAuth = useCoachAuthStore()
|
|
const adminAuth = useAdminAuthStore()
|
|
|
|
if (to.meta.requiresAuth && !auth.isLoggedIn) return { path: '/login' }
|
|
if (to.meta.requiresCoach && !coachAuth.isLoggedIn) return { path: '/coach/login' }
|
|
if (to.meta.requiresAdmin && !adminAuth.isLoggedIn) return { path: '/admin/login' }
|
|
})
|
|
|
|
export default router
|