gitscope
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/entity-table/hooks/use-entity-query.ts · v0.6.2
Source
1 578311c Mrdn 2y ago
2 7738ec1 Mardin 2y ago export interface PaginatedEntityQueryProps {
3 65bbe9d Mardin 2y ago page: number;
4 65bbe9d Mardin 2y ago size: number;
5 65bbe9d Mardin 2y ago }
6 65bbe9d Mardin 2y ago
7 65bbe9d Mardin 2y ago export type FilteredEntityType = {
8 65bbe9d Mardin 2y ago [key: string]: string | undefined;
9 65bbe9d Mardin 2y ago }
10 578311c Mrdn 2y ago
11 65bbe9d Mardin 2y ago export interface SortedEntityQueryProps {
12 cfe497c Mrdn 2y ago sortBy: string
13 cfe497c Mrdn 2y ago desc: boolean
14 cfe497c Mrdn 2y ago }
15 cfe497c Mrdn 2y ago
16 65bbe9d Mardin 2y ago interface FiltersEntityQueryProps {
17 65bbe9d Mardin 2y ago filters: FilteredEntityType;
18 65bbe9d Mardin 2y ago }
19 65bbe9d Mardin 2y ago
20 65bbe9d Mardin 2y ago export type UseEntityQueryProps = Partial<FiltersEntityQueryProps> & PaginatedEntityQueryProps & Partial<SortedEntityQueryProps>
21 65bbe9d Mardin 2y ago
22 65bbe9d Mardin 2y ago export type EntityName = string;
23 7738ec1 Mardin 2y ago export type ParentEntityName = string;
24 65bbe9d Mardin 2y ago export type EntityId = number | string | undefined;
25 65bbe9d Mardin 2y ago export type PrimaryFilter = string;
26 cfe497c Mrdn 2y ago
27 4cebd65 Mardin 2y ago export type QueryKey =
28 65bbe9d Mardin 2y ago [EntityName, PaginatedEntityQueryProps, PrimaryFilter, SortedEntityQueryProps, FiltersEntityQueryProps]
29 7738ec1 Mardin 2y ago export type DoubleEntityQueryKey =
30 7738ec1 Mardin 2y ago [EntityName, EntityId, PaginatedEntityQueryProps, PrimaryFilter?, SortedEntityQueryProps?, FiltersEntityQueryProps?]
31 7738ec1 Mardin 2y ago
32 7738ec1 Mardin 2y ago export type SelectableQueryKey =
33 7738ec1 Mardin 2y ago [ParentEntityName, EntityId, EntityName, PaginatedEntityQueryProps, PrimaryFilter, SortedEntityQueryProps, FiltersEntityQueryProps]
34 65bbe9d Mardin 2y ago
35 4cebd65 Mardin 2y ago export type SidebarQueryKey =
36 65bbe9d Mardin 2y ago [EntityName, EntityId, EntityName, PaginatedEntityQueryProps, PrimaryFilter, SortedEntityQueryProps, FiltersEntityQueryProps]
37 cfe497c Mrdn 2y ago
38 cfe497c Mrdn 2y ago export interface QueryKeyType<QT> {
39 cfe497c Mrdn 2y ago queryKey: QT
40 cfe497c Mrdn 2y ago }
41 578311c Mrdn 2y ago
42 65bbe9d Mardin 2y ago export type EntityQueryKeyType = QueryKeyType<QueryKey>
43 7738ec1 Mardin 2y ago export type DoubleEntityQueryKeyType = QueryKeyType<DoubleEntityQueryKey>
44 7738ec1 Mardin 2y ago export type SelectableEntityQueryKeyType = QueryKeyType<SelectableQueryKey>
45 65bbe9d Mardin 2y ago export type EntitySidebarQueryKeyType = QueryKeyType<SidebarQueryKey>
46 578311c Mrdn 2y ago
47 578311c Mrdn 2y ago interface FetchEntityResult<T> {
48 578311c Mrdn 2y ago pageCount: number
49 7738ec1 Mardin 2y ago entities: T[]
50 578311c Mrdn 2y ago }
51 578311c Mrdn 2y ago
52 578311c Mrdn 2y ago export type FetchEntityReturn<T> = Promise<FetchEntityResult<T>>