mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-06 21:35:52 +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
|
// API layer Types
|
||||||
// ==========================================================
|
// ==========================================================
|
||||||
export const TimestampExtendShape = {
|
|
||||||
createdAt: z.number().nullable(),
|
|
||||||
updatedAt: z.number().nullable()
|
|
||||||
}
|
|
||||||
export type ListOcrProvidersQuery = { registered?: boolean }
|
export type ListOcrProvidersQuery = { registered?: boolean }
|
||||||
export const ListOcrProvidersResponseSchema = z.object({
|
export const ListOcrProvidersResponseSchema = z.object({
|
||||||
data: z.array(DbOcrProviderSchema)
|
data: z.array(DbOcrProviderSchema)
|
||||||
@ -21,13 +18,14 @@ export type ListOcrProvidersResponse = z.infer<typeof ListOcrProvidersResponseSc
|
|||||||
export const GetOcrProviderResponseSchema = z.object({
|
export const GetOcrProviderResponseSchema = z.object({
|
||||||
data: DbOcrProviderSchema
|
data: DbOcrProviderSchema
|
||||||
})
|
})
|
||||||
export type GetOcrProviderResponse = z.infer<typeof GetOcrProviderResponseSchema> /**
|
export type GetOcrProviderResponse = z.infer<typeof GetOcrProviderResponseSchema>
|
||||||
|
|
||||||
|
/**
|
||||||
* Request payload for updating an OCR provider.
|
* Request payload for updating an OCR provider.
|
||||||
* Only the following fields are modifiable:
|
* Only the following fields are modifiable:
|
||||||
* - `name`: provider display name
|
* - `name`: provider display name
|
||||||
* - `config`: provider-specific configuration object (all properties optional)
|
* - `config`: provider-specific configuration object (all properties optional)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const UpdateOcrProviderRequestSchema = z.object({
|
export const UpdateOcrProviderRequestSchema = z.object({
|
||||||
id: OcrProviderIdSchema,
|
id: OcrProviderIdSchema,
|
||||||
name: OcrProviderNameSchema.optional(),
|
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 { type OcrProvider } from './provider/base'
|
||||||
import { OcrProviderSchema } 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.
|
// 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 const DbOcrProviderSchema = OcrProviderSchema.extend(TimestampExtendShape)
|
||||||
export type DbOcrProvider = z.infer<typeof DbOcrProviderSchema>
|
export type DbOcrProvider = z.infer<typeof DbOcrProviderSchema>
|
||||||
export function isDbOcrProvider(p: unknown): p is DbOcrProvider {
|
export function isDbOcrProvider(p: unknown): p is DbOcrProvider {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user