import apiClient from './client' import type { Comment, ApiResponse, PaginatedResponse } from '@/types' // 评论查询参数 export interface CommentQueryParams { page?: number page_size?: number keyword?: string // 搜索关键词(内容) post_id?: string // 关联帖子ID筛选 author_id?: string // 评论者ID筛选 status?: string // 状态筛选 start_date?: string // 开始日期 end_date?: string // 结束日期 } // 评论详情(包含更多上下文) export interface CommentDetail extends Comment { parent_id?: string reply_to_user?: { id: string username: string nickname: string } post?: { id: string title: string } ip_address?: string device_info?: string } // 评论管理API export const commentsApi = { // 获取评论列表(分页、搜索、筛选) getComments: (params: CommentQueryParams) => apiClient.get>>('/admin/comments', { params }), // 获取评论详情 getCommentById: (id: string) => apiClient.get>(`/admin/comments/${id}`), // 删除评论 deleteComment: (id: string) => apiClient.delete>(`/admin/comments/${id}`), // 批量删除评论 batchDeleteComments: (ids: string[]) => apiClient.post>('/admin/comments/batch-delete', { ids }), // 获取帖子的评论列表 getCommentsByPost: (postId: string, params?: Omit) => apiClient.get>>(`/admin/comments/post/${postId}`, { params }), } export default commentsApi