-
+
{hasPrefix(location.pathname, '/admin') && (
- {adminSubItems.map((item) => (
+ {adminSubItems.map(item => (
v1.0.0
diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx
index 62441ee..01c00a7 100644
--- a/frontend/src/components/Layout.tsx
+++ b/frontend/src/components/Layout.tsx
@@ -41,7 +41,8 @@ export default function Layout() {
{ path: '/search', title: 'Search' },
{ path: '/settings', title: 'Settings' },
];
- const currentPageTitle = navItems.find(item => location.pathname === item.path)?.title || 'Documents';
+ const currentPageTitle =
+ navItems.find(item => location.pathname === item.path)?.title || 'Documents';
// Show loading while checking authentication status
if (isCheckingAuth) {
@@ -61,12 +62,13 @@ export default function Layout() {
{/* Header Title */}
-
- {currentPageTitle}
-
+
{currentPageTitle}
{/* User Dropdown */}
-
+
{/* Main Content */}
-
-
);
-}
\ No newline at end of file
+}
diff --git a/frontend/src/components/README.md b/frontend/src/components/README.md
index e3f64a5..8bbeed2 100644
--- a/frontend/src/components/README.md
+++ b/frontend/src/components/README.md
@@ -124,10 +124,10 @@ Card placeholder with optional elements:
// Custom configuration
-
@@ -183,12 +183,7 @@ function DocumentList() {
return ;
}
- return (
-
- );
+ return ;
}
```
diff --git a/frontend/src/components/Skeleton.tsx b/frontend/src/components/Skeleton.tsx
index 8010790..9c8d319 100644
--- a/frontend/src/components/Skeleton.tsx
+++ b/frontend/src/components/Skeleton.tsx
@@ -16,7 +16,7 @@ export function Skeleton({
animation = 'pulse',
}: SkeletonProps) {
const baseClasses = 'bg-gray-200 dark:bg-gray-600';
-
+
const variantClasses = {
default: 'rounded',
text: 'rounded-md h-4',
@@ -32,17 +32,13 @@ export function Skeleton({
const style = {
width: width !== undefined ? (typeof width === 'number' ? `${width}px` : width) : undefined,
- height: height !== undefined ? (typeof height === 'number' ? `${height}px` : height) : undefined,
+ height:
+ height !== undefined ? (typeof height === 'number' ? `${height}px` : height) : undefined,
};
return (
);
@@ -61,10 +57,7 @@ export function SkeletonText({ lines = 3, className = '', lineClassName = '' }:
1 ? 'w-3/4' : 'w-full'
- )}
+ className={cn(lineClassName, i === lines - 1 && lines > 1 ? 'w-3/4' : 'w-full')}
/>
))}
@@ -85,14 +78,7 @@ export function SkeletonAvatar({ size = 'md', className = '' }: SkeletonAvatarPr
const pixelSize = typeof size === 'number' ? size : sizeMap[size];
- return (
-
- );
+ return
;
}
interface SkeletonCardProps {
@@ -111,7 +97,12 @@ export function SkeletonCard({
textLines = 3,
}: SkeletonCardProps) {
return (
-
+
{showAvatar && (
@@ -121,12 +112,8 @@ export function SkeletonCard({
)}
- {showTitle && (
-
- )}
- {showText && (
-
- )}
+ {showTitle &&
}
+ {showText &&
}
);
}
@@ -163,7 +150,10 @@ export function SkeletonTable({
{Array.from({ length: columns }).map((_, colIndex) => (
|
-
+
|
))}
@@ -220,11 +210,12 @@ export function InlineLoader({ size = 'md', className = '' }: InlineLoaderProps)
return (
);
}
// Re-export SkeletonTable for backward compatibility
export { SkeletonTable as SkeletonTableExport };
-
diff --git a/frontend/src/components/Table.tsx b/frontend/src/components/Table.tsx
index a3972e3..7b28cbb 100644
--- a/frontend/src/components/Table.tsx
+++ b/frontend/src/components/Table.tsx
@@ -5,7 +5,7 @@ import { cn } from '../utils/cn';
export interface Column
{
key: keyof T;
header: string;
- render?: (value: any, row: T, index: number) => React.ReactNode;
+ render?: (value: any, _row: T, _index: number) => React.ReactNode;
className?: string;
}
@@ -17,6 +17,47 @@ export interface TableProps {
rowKey?: keyof T | ((row: T) => string);
}
+// Skeleton table component for loading state
+function SkeletonTable({
+ rows = 5,
+ columns = 4,
+ className = '',
+}: {
+ rows?: number;
+ columns?: number;
+ className?: string;
+}) {
+ return (
+
+
+
+
+ {Array.from({ length: columns }).map((_, i) => (
+ |
+
+ |
+ ))}
+
+
+
+ {Array.from({ length: rows }).map((_, rowIndex) => (
+
+ {Array.from({ length: columns }).map((_, colIndex) => (
+ |
+
+ |
+ ))}
+
+ ))}
+
+
+
+ );
+}
+
export function Table>({
columns,
data,
@@ -24,50 +65,18 @@ export function Table>({
emptyMessage = 'No Results',
rowKey,
}: TableProps) {
- const getRowKey = (row: T, index: number): string => {
+ const getRowKey = (_row: T, index: number): string => {
if (typeof rowKey === 'function') {
- return rowKey(row);
+ return rowKey(_row);
}
if (rowKey) {
- return String(row[rowKey] ?? index);
+ return String(_row[rowKey] ?? index);
}
return `row-${index}`;
};
- // Skeleton table component for loading state
- function SkeletonTable({ rows = 5, columns = 4, className = '' }: { rows?: number; columns?: number; className?: string }) {
- return (
-
-
-
-
- {Array.from({ length: columns }).map((_, i) => (
- |
-
- |
- ))}
-
-
-
- {Array.from({ length: rows }).map((_, rowIndex) => (
-
- {Array.from({ length: columns }).map((_, colIndex) => (
- |
-
- |
- ))}
-
- ))}
-
-
-
- );
- }
-
if (loading) {
- return (
-
- );
+ return ;
}
return (
@@ -76,7 +85,7 @@ export function Table>({
- {columns.map((column) => (
+ {columns.map(column => (
| >({
|
) : (
data.map((row, index) => (
-
- {columns.map((column) => (
+
+ {columns.map(column => (
|
- {column.render
- ? column.render(row[column.key], row, index)
- : row[column.key]}
+ {column.render ? column.render(row[column.key], row, index) : row[column.key]}
|
))}
diff --git a/frontend/src/components/Toast.tsx b/frontend/src/components/Toast.tsx
index 8822b15..6f193c3 100644
--- a/frontend/src/components/Toast.tsx
+++ b/frontend/src/components/Toast.tsx
@@ -11,9 +11,10 @@ export interface ToastProps {
onClose?: (id: string) => void;
}
-const getToastStyles = (type: ToastType) => {
- const baseStyles = 'flex items-center gap-3 p-4 rounded-lg shadow-lg border-l-4 transition-all duration-300';
-
+const getToastStyles = (_type: ToastType) => {
+ const baseStyles =
+ 'flex items-center gap-3 p-4 rounded-lg shadow-lg border-l-4 transition-all duration-300';
+
const typeStyles = {
info: 'bg-blue-50 dark:bg-blue-900/30 border-blue-500 dark:border-blue-400',
warning: 'bg-yellow-50 dark:bg-yellow-900/30 border-yellow-500 dark:border-yellow-400',
@@ -69,15 +70,11 @@ export function Toast({ id, type, message, duration = 5000, onClose }: ToastProp
return (
{icons[type]}
-
- {message}
-
+
{message}
([]);
const removeToast = useCallback((id: string) => {
- setToasts((prev) => prev.filter((toast) => toast.id !== id));
+ setToasts(prev => prev.filter(toast => toast.id !== id));
}, []);
- const showToast = useCallback((message: string, type: ToastType = 'info', duration?: number): string => {
- const id = `toast-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
- setToasts((prev) => [...prev, { id, type, message, duration, onClose: removeToast }]);
- return id;
- }, [removeToast]);
+ const showToast = useCallback(
+ (message: string, _type: ToastType = 'info', _duration?: number): string => {
+ const id = `toast-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
+ setToasts(prev => [
+ ...prev,
+ { id, type: _type, message, duration: _duration, onClose: removeToast },
+ ]);
+ return id;
+ },
+ [removeToast]
+ );
- const showInfo = useCallback((message: string, duration?: number) => {
- return showToast(message, 'info', duration);
- }, [showToast]);
+ const showInfo = useCallback(
+ (message: string, _duration?: number) => {
+ return showToast(message, 'info', _duration);
+ },
+ [showToast]
+ );
- const showWarning = useCallback((message: string, duration?: number) => {
- return showToast(message, 'warning', duration);
- }, [showToast]);
+ const showWarning = useCallback(
+ (message: string, _duration?: number) => {
+ return showToast(message, 'warning', _duration);
+ },
+ [showToast]
+ );
- const showError = useCallback((message: string, duration?: number) => {
- return showToast(message, 'error', duration);
- }, [showToast]);
+ const showError = useCallback(
+ (message: string, _duration?: number) => {
+ return showToast(message, 'error', _duration);
+ },
+ [showToast]
+ );
const clearToasts = useCallback(() => {
setToasts([]);
}, []);
return (
-
+
{children}
@@ -61,7 +78,7 @@ function ToastContainer({ toasts }: ToastContainerProps) {
return (
- {toasts.map((toast) => (
+ {toasts.map(toast => (
))}
diff --git a/frontend/src/components/index.ts b/frontend/src/components/index.ts
index b6472b9..fea8839 100644
--- a/frontend/src/components/index.ts
+++ b/frontend/src/components/index.ts
@@ -4,13 +4,13 @@ export { ToastProvider, useToasts } from './ToastContext';
export type { ToastType, ToastProps } from './Toast';
// Skeleton components
-export {
- Skeleton,
- SkeletonText,
- SkeletonAvatar,
- SkeletonCard,
- SkeletonTable,
+export {
+ Skeleton,
+ SkeletonText,
+ SkeletonAvatar,
+ SkeletonCard,
+ SkeletonTable,
SkeletonButton,
PageLoader,
- InlineLoader
+ InlineLoader,
} from './Skeleton';
diff --git a/frontend/src/generated/anthoLumeAPIV1.ts b/frontend/src/generated/anthoLumeAPIV1.ts
index 985ba02..df71cf8 100644
--- a/frontend/src/generated/anthoLumeAPIV1.ts
+++ b/frontend/src/generated/anthoLumeAPIV1.ts
@@ -5,10 +5,7 @@
* REST API for AnthoLume document management system
* OpenAPI spec version: 1.0.0
*/
-import {
- useMutation,
- useQuery
-} from '@tanstack/react-query';
+import { useMutation, useQuery } from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
@@ -21,15 +18,11 @@ import type {
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
- UseQueryResult
+ UseQueryResult,
} from '@tanstack/react-query';
import * as axios from 'axios';
-import type {
- AxiosError,
- AxiosRequestConfig,
- AxiosResponse
-} from 'axios';
+import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
import type {
ActivityResponse,
@@ -62,2093 +55,2530 @@ import type {
UpdateSettingsRequest,
UpdateUserBody,
UserStatisticsResponse,
- UsersResponse
+ UsersResponse,
} from './model';
-
-
-
-
/**
* @summary List documents
*/
export const getDocuments = (
- params?: GetDocumentsParams, options?: AxiosRequestConfig
- ): Promise
> => {
-
-
- return axios.default.get(
- `/api/v1/documents`,{
+ params?: GetDocumentsParams,
+ options?: AxiosRequestConfig
+): Promise> => {
+ return axios.default.get(`/api/v1/documents`, {
...options,
- params: {...params, ...options?.params},}
- );
+ params: { ...params, ...options?.params },
+ });
+};
+
+export const getGetDocumentsQueryKey = (params?: GetDocumentsParams) => {
+ return [`/api/v1/documents`, ...(params ? [params] : [])] as const;
+};
+
+export const getGetDocumentsQueryOptions = <
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ params?: GetDocumentsParams,
+ options?: {
+ query?: Partial>, TError, TData>>;
+ axios?: AxiosRequestConfig;
}
-
-
-
-
-export const getGetDocumentsQueryKey = (params?: GetDocumentsParams,) => {
- return [
- `/api/v1/documents`, ...(params ? [params]: [])
- ] as const;
- }
-
-
-export const getGetDocumentsQueryOptions = >, TError = AxiosError>(params?: GetDocumentsParams, options?: { query?:Partial>, TError, TData>>, axios?: AxiosRequestConfig}
) => {
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
-const {query: queryOptions, axios: axiosOptions} = options ?? {};
+ const queryKey = queryOptions?.queryKey ?? getGetDocumentsQueryKey(params);
- const queryKey = queryOptions?.queryKey ?? getGetDocumentsQueryKey(params);
+ const queryFn: QueryFunction>> = ({ signal }) =>
+ getDocuments(params, { signal, ...axiosOptions });
-
+ return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ > & { queryKey: DataTag };
+};
- const queryFn: QueryFunction>> = ({ signal }) => getDocuments(params, { signal, ...axiosOptions });
+export type GetDocumentsQueryResult = NonNullable>>;
+export type GetDocumentsQueryError = AxiosError;
-
-
-
-
- return { queryKey, queryFn, ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: DataTag }
-}
-
-export type GetDocumentsQueryResult = NonNullable>>
-export type GetDocumentsQueryError = AxiosError
-
-
-export function useGetDocuments>, TError = AxiosError>(
- params: undefined | GetDocumentsParams, options: { query:Partial>, TError, TData>> & Pick<
+export function useGetDocuments<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ params: undefined | GetDocumentsParams,
+ options: {
+ query: Partial>, TError, TData>> &
+ Pick<
DefinedInitialDataOptions<
Awaited>,
TError,
Awaited>
- > , 'initialData'
- >, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): DefinedUseQueryResult & { queryKey: DataTag }
-export function useGetDocuments>, TError = AxiosError>(
- params?: GetDocumentsParams, options?: { query?:Partial>, TError, TData>> & Pick<
+ >,
+ 'initialData'
+ >;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): DefinedUseQueryResult & { queryKey: DataTag };
+export function useGetDocuments<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ params?: GetDocumentsParams,
+ options?: {
+ query?: Partial>, TError, TData>> &
+ Pick<
UndefinedInitialDataOptions<
Awaited>,
TError,
Awaited>
- > , 'initialData'
- >, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): UseQueryResult & { queryKey: DataTag }
-export function useGetDocuments>, TError = AxiosError>(
- params?: GetDocumentsParams, options?: { query?:Partial>, TError, TData>>, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): UseQueryResult & { queryKey: DataTag }
+ >,
+ 'initialData'
+ >;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): UseQueryResult & { queryKey: DataTag };
+export function useGetDocuments<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ params?: GetDocumentsParams,
+ options?: {
+ query?: Partial>, TError, TData>>;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): UseQueryResult & { queryKey: DataTag };
/**
* @summary List documents
*/
-export function useGetDocuments>, TError = AxiosError>(
- params?: GetDocumentsParams, options?: { query?:Partial>, TError, TData>>, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): UseQueryResult & { queryKey: DataTag } {
+export function useGetDocuments<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ params?: GetDocumentsParams,
+ options?: {
+ query?: Partial>, TError, TData>>;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): UseQueryResult & { queryKey: DataTag } {
+ const queryOptions = getGetDocumentsQueryOptions(params, options);
- const queryOptions = getGetDocumentsQueryOptions(params,options)
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult & {
+ queryKey: DataTag;
+ };
- const query = useQuery(queryOptions, queryClient) as UseQueryResult & { queryKey: DataTag };
-
- query.queryKey = queryOptions.queryKey ;
+ query.queryKey = queryOptions.queryKey;
return query;
}
-
-
-
-
/**
* @summary Upload a new document
*/
export const createDocument = (
- createDocumentBody: CreateDocumentBody, options?: AxiosRequestConfig
- ): Promise> => {
-
- const formData = new FormData();
-formData.append(`document_file`, createDocumentBody.document_file)
+ createDocumentBody: CreateDocumentBody,
+ options?: AxiosRequestConfig
+): Promise> => {
+ const formData = new FormData();
+ formData.append(`document_file`, createDocumentBody.document_file);
- return axios.default.post(
- `/api/v1/documents`,
- formData,options
- );
- }
+ return axios.default.post(`/api/v1/documents`, formData, options);
+};
+export const getCreateDocumentMutationOptions = <
+ TError = AxiosError,
+ TContext = unknown,
+>(options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ { data: CreateDocumentBody },
+ TContext
+ >;
+ axios?: AxiosRequestConfig;
+}): UseMutationOptions<
+ Awaited>,
+ TError,
+ { data: CreateDocumentBody },
+ TContext
+> => {
+ const mutationKey = ['createDocument'];
+ const { mutation: mutationOptions, axios: axiosOptions } = options
+ ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey
+ ? options
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
+ : { mutation: { mutationKey }, axios: undefined };
+ const mutationFn: MutationFunction<
+ Awaited>,
+ { data: CreateDocumentBody }
+ > = props => {
+ const { data } = props ?? {};
-export const getCreateDocumentMutationOptions = ,
- TContext = unknown>(options?: { mutation?:UseMutationOptions>, TError,{data: CreateDocumentBody}, TContext>, axios?: AxiosRequestConfig}
-): UseMutationOptions>, TError,{data: CreateDocumentBody}, TContext> => {
+ return createDocument(data, axiosOptions);
+ };
-const mutationKey = ['createDocument'];
-const {mutation: mutationOptions, axios: axiosOptions} = options ?
- options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
- options
- : {...options, mutation: {...options.mutation, mutationKey}}
- : {mutation: { mutationKey, }, axios: undefined};
+ return { mutationFn, ...mutationOptions };
+};
-
+export type CreateDocumentMutationResult = NonNullable>>;
+export type CreateDocumentMutationBody = CreateDocumentBody;
+export type CreateDocumentMutationError = AxiosError;
-
- const mutationFn: MutationFunction>, {data: CreateDocumentBody}> = (props) => {
- const {data} = props ?? {};
-
- return createDocument(data,axiosOptions)
- }
-
-
-
-
- return { mutationFn, ...mutationOptions }}
-
- export type CreateDocumentMutationResult = NonNullable>>
- export type CreateDocumentMutationBody = CreateDocumentBody
- export type CreateDocumentMutationError = AxiosError
-
- /**
+/**
* @summary Upload a new document
*/
-export const useCreateDocument = ,
- TContext = unknown>(options?: { mutation?:UseMutationOptions>, TError,{data: CreateDocumentBody}, TContext>, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient): UseMutationResult<
- Awaited>,
- TError,
- {data: CreateDocumentBody},
- TContext
- > => {
+export const useCreateDocument = , TContext = unknown>(
+ options?: {
+ mutation?: UseMutationOptions<
+ Awaited>,
+ TError,
+ { data: CreateDocumentBody },
+ TContext
+ >;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): UseMutationResult<
+ Awaited>,
+ TError,
+ { data: CreateDocumentBody },
+ TContext
+> => {
+ const mutationOptions = getCreateDocumentMutationOptions(options);
- const mutationOptions = getCreateDocumentMutationOptions(options);
+ return useMutation(mutationOptions, queryClient);
+};
- return useMutation(mutationOptions, queryClient);
- }
-
/**
* @summary Get a single document
*/
export const getDocument = (
- id: string, options?: AxiosRequestConfig
- ): Promise> => {
-
-
- return axios.default.get(
- `/api/v1/documents/${id}`,options
- );
+ id: string,
+ options?: AxiosRequestConfig
+): Promise> => {
+ return axios.default.get(`/api/v1/documents/${id}`, options);
+};
+
+export const getGetDocumentQueryKey = (id?: string) => {
+ return [`/api/v1/documents/${id}`] as const;
+};
+
+export const getGetDocumentQueryOptions = <
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ id: string,
+ options?: {
+ query?: Partial>, TError, TData>>;
+ axios?: AxiosRequestConfig;
}
-
-
-
-
-export const getGetDocumentQueryKey = (id?: string,) => {
- return [
- `/api/v1/documents/${id}`
- ] as const;
- }
-
-
-export const getGetDocumentQueryOptions = >, TError = AxiosError>(id: string, options?: { query?:Partial>, TError, TData>>, axios?: AxiosRequestConfig}
) => {
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
-const {query: queryOptions, axios: axiosOptions} = options ?? {};
+ const queryKey = queryOptions?.queryKey ?? getGetDocumentQueryKey(id);
- const queryKey = queryOptions?.queryKey ?? getGetDocumentQueryKey(id);
+ const queryFn: QueryFunction>> = ({ signal }) =>
+ getDocument(id, { signal, ...axiosOptions });
-
+ return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ > & { queryKey: DataTag };
+};
- const queryFn: QueryFunction>> = ({ signal }) => getDocument(id, { signal, ...axiosOptions });
+export type GetDocumentQueryResult = NonNullable>>;
+export type GetDocumentQueryError = AxiosError;
-
-
-
-
- return { queryKey, queryFn, enabled: !!(id), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: DataTag }
-}
-
-export type GetDocumentQueryResult = NonNullable>>
-export type GetDocumentQueryError = AxiosError
-
-
-export function useGetDocument>, TError = AxiosError>(
- id: string, options: { query:Partial>, TError, TData>> & Pick<
+export function useGetDocument<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ id: string,
+ options: {
+ query: Partial>, TError, TData>> &
+ Pick<
DefinedInitialDataOptions<
Awaited>,
TError,
Awaited>
- > , 'initialData'
- >, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): DefinedUseQueryResult & { queryKey: DataTag }
-export function useGetDocument>, TError = AxiosError>(
- id: string, options?: { query?:Partial>, TError, TData>> & Pick<
+ >,
+ 'initialData'
+ >;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): DefinedUseQueryResult & { queryKey: DataTag };
+export function useGetDocument<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ id: string,
+ options?: {
+ query?: Partial>, TError, TData>> &
+ Pick<
UndefinedInitialDataOptions<
Awaited>,
TError,
Awaited>
- > , 'initialData'
- >, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): UseQueryResult & { queryKey: DataTag }
-export function useGetDocument>, TError = AxiosError>(
- id: string, options?: { query?:Partial>, TError, TData>>, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): UseQueryResult & { queryKey: DataTag }
+ >,
+ 'initialData'
+ >;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): UseQueryResult & { queryKey: DataTag };
+export function useGetDocument<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ id: string,
+ options?: {
+ query?: Partial>, TError, TData>>;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): UseQueryResult & { queryKey: DataTag };
/**
* @summary Get a single document
*/
-export function useGetDocument>, TError = AxiosError>(
- id: string, options?: { query?:Partial>, TError, TData>>, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): UseQueryResult & { queryKey: DataTag } {
+export function useGetDocument<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ id: string,
+ options?: {
+ query?: Partial>, TError, TData>>;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): UseQueryResult & { queryKey: DataTag } {
+ const queryOptions = getGetDocumentQueryOptions(id, options);
- const queryOptions = getGetDocumentQueryOptions(id,options)
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult & {
+ queryKey: DataTag;
+ };
- const query = useQuery(queryOptions, queryClient) as UseQueryResult & { queryKey: DataTag };
-
- query.queryKey = queryOptions.queryKey ;
+ query.queryKey = queryOptions.queryKey;
return query;
}
-
-
-
-
/**
* @summary List progress records
*/
export const getProgressList = (
- params?: GetProgressListParams, options?: AxiosRequestConfig
- ): Promise> => {
-
-
- return axios.default.get(
- `/api/v1/progress`,{
+ params?: GetProgressListParams,
+ options?: AxiosRequestConfig
+): Promise> => {
+ return axios.default.get(`/api/v1/progress`, {
...options,
- params: {...params, ...options?.params},}
- );
+ params: { ...params, ...options?.params },
+ });
+};
+
+export const getGetProgressListQueryKey = (params?: GetProgressListParams) => {
+ return [`/api/v1/progress`, ...(params ? [params] : [])] as const;
+};
+
+export const getGetProgressListQueryOptions = <
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ params?: GetProgressListParams,
+ options?: {
+ query?: Partial>, TError, TData>>;
+ axios?: AxiosRequestConfig;
}
-
-
-
-
-export const getGetProgressListQueryKey = (params?: GetProgressListParams,) => {
- return [
- `/api/v1/progress`, ...(params ? [params]: [])
- ] as const;
- }
-
-
-export const getGetProgressListQueryOptions = >, TError = AxiosError>(params?: GetProgressListParams, options?: { query?:Partial>, TError, TData>>, axios?: AxiosRequestConfig}
) => {
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
-const {query: queryOptions, axios: axiosOptions} = options ?? {};
+ const queryKey = queryOptions?.queryKey ?? getGetProgressListQueryKey(params);
- const queryKey = queryOptions?.queryKey ?? getGetProgressListQueryKey(params);
+ const queryFn: QueryFunction>> = ({ signal }) =>
+ getProgressList(params, { signal, ...axiosOptions });
-
+ return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ > & { queryKey: DataTag };
+};
- const queryFn: QueryFunction>> = ({ signal }) => getProgressList(params, { signal, ...axiosOptions });
+export type GetProgressListQueryResult = NonNullable>>;
+export type GetProgressListQueryError = AxiosError;
-
-
-
-
- return { queryKey, queryFn, ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: DataTag }
-}
-
-export type GetProgressListQueryResult = NonNullable>>
-export type GetProgressListQueryError = AxiosError
-
-
-export function useGetProgressList>, TError = AxiosError>(
- params: undefined | GetProgressListParams, options: { query:Partial>, TError, TData>> & Pick<
+export function useGetProgressList<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ params: undefined | GetProgressListParams,
+ options: {
+ query: Partial>, TError, TData>> &
+ Pick<
DefinedInitialDataOptions<
Awaited>,
TError,
Awaited>
- > , 'initialData'
- >, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): DefinedUseQueryResult & { queryKey: DataTag }
-export function useGetProgressList>, TError = AxiosError>(
- params?: GetProgressListParams, options?: { query?:Partial>, TError, TData>> & Pick<
+ >,
+ 'initialData'
+ >;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): DefinedUseQueryResult & { queryKey: DataTag };
+export function useGetProgressList<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ params?: GetProgressListParams,
+ options?: {
+ query?: Partial>, TError, TData>> &
+ Pick<
UndefinedInitialDataOptions<
Awaited>,
TError,
Awaited>
- > , 'initialData'
- >, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): UseQueryResult & { queryKey: DataTag }
-export function useGetProgressList>, TError = AxiosError>(
- params?: GetProgressListParams, options?: { query?:Partial>, TError, TData>>, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): UseQueryResult & { queryKey: DataTag }
+ >,
+ 'initialData'
+ >;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): UseQueryResult & { queryKey: DataTag };
+export function useGetProgressList<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ params?: GetProgressListParams,
+ options?: {
+ query?: Partial>, TError, TData>>;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): UseQueryResult & { queryKey: DataTag };
/**
* @summary List progress records
*/
-export function useGetProgressList>, TError = AxiosError>(
- params?: GetProgressListParams, options?: { query?:Partial>, TError, TData>>, axios?: AxiosRequestConfig}
- , queryClient?: QueryClient
- ): UseQueryResult & { queryKey: DataTag } {
+export function useGetProgressList<
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ params?: GetProgressListParams,
+ options?: {
+ query?: Partial>, TError, TData>>;
+ axios?: AxiosRequestConfig;
+ },
+ queryClient?: QueryClient
+): UseQueryResult & { queryKey: DataTag } {
+ const queryOptions = getGetProgressListQueryOptions(params, options);
- const queryOptions = getGetProgressListQueryOptions(params,options)
+ const query = useQuery(queryOptions, queryClient) as UseQueryResult & {
+ queryKey: DataTag;
+ };
- const query = useQuery(queryOptions, queryClient) as UseQueryResult & { queryKey: DataTag };
-
- query.queryKey = queryOptions.queryKey ;
+ query.queryKey = queryOptions.queryKey;
return query;
}
-
-
-
-
/**
* @summary Get document progress
*/
export const getProgress = (
- id: string, options?: AxiosRequestConfig
- ): Promise> => {
-
-
- return axios.default.get(
- `/api/v1/progress/${id}`,options
- );
+ id: string,
+ options?: AxiosRequestConfig
+): Promise> => {
+ return axios.default.get(`/api/v1/progress/${id}`, options);
+};
+
+export const getGetProgressQueryKey = (id?: string) => {
+ return [`/api/v1/progress/${id}`] as const;
+};
+
+export const getGetProgressQueryOptions = <
+ TData = Awaited>,
+ TError = AxiosError,
+>(
+ id: string,
+ options?: {
+ query?: Partial>, TError, TData>>;
+ axios?: AxiosRequestConfig;
}
-
-
-
-
-export const getGetProgressQueryKey = (id?: string,) => {
- return [
- `/api/v1/progress/${id}`
- ] as const;
- }
-
-
-export const getGetProgressQueryOptions = >, TError = AxiosError>(id: string, options?: { query?:Partial>, TError, TData>>, axios?: AxiosRequestConfig}
) => {
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
-const {query: queryOptions, axios: axiosOptions} = options ?? {};
+ const queryKey = queryOptions?.queryKey ?? getGetProgressQueryKey(id);
- const queryKey = queryOptions?.queryKey ?? getGetProgressQueryKey(id);
+ const queryFn: QueryFunction>> = ({ signal }) =>
+ getProgress(id, { signal, ...axiosOptions });
-
+ return { queryKey, queryFn, enabled: !!id, ...queryOptions } as UseQueryOptions<
+ Awaited>,
+ TError,
+ TData
+ > & { queryKey: DataTag };
+};
- const queryFn: QueryFunction>> = ({ signal }) => getProgress(id, { signal, ...axiosOptions });
+export type GetProgressQueryResult = NonNullable>>;
+export type GetProgressQueryError = AxiosError