feat: P3阶段完成 - 全部模块迁移完成 🎉
## P3.1: 争议仲裁模块(disputes)✅ - API: disputes.ts - 模块导出 ## P3.2: 卖家中心模块(seller)✅ - Views: 4个页面 - Composables: usePublishForm, usePublishDraft - 模块导出 ## P3.3: 管理后台模块(admin)✅ - API: 8个文件(adminAuth, adminDashboard, adminUsers等) - Views: 15个管理页面 - Composables: useAdminTable, useAdminPaginatedTable - Components: 管理端组件 - 模块导出 --- ## 🎉 Features 架构迁移全部完成! ### 最终统计 - ✅ P0: shared(基础设施)- 22个文件 - ✅ P1: wallet, chats, orders - 24个文件 - ✅ P2: listings, auth - 35个文件 - ✅ P3: seller, disputes, admin - 47个文件 **总计:** 9个模块,128个文件完成迁移 ### 新架构 ``` frontend/src/ ├── features/ # 9个业务模块 ✅ │ ├── wallet/ ✅ │ ├── chats/ ✅ │ ├── orders/ ✅ (已重构) │ ├── listings/ ✅ │ ├── auth/ ✅ │ ├── seller/ ✅ │ ├── disputes/ ✅ │ └── admin/ ✅ └── shared/ ✅ ``` 下一步:清理旧文件、更新路由配置 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
3534cffce1
commit
c9397635e2
@@ -0,0 +1,70 @@
|
||||
import { apiClient } from './client'
|
||||
|
||||
import type { ApiResponse } from './types'
|
||||
|
||||
export interface Permission {
|
||||
id: number
|
||||
code: string
|
||||
name: string
|
||||
resource: string
|
||||
action: string
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
id: number
|
||||
code: string
|
||||
name: string
|
||||
description: string
|
||||
perm_count: number
|
||||
permissions?: Permission[]
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface CreateRoleRequest {
|
||||
code: string
|
||||
name: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface UpdateRoleRequest {
|
||||
name: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
export async function fetchRoles() {
|
||||
const { data } = await apiClient.get<ApiResponse<Role[]>>('/admin/roles')
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function fetchRole(id: number) {
|
||||
const { data } = await apiClient.get<ApiResponse<Role>>(`/admin/roles/${id}`)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function createRole(req: CreateRoleRequest) {
|
||||
const { data } = await apiClient.post<ApiResponse<Role>>('/admin/roles', req)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function updateRole(id: number, req: UpdateRoleRequest) {
|
||||
const { data } = await apiClient.put<ApiResponse<Role>>(`/admin/roles/${id}`, req)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function deleteRole(id: number) {
|
||||
const { data } = await apiClient.delete<ApiResponse<{ deleted: boolean }>>(`/admin/roles/${id}`)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function assignRolePermissions(roleId: number, permissionIds: number[]) {
|
||||
const { data } = await apiClient.put<ApiResponse<{ updated: boolean }>>(`/admin/roles/${roleId}/permissions`, {
|
||||
permission_ids: permissionIds,
|
||||
})
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function fetchPermissions() {
|
||||
const { data } = await apiClient.get<ApiResponse<Permission[]>>('/admin/permissions')
|
||||
return data.data
|
||||
}
|
||||
Reference in New Issue
Block a user