优化“知识库模块“--基本完善
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { apiGet, apiPatch, apiPost } from "./axios";
|
||||
import { apiDelete, apiGet, apiPatch, apiPost } from "./axios";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { ApiListResponse } from "../types/api";
|
||||
|
||||
@@ -17,6 +17,8 @@ export interface FaqItem {
|
||||
id: string;
|
||||
study_id?: string | null;
|
||||
category_id: string;
|
||||
best_reply_id?: string | null;
|
||||
status?: "PENDING" | "PROCESSING" | "RESOLVED";
|
||||
question: string;
|
||||
answer: string;
|
||||
keywords?: string | null;
|
||||
@@ -27,6 +29,25 @@ export interface FaqItem {
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface FaqReplyQuote {
|
||||
id: string;
|
||||
content: string;
|
||||
created_by: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface FaqReply {
|
||||
id: string;
|
||||
faq_id: string;
|
||||
study_id?: string | null;
|
||||
content: string;
|
||||
created_by: string;
|
||||
created_at: string;
|
||||
quote_reply_id?: string | null;
|
||||
quote?: FaqReplyQuote | null;
|
||||
is_deleted?: boolean;
|
||||
}
|
||||
|
||||
export const fetchFaqCategories = (params?: Record<string, any>): Promise<AxiosResponse<ApiListResponse<FaqCategory>>> =>
|
||||
apiGet("/api/v1/faqs/categories", { params });
|
||||
|
||||
@@ -36,6 +57,9 @@ export const createFaqCategory = (payload: Record<string, any>) =>
|
||||
export const updateFaqCategory = (categoryId: string, payload: Record<string, any>) =>
|
||||
apiPatch<FaqCategory>(`/api/v1/faqs/categories/${categoryId}`, payload);
|
||||
|
||||
export const deleteFaqCategory = (categoryId: string) =>
|
||||
apiDelete<void>(`/api/v1/faqs/categories/${categoryId}`);
|
||||
|
||||
export const fetchFaqItems = (params?: Record<string, any>): Promise<AxiosResponse<ApiListResponse<FaqItem>>> =>
|
||||
apiGet("/api/v1/faqs/items", { params });
|
||||
|
||||
@@ -45,3 +69,21 @@ export const createFaqItem = (payload: Record<string, any>) => apiPost<FaqItem>(
|
||||
|
||||
export const updateFaqItem = (itemId: string, payload: Record<string, any>) =>
|
||||
apiPatch<FaqItem>(`/api/v1/faqs/items/${itemId}`, payload);
|
||||
|
||||
export const deleteFaqItem = (itemId: string) =>
|
||||
apiDelete<void>(`/api/v1/faqs/items/${itemId}`);
|
||||
|
||||
export const fetchFaqReplies = (itemId: string) =>
|
||||
apiGet<FaqReply[] | { items: FaqReply[] }>(`/api/v1/faqs/items/${itemId}/replies`);
|
||||
|
||||
export const createFaqReply = (itemId: string, payload: { content: string; quote_reply_id?: string | null }) =>
|
||||
apiPost<FaqReply>(`/api/v1/faqs/items/${itemId}/replies`, payload);
|
||||
|
||||
export const deleteFaqReply = (itemId: string, replyId: string) =>
|
||||
apiDelete<void>(`/api/v1/faqs/items/${itemId}/replies/${replyId}`);
|
||||
|
||||
export const setFaqBestReply = (itemId: string, payload: { best_reply_id: string | null }) =>
|
||||
apiPatch<FaqItem>(`/api/v1/faqs/items/${itemId}/best-reply`, payload);
|
||||
|
||||
export const setFaqStatus = (itemId: string, payload: { status: "PENDING" | "PROCESSING" | "RESOLVED" }) =>
|
||||
apiPatch<FaqItem>(`/api/v1/faqs/items/${itemId}/status`, payload);
|
||||
|
||||
Reference in New Issue
Block a user