From f538e899769d38d0c3125e5357f66d20680d024d Mon Sep 17 00:00:00 2001 From: icarus Date: Mon, 20 Oct 2025 05:16:35 +0800 Subject: [PATCH] Revert "refactor(ocr): simplify ocr providers api by returning string array" This reverts commit 695afb6f75ec165429d122390b19d8b4b24a5c02. --- packages/shared/data/api/apiSchemas.ts | 23 ++++++++++++++++++++++- src/main/data/api/handlers/index.ts | 23 +++++++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/packages/shared/data/api/apiSchemas.ts b/packages/shared/data/api/apiSchemas.ts index 87333f8bc1..3788637e23 100644 --- a/packages/shared/data/api/apiSchemas.ts +++ b/packages/shared/data/api/apiSchemas.ts @@ -1,5 +1,6 @@ // NOTE: Types are defined inline in the schema for simplicity // If needed, specific types can be imported from './apiModels' +import type { OcrProvider } from '@types' import type { BodyForPath, ConcreteApiPaths, QueryParamsForPath, ResponseForPath } from './apiPaths' import type { HttpMethod, PaginatedResponse, PaginationParams } from './apiTypes' @@ -349,7 +350,27 @@ export interface ApiSchemas { '/ocr/providers': { GET: { - response: string[] + response: OcrProvider[] + } + POST: { + body: { + // TODO + } + } + } + + '/ocr/providers/:id': { + GET: { + response: OcrProvider + } + PATCH: { + // TODO + } + PUT: { + // TODO + } + DELETE: { + // TODO } } } diff --git a/src/main/data/api/handlers/index.ts b/src/main/data/api/handlers/index.ts index 6cc071604c..c0f954875a 100644 --- a/src/main/data/api/handlers/index.ts +++ b/src/main/data/api/handlers/index.ts @@ -5,7 +5,6 @@ * TypeScript will error if any endpoint is missing. */ -import { ocrService } from '@main/services/ocr/OcrService' import type { ApiImplementation } from '@shared/data/api/apiSchemas' import { TestService } from '../services/TestService' @@ -213,7 +212,27 @@ export const apiHandlers: ApiImplementation = { '/ocr/providers': { GET: async () => { - return ocrService.listProviderIds() + // We should implement it when user data migration completed. + // OcrProvider should be migrate to db, because the data objects contains user settings. + throw new Error('Not implemented') + }, + POST: async () => { + throw new Error('Not implemented') + } + }, + + '/ocr/providers/:id': { + GET: async () => { + throw new Error('Not implemented') + }, + PATCH: async () => { + throw new Error('Not implemented') + }, + PUT: async () => { + throw new Error('Not implemented') + }, + DELETE: async () => { + throw new Error('Not implemented') } } }