forked from hangshuo652/aurak
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,24 @@
|
||||
import { apiClient } from './apiClient';
|
||||
|
||||
/**
|
||||
* OCR Service - Handles image text recognition
|
||||
*/
|
||||
export const ocrService = {
|
||||
// Recognize text in image
|
||||
async recognizeText(authToken: string, image: Blob): Promise<string> {
|
||||
const formData = new FormData();
|
||||
formData.append('image', image);
|
||||
|
||||
const response = await apiClient.request('/ocr/recognize', {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to recognize text');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
return data.text;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user