mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 11:20:07 +08:00
refactor(ocr): move TimestampExtendShape to data.ts and clean up imports
Move TimestampExtendShape definition from api.ts to data.ts where it's primarily used Clean up type imports and remove unnecessary comments
This commit is contained in:
parent
74e7979764
commit
12b9b64ca8
@ -9,10 +9,7 @@ import { OcrProviderConfigSchema } from './provider/base'
|
||||
// ==========================================================
|
||||
// API layer Types
|
||||
// ==========================================================
|
||||
export const TimestampExtendShape = {
|
||||
createdAt: z.number().nullable(),
|
||||
updatedAt: z.number().nullable()
|
||||
}
|
||||
|
||||
export type ListOcrProvidersQuery = { registered?: boolean }
|
||||
export const ListOcrProvidersResponseSchema = z.object({
|
||||
data: z.array(DbOcrProviderSchema)
|
||||
@ -21,13 +18,14 @@ export type ListOcrProvidersResponse = z.infer<typeof ListOcrProvidersResponseSc
|
||||
export const GetOcrProviderResponseSchema = z.object({
|
||||
data: DbOcrProviderSchema
|
||||
})
|
||||
export type GetOcrProviderResponse = z.infer<typeof GetOcrProviderResponseSchema> /**
|
||||
export type GetOcrProviderResponse = z.infer<typeof GetOcrProviderResponseSchema>
|
||||
|
||||
/**
|
||||
* Request payload for updating an OCR provider.
|
||||
* Only the following fields are modifiable:
|
||||
* - `name`: provider display name
|
||||
* - `config`: provider-specific configuration object (all properties optional)
|
||||
*/
|
||||
|
||||
export const UpdateOcrProviderRequestSchema = z.object({
|
||||
id: OcrProviderIdSchema,
|
||||
name: OcrProviderNameSchema.optional(),
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import type * as z from 'zod'
|
||||
import * as z from 'zod'
|
||||
|
||||
import { TimestampExtendShape, type UpdateOcrProviderRequest } from './api'
|
||||
import { type UpdateOcrProviderRequest } from './api'
|
||||
import { type OcrProvider } from './provider/base'
|
||||
import { OcrProviderSchema } from './provider/base'
|
||||
|
||||
@ -9,7 +9,10 @@ import { OcrProviderSchema } from './provider/base'
|
||||
//
|
||||
// NOTE: Timestamp operations are not exposed to outside.
|
||||
// ==========================================================
|
||||
|
||||
export const TimestampExtendShape = {
|
||||
createdAt: z.number().nullable(),
|
||||
updatedAt: z.number().nullable()
|
||||
}
|
||||
export const DbOcrProviderSchema = OcrProviderSchema.extend(TimestampExtendShape)
|
||||
export type DbOcrProvider = z.infer<typeof DbOcrProviderSchema>
|
||||
export function isDbOcrProvider(p: unknown): p is DbOcrProvider {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user