gitscope
← marzneshin / v0.3.0-alpha4 / dashboard/src/components/entity-table/hooks/use-entity-query.ts
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/components/entity-table/hooks/use-entity-query.ts · TypeScript
Blame Raw
 1import { z } from "zod";
 2
 3const UseEntityQueryPropsSchema = z.object({
 4    page: z.number().gte(1),
 5    size: z.number().gte(1).lte(100),
 6    search: z.string().optional()
 7})
 8
 9export type UseEntityQueryProps = z.infer<typeof UseEntityQueryPropsSchema>
10
11export type EntityQueryKeyType = { queryKey: [string, number, number, string] }
12
13interface FetchEntityResult<T> {
14    pageCount: number
15    entity: T[]
16}
17
18export type FetchEntityReturn<T> = Promise<FetchEntityResult<T>>