Files
aurak/web/services/searchHistoryService.ts
Developer 0a9588abb7 feat: implement QuestionBank CRUD with pagination and template query
- Add pagination support to findAll (page, limit query params)
- Add findByTemplateId method to service
- Add GET /by-template/:templateId endpoint to controller
- Service already includes CRUD for QuestionBank and QuestionBankItem
2026-04-23 17:19:11 +08:00

32 lines
913 B
TypeScript

import { SearchHistoryItem, SearchHistoryDetail } from '../types';
import { apiClient } from './apiClient';
export const searchHistoryService = {
async getHistories(page: number = 1, limit: number = 20): Promise<{
histories: SearchHistoryItem[];
total: number;
page: number;
limit: number;
}> {
const { data } = await apiClient.get(`/search-history?page=${page}&limit=${limit}`);
return data;
},
async getHistoryDetail(id: string): Promise<SearchHistoryDetail> {
const { data } = await apiClient.get(`/search-history/${id}`);
return data;
},
async createHistory(title: string, selectedGroups?: string[]): Promise<{ id: string }> {
const { data } = await apiClient.post(`/search-history`, { title, selectedGroups });
return data;
},
async deleteHistory(id: string): Promise<void> {
await apiClient.delete(`/search-history/${id}`);
},
};