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
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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}`);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user