refactor: 统一知识库接口公共类型
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { request } from '@/api/request'
|
||||
import type { KbReply } from './faq'
|
||||
import type { KbReply } from './types'
|
||||
|
||||
/** 公共分类状态。 */
|
||||
export type CategoryStatus = 'active' | 'inactive'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { request } from '@/api/request'
|
||||
import type { KbReply } from './faq'
|
||||
import type { KbReply } from './types'
|
||||
|
||||
/** 文档状态。 */
|
||||
export type DocumentStatus = 'draft' | 'published' | 'reviewed' | 'rejected'
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { request } from '@/api/request'
|
||||
import type { KbReply } from './types'
|
||||
|
||||
export { fetchCategoryTree as fetchGeneralCategoryTree } from './category'
|
||||
export type { CategoryTreeNode } from './category'
|
||||
export type { KbReply } from './types'
|
||||
|
||||
/** FAQ 审核状态。 */
|
||||
export type FaqStatus = 'draft' | 'published' | 'reviewed' | 'rejected'
|
||||
@@ -7,14 +12,6 @@ export type FaqPriority = 'low' | 'medium' | 'high'
|
||||
/** FAQ 列表可见范围。 */
|
||||
export type FaqScope = 'my' | 'all'
|
||||
|
||||
/** 知识库服务统一响应。 */
|
||||
export interface KbReply<T> {
|
||||
code: number
|
||||
message: string
|
||||
details: T
|
||||
timeseq: number
|
||||
}
|
||||
|
||||
/** FAQ 资源。 */
|
||||
export interface Faq {
|
||||
id: number
|
||||
@@ -96,24 +93,6 @@ export interface UpdateFaqData extends FaqFormData {
|
||||
id: number
|
||||
}
|
||||
|
||||
/** 公共分类树节点。 */
|
||||
export interface CategoryTreeNode {
|
||||
id: number
|
||||
name: string
|
||||
description: string
|
||||
type: 'general'
|
||||
icon: string
|
||||
color: string
|
||||
parent_id: number
|
||||
level: number
|
||||
path: string
|
||||
sort_order: number
|
||||
status: 'active' | 'inactive'
|
||||
doc_count: number
|
||||
faq_count: number
|
||||
children: CategoryTreeNode[]
|
||||
}
|
||||
|
||||
/** FAQ 状态筛选项。 */
|
||||
export const faqStatusOptions: Array<{ label: string; value: FaqStatus }> = [
|
||||
{ label: '草稿', value: 'draft' },
|
||||
@@ -196,6 +175,3 @@ export const unfavoriteFaq = (id: number) =>
|
||||
resource_type: 'faq',
|
||||
resource_id: id,
|
||||
})
|
||||
|
||||
/** 获取公共分类树。 */
|
||||
export const fetchGeneralCategoryTree = () => request.get<KbReply<CategoryTreeNode[]>>('/Kb/v1/category/tree')
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { request } from '@/api/request'
|
||||
import type { Document } from './document'
|
||||
import type { Faq, KbReply } from './faq'
|
||||
import type { Faq } from './faq'
|
||||
import type { KbReply } from './types'
|
||||
|
||||
export type ResourceType = 'document' | 'faq'
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { request } from '@/api/request'
|
||||
import type { Document } from './document'
|
||||
import type { Faq, KbReply } from './faq'
|
||||
import type { Faq } from './faq'
|
||||
import type { KbReply } from './types'
|
||||
|
||||
export type ReviewResourceType = 'all' | 'document' | 'faq'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { request } from '@/api/request'
|
||||
import type { KbReply } from './faq'
|
||||
import type { KbReply } from './types'
|
||||
|
||||
export type TrashResourceType = 'document' | 'faq'
|
||||
|
||||
|
||||
7
src/api/kb/types.ts
Normal file
7
src/api/kb/types.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/** 知识库服务统一响应。 */
|
||||
export interface KbReply<T> {
|
||||
code: number
|
||||
message: string
|
||||
details: T
|
||||
timeseq: number
|
||||
}
|
||||
Reference in New Issue
Block a user