Commit edbc9f87 authored by Lê Bảo Hồng Đức's avatar Lê Bảo Hồng Đức

fix api

parent b6c2eab7
...@@ -76,6 +76,10 @@ const orvalConfig = async () => { ...@@ -76,6 +76,10 @@ const orvalConfig = async () => {
client: "react-query", client: "react-query",
prettier: true, prettier: true,
override: { override: {
mutator: {
path: "src/api/mutator/custom-client.ts",
name: "useCustomClient",
},
query: { query: {
useQuery: true, useQuery: true,
useInfinite: true, useInfinite: true,
......
...@@ -10,10 +10,12 @@ import { QueryData } from '@/lib/types/base-api' ...@@ -10,10 +10,12 @@ import { QueryData } from '@/lib/types/base-api'
// import { BASE_PATHS } from '@/constants/path' // import { BASE_PATHS } from '@/constants/path'
// Constants // Constants
const RETRY_COUNT = 3 const RETRY_COUNT = 3
const EXPIRED_TOKEN_ERROR = 401 const EXPIRED_TOKEN_ERROR = 401
const DENIED_PERMISSION_ERROR = 403 const DENIED_PERMISSION_ERROR = 403
const INTERNAL_SERVER_ERROR = 500 const INTERNAL_SERVER_ERROR = 500
const API_QUERY_STALE_TIME = 2 * 60 * 1000
const API_QUERY_GC_TIME = 10 * 60 * 1000
// Utils // Utils
// Handle check base retry logical // Handle check base retry logical
...@@ -56,9 +58,13 @@ const handleDelayRetry = (failureCount: number) => failureCount * 1000 + Math.ra ...@@ -56,9 +58,13 @@ const handleDelayRetry = (failureCount: number) => failureCount * 1000 + Math.ra
// Query client // Query client
export const queryClient = new QueryClient({ export const queryClient = new QueryClient({
defaultOptions: { defaultOptions: {
queries: { queries: {
refetchOnWindowFocus: false, staleTime: API_QUERY_STALE_TIME,
placeholderData: (previousData: unknown) => previousData, gcTime: API_QUERY_GC_TIME,
refetchOnWindowFocus: false,
refetchOnMount: false,
refetchOnReconnect: false,
placeholderData: (previousData: unknown) => previousData,
retry(failureCount, error) { retry(failureCount, error) {
if (!handleCheckBaseRetryLogical(failureCount, error)) return false if (!handleCheckBaseRetryLogical(failureCount, error)) return false
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
...@@ -31,11 +31,11 @@ import type { ...@@ -31,11 +31,11 @@ import type {
import type { import type {
CategoryMutate, CategoryMutate,
DeleteCategoryId200, DeleteApiV10CategoryId200,
GetCategoryId200, GetApiV10CategoryId200,
GetCategoryParams, GetApiV10CategoryParams,
PostCategory200, PostApiV10Category200,
PutCategoryId200, PutApiV10CategoryId200,
ResponseGetAllData ResponseGetAllData
} from '../models'; } from '../models';
...@@ -48,36 +48,36 @@ import type { ...@@ -48,36 +48,36 @@ import type {
* Retrieve a single category record by its ID * Retrieve a single category record by its ID
* @summary Get category by ID * @summary Get category by ID
*/ */
export type getCategoryIdResponse200 = { export type getApiV10CategoryIdResponse200 = {
data: GetCategoryId200 data: GetApiV10CategoryId200
status: 200 status: 200
} }
export type getCategoryIdResponse404 = { export type getApiV10CategoryIdResponse404 = {
data: void data: void
status: 404 status: 404
} }
export type getCategoryIdResponseSuccess = (getCategoryIdResponse200) & { export type getApiV10CategoryIdResponseSuccess = (getApiV10CategoryIdResponse200) & {
headers: Headers; headers: Headers;
}; };
export type getCategoryIdResponseError = (getCategoryIdResponse404) & { export type getApiV10CategoryIdResponseError = (getApiV10CategoryIdResponse404) & {
headers: Headers; headers: Headers;
}; };
export type getCategoryIdResponse = (getCategoryIdResponseSuccess | getCategoryIdResponseError) export type getApiV10CategoryIdResponse = (getApiV10CategoryIdResponseSuccess | getApiV10CategoryIdResponseError)
export const getGetCategoryIdUrl = (id: string,) => { export const getGetApiV10CategoryIdUrl = (id: string,) => {
return `/category/${id}` return `/api/v1.0/category/${id}`
} }
export const getCategoryId = async (id: string, options?: RequestInit): Promise<getCategoryIdResponse> => { export const getApiV10CategoryId = async (id: string, options?: RequestInit): Promise<getApiV10CategoryIdResponse> => {
const res = await fetch(getGetCategoryIdUrl(id), const res = await fetch(getGetApiV10CategoryIdUrl(id),
{ {
...options, ...options,
method: 'GET' method: 'GET'
...@@ -88,83 +88,83 @@ export const getCategoryId = async (id: string, options?: RequestInit): Promise< ...@@ -88,83 +88,83 @@ export const getCategoryId = async (id: string, options?: RequestInit): Promise<
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getCategoryIdResponse['data'] = body ? JSON.parse(body) : {} const data: getApiV10CategoryIdResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as getCategoryIdResponse return { data, status: res.status, headers: res.headers } as getApiV10CategoryIdResponse
} }
export const getGetCategoryIdInfiniteQueryKey = (id?: string,) => { export const getGetApiV10CategoryIdInfiniteQueryKey = (id?: string,) => {
return [ return [
'infinite', `/category/${id}` 'infinite', `/api/v1.0/category/${id}`
] as const; ] as const;
} }
export const getGetCategoryIdQueryKey = (id?: string,) => { export const getGetApiV10CategoryIdQueryKey = (id?: string,) => {
return [ return [
`/category/${id}` `/api/v1.0/category/${id}`
] as const; ] as const;
} }
export const getGetCategoryIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getCategoryId>>>, TError = void>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10CategoryIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getApiV10CategoryId>>>, TError = void>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetCategoryIdInfiniteQueryKey(id); const queryKey = queryOptions?.queryKey ?? getGetApiV10CategoryIdInfiniteQueryKey(id);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getCategoryId>>> = ({ signal }) => getCategoryId(id, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10CategoryId>>> = ({ signal }) => getApiV10CategoryId(id, { signal, ...fetchOptions });
return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetCategoryIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getCategoryId>>> export type GetApiV10CategoryIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10CategoryId>>>
export type GetCategoryIdInfiniteQueryError = void export type GetApiV10CategoryIdInfiniteQueryError = void
export function useGetCategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategoryId>>>, TError = void>( export function useGetApiV10CategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10CategoryId>>>, TError = void>(
id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>> & Pick< id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getCategoryId>>, Awaited<ReturnType<typeof getApiV10CategoryId>>,
TError, TError,
Awaited<ReturnType<typeof getCategoryId>> Awaited<ReturnType<typeof getApiV10CategoryId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategoryId>>>, TError = void>( export function useGetApiV10CategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10CategoryId>>>, TError = void>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>> & Pick< id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getCategoryId>>, Awaited<ReturnType<typeof getApiV10CategoryId>>,
TError, TError,
Awaited<ReturnType<typeof getCategoryId>> Awaited<ReturnType<typeof getApiV10CategoryId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategoryId>>>, TError = void>( export function useGetApiV10CategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10CategoryId>>>, TError = void>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get category by ID * @summary Get category by ID
*/ */
export function useGetCategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategoryId>>>, TError = void>( export function useGetApiV10CategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10CategoryId>>>, TError = void>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetCategoryIdInfiniteQueryOptions(id,options) const queryOptions = getGetApiV10CategoryIdInfiniteQueryOptions(id,options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -176,12 +176,12 @@ export function useGetCategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType ...@@ -176,12 +176,12 @@ export function useGetCategoryIdInfinite<TData = InfiniteData<Awaited<ReturnType
/** /**
* @summary Get category by ID * @summary Get category by ID
*/ */
export const prefetchGetCategoryIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>( export const prefetchGetApiV10CategoryIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetCategoryIdInfiniteQueryOptions(id,options) const queryOptions = getGetApiV10CategoryIdInfiniteQueryOptions(id,options)
await queryClient.prefetchInfiniteQuery(queryOptions); await queryClient.prefetchInfiniteQuery(queryOptions);
...@@ -190,62 +190,62 @@ export const prefetchGetCategoryIdInfiniteQuery = async <TData = Awaited<ReturnT ...@@ -190,62 +190,62 @@ export const prefetchGetCategoryIdInfiniteQuery = async <TData = Awaited<ReturnT
export const getGetCategoryIdQueryOptions = <TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10CategoryIdQueryOptions = <TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetCategoryIdQueryKey(id); const queryKey = queryOptions?.queryKey ?? getGetApiV10CategoryIdQueryKey(id);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getCategoryId>>> = ({ signal }) => getCategoryId(id, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10CategoryId>>> = ({ signal }) => getApiV10CategoryId(id, { signal, ...fetchOptions });
return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetCategoryIdQueryResult = NonNullable<Awaited<ReturnType<typeof getCategoryId>>> export type GetApiV10CategoryIdQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10CategoryId>>>
export type GetCategoryIdQueryError = void export type GetApiV10CategoryIdQueryError = void
export function useGetCategoryId<TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>( export function useGetApiV10CategoryId<TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>> & Pick< id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getCategoryId>>, Awaited<ReturnType<typeof getApiV10CategoryId>>,
TError, TError,
Awaited<ReturnType<typeof getCategoryId>> Awaited<ReturnType<typeof getApiV10CategoryId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryId<TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>( export function useGetApiV10CategoryId<TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>> & Pick< id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getCategoryId>>, Awaited<ReturnType<typeof getApiV10CategoryId>>,
TError, TError,
Awaited<ReturnType<typeof getCategoryId>> Awaited<ReturnType<typeof getApiV10CategoryId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryId<TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>( export function useGetApiV10CategoryId<TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get category by ID * @summary Get category by ID
*/ */
export function useGetCategoryId<TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>( export function useGetApiV10CategoryId<TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetCategoryIdQueryOptions(id,options) const queryOptions = getGetApiV10CategoryIdQueryOptions(id,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -257,12 +257,12 @@ export function useGetCategoryId<TData = Awaited<ReturnType<typeof getCategoryId ...@@ -257,12 +257,12 @@ export function useGetCategoryId<TData = Awaited<ReturnType<typeof getCategoryId
/** /**
* @summary Get category by ID * @summary Get category by ID
*/ */
export const prefetchGetCategoryIdQuery = async <TData = Awaited<ReturnType<typeof getCategoryId>>, TError = void>( export const prefetchGetApiV10CategoryIdQuery = async <TData = Awaited<ReturnType<typeof getApiV10CategoryId>>, TError = void>(
queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategoryId>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10CategoryId>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetCategoryIdQueryOptions(id,options) const queryOptions = getGetApiV10CategoryIdQueryOptions(id,options)
await queryClient.prefetchQuery(queryOptions); await queryClient.prefetchQuery(queryOptions);
...@@ -275,37 +275,37 @@ export const prefetchGetCategoryIdQuery = async <TData = Awaited<ReturnType<type ...@@ -275,37 +275,37 @@ export const prefetchGetCategoryIdQuery = async <TData = Awaited<ReturnType<type
* Update a single category record by its ID * Update a single category record by its ID
* @summary Update category by ID * @summary Update category by ID
*/ */
export type putCategoryIdResponse200 = { export type putApiV10CategoryIdResponse200 = {
data: PutCategoryId200 data: PutApiV10CategoryId200
status: 200 status: 200
} }
export type putCategoryIdResponse404 = { export type putApiV10CategoryIdResponse404 = {
data: void data: void
status: 404 status: 404
} }
export type putCategoryIdResponseSuccess = (putCategoryIdResponse200) & { export type putApiV10CategoryIdResponseSuccess = (putApiV10CategoryIdResponse200) & {
headers: Headers; headers: Headers;
}; };
export type putCategoryIdResponseError = (putCategoryIdResponse404) & { export type putApiV10CategoryIdResponseError = (putApiV10CategoryIdResponse404) & {
headers: Headers; headers: Headers;
}; };
export type putCategoryIdResponse = (putCategoryIdResponseSuccess | putCategoryIdResponseError) export type putApiV10CategoryIdResponse = (putApiV10CategoryIdResponseSuccess | putApiV10CategoryIdResponseError)
export const getPutCategoryIdUrl = (id: string,) => { export const getPutApiV10CategoryIdUrl = (id: string,) => {
return `/category/${id}` return `/api/v1.0/category/${id}`
} }
export const putCategoryId = async (id: string, export const putApiV10CategoryId = async (id: string,
categoryMutate: CategoryMutate, options?: RequestInit): Promise<putCategoryIdResponse> => { categoryMutate: CategoryMutate, options?: RequestInit): Promise<putApiV10CategoryIdResponse> => {
const res = await fetch(getPutCategoryIdUrl(id), const res = await fetch(getPutApiV10CategoryIdUrl(id),
{ {
...options, ...options,
method: 'PUT', method: 'PUT',
...@@ -317,18 +317,18 @@ export const putCategoryId = async (id: string, ...@@ -317,18 +317,18 @@ export const putCategoryId = async (id: string,
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: putCategoryIdResponse['data'] = body ? JSON.parse(body) : {} const data: putApiV10CategoryIdResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as putCategoryIdResponse return { data, status: res.status, headers: res.headers } as putApiV10CategoryIdResponse
} }
export const getPutCategoryIdMutationOptions = <TError = void, export const getPutApiV10CategoryIdMutationOptions = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putCategoryId>>, TError,{id: string;data: CategoryMutate}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putApiV10CategoryId>>, TError,{id: string;data: CategoryMutate}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof putCategoryId>>, TError,{id: string;data: CategoryMutate}, TContext> => { ): UseMutationOptions<Awaited<ReturnType<typeof putApiV10CategoryId>>, TError,{id: string;data: CategoryMutate}, TContext> => {
const mutationKey = ['putCategoryId']; const mutationKey = ['putApiV10CategoryId'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ? const {mutation: mutationOptions, fetch: fetchOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options options
...@@ -338,10 +338,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -338,10 +338,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
const mutationFn: MutationFunction<Awaited<ReturnType<typeof putCategoryId>>, {id: string;data: CategoryMutate}> = (props) => { const mutationFn: MutationFunction<Awaited<ReturnType<typeof putApiV10CategoryId>>, {id: string;data: CategoryMutate}> = (props) => {
const {id,data} = props ?? {}; const {id,data} = props ?? {};
return putCategoryId(id,data,fetchOptions) return putApiV10CategoryId(id,data,fetchOptions)
} }
...@@ -349,23 +349,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -349,23 +349,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
return { mutationFn, ...mutationOptions }} return { mutationFn, ...mutationOptions }}
export type PutCategoryIdMutationResult = NonNullable<Awaited<ReturnType<typeof putCategoryId>>> export type PutApiV10CategoryIdMutationResult = NonNullable<Awaited<ReturnType<typeof putApiV10CategoryId>>>
export type PutCategoryIdMutationBody = CategoryMutate export type PutApiV10CategoryIdMutationBody = CategoryMutate
export type PutCategoryIdMutationError = void export type PutApiV10CategoryIdMutationError = void
/** /**
* @summary Update category by ID * @summary Update category by ID
*/ */
export const usePutCategoryId = <TError = void, export const usePutApiV10CategoryId = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putCategoryId>>, TError,{id: string;data: CategoryMutate}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putApiV10CategoryId>>, TError,{id: string;data: CategoryMutate}, TContext>, fetch?: RequestInit}
, queryClient?: QueryClient): UseMutationResult< , queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof putCategoryId>>, Awaited<ReturnType<typeof putApiV10CategoryId>>,
TError, TError,
{id: string;data: CategoryMutate}, {id: string;data: CategoryMutate},
TContext TContext
> => { > => {
const mutationOptions = getPutCategoryIdMutationOptions(options); const mutationOptions = getPutApiV10CategoryIdMutationOptions(options);
return useMutation(mutationOptions, queryClient); return useMutation(mutationOptions, queryClient);
} }
...@@ -373,36 +373,36 @@ export const usePutCategoryId = <TError = void, ...@@ -373,36 +373,36 @@ export const usePutCategoryId = <TError = void,
* Delete a single category record by its ID * Delete a single category record by its ID
* @summary Delete category by ID * @summary Delete category by ID
*/ */
export type deleteCategoryIdResponse200 = { export type deleteApiV10CategoryIdResponse200 = {
data: DeleteCategoryId200 data: DeleteApiV10CategoryId200
status: 200 status: 200
} }
export type deleteCategoryIdResponse404 = { export type deleteApiV10CategoryIdResponse404 = {
data: void data: void
status: 404 status: 404
} }
export type deleteCategoryIdResponseSuccess = (deleteCategoryIdResponse200) & { export type deleteApiV10CategoryIdResponseSuccess = (deleteApiV10CategoryIdResponse200) & {
headers: Headers; headers: Headers;
}; };
export type deleteCategoryIdResponseError = (deleteCategoryIdResponse404) & { export type deleteApiV10CategoryIdResponseError = (deleteApiV10CategoryIdResponse404) & {
headers: Headers; headers: Headers;
}; };
export type deleteCategoryIdResponse = (deleteCategoryIdResponseSuccess | deleteCategoryIdResponseError) export type deleteApiV10CategoryIdResponse = (deleteApiV10CategoryIdResponseSuccess | deleteApiV10CategoryIdResponseError)
export const getDeleteCategoryIdUrl = (id: string,) => { export const getDeleteApiV10CategoryIdUrl = (id: string,) => {
return `/category/${id}` return `/api/v1.0/category/${id}`
} }
export const deleteCategoryId = async (id: string, options?: RequestInit): Promise<deleteCategoryIdResponse> => { export const deleteApiV10CategoryId = async (id: string, options?: RequestInit): Promise<deleteApiV10CategoryIdResponse> => {
const res = await fetch(getDeleteCategoryIdUrl(id), const res = await fetch(getDeleteApiV10CategoryIdUrl(id),
{ {
...options, ...options,
method: 'DELETE' method: 'DELETE'
...@@ -413,18 +413,18 @@ export const deleteCategoryId = async (id: string, options?: RequestInit): Promi ...@@ -413,18 +413,18 @@ export const deleteCategoryId = async (id: string, options?: RequestInit): Promi
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: deleteCategoryIdResponse['data'] = body ? JSON.parse(body) : {} const data: deleteApiV10CategoryIdResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as deleteCategoryIdResponse return { data, status: res.status, headers: res.headers } as deleteApiV10CategoryIdResponse
} }
export const getDeleteCategoryIdMutationOptions = <TError = void, export const getDeleteApiV10CategoryIdMutationOptions = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteCategoryId>>, TError,{id: string}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10CategoryId>>, TError,{id: string}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof deleteCategoryId>>, TError,{id: string}, TContext> => { ): UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10CategoryId>>, TError,{id: string}, TContext> => {
const mutationKey = ['deleteCategoryId']; const mutationKey = ['deleteApiV10CategoryId'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ? const {mutation: mutationOptions, fetch: fetchOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options options
...@@ -434,10 +434,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -434,10 +434,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteCategoryId>>, {id: string}> = (props) => { const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteApiV10CategoryId>>, {id: string}> = (props) => {
const {id} = props ?? {}; const {id} = props ?? {};
return deleteCategoryId(id,fetchOptions) return deleteApiV10CategoryId(id,fetchOptions)
} }
...@@ -445,23 +445,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -445,23 +445,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
return { mutationFn, ...mutationOptions }} return { mutationFn, ...mutationOptions }}
export type DeleteCategoryIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteCategoryId>>> export type DeleteApiV10CategoryIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteApiV10CategoryId>>>
export type DeleteCategoryIdMutationError = void export type DeleteApiV10CategoryIdMutationError = void
/** /**
* @summary Delete category by ID * @summary Delete category by ID
*/ */
export const useDeleteCategoryId = <TError = void, export const useDeleteApiV10CategoryId = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteCategoryId>>, TError,{id: string}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10CategoryId>>, TError,{id: string}, TContext>, fetch?: RequestInit}
, queryClient?: QueryClient): UseMutationResult< , queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof deleteCategoryId>>, Awaited<ReturnType<typeof deleteApiV10CategoryId>>,
TError, TError,
{id: string}, {id: string},
TContext TContext
> => { > => {
const mutationOptions = getDeleteCategoryIdMutationOptions(options); const mutationOptions = getDeleteApiV10CategoryIdMutationOptions(options);
return useMutation(mutationOptions, queryClient); return useMutation(mutationOptions, queryClient);
} }
...@@ -469,19 +469,19 @@ export const useDeleteCategoryId = <TError = void, ...@@ -469,19 +469,19 @@ export const useDeleteCategoryId = <TError = void,
* Retrieve a list of category with pagination, filtering and sorting * Retrieve a list of category with pagination, filtering and sorting
* @summary Get all category * @summary Get all category
*/ */
export type getCategoryResponse200 = { export type getApiV10CategoryResponse200 = {
data: ResponseGetAllData data: ResponseGetAllData
status: 200 status: 200
} }
export type getCategoryResponseSuccess = (getCategoryResponse200) & { export type getApiV10CategoryResponseSuccess = (getApiV10CategoryResponse200) & {
headers: Headers; headers: Headers;
}; };
; ;
export type getCategoryResponse = (getCategoryResponseSuccess) export type getApiV10CategoryResponse = (getApiV10CategoryResponseSuccess)
export const getGetCategoryUrl = (params?: GetCategoryParams,) => { export const getGetApiV10CategoryUrl = (params?: GetApiV10CategoryParams,) => {
const normalizedParams = new URLSearchParams(); const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => { Object.entries(params || {}).forEach(([key, value]) => {
...@@ -493,12 +493,12 @@ export const getGetCategoryUrl = (params?: GetCategoryParams,) => { ...@@ -493,12 +493,12 @@ export const getGetCategoryUrl = (params?: GetCategoryParams,) => {
const stringifiedParams = normalizedParams.toString(); const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `/category?${stringifiedParams}` : `/category` return stringifiedParams.length > 0 ? `/api/v1.0/category?${stringifiedParams}` : `/api/v1.0/category`
} }
export const getCategory = async (params?: GetCategoryParams, options?: RequestInit): Promise<getCategoryResponse> => { export const getApiV10Category = async (params?: GetApiV10CategoryParams, options?: RequestInit): Promise<getApiV10CategoryResponse> => {
const res = await fetch(getGetCategoryUrl(params), const res = await fetch(getGetApiV10CategoryUrl(params),
{ {
...options, ...options,
method: 'GET' method: 'GET'
...@@ -509,83 +509,83 @@ export const getCategory = async (params?: GetCategoryParams, options?: RequestI ...@@ -509,83 +509,83 @@ export const getCategory = async (params?: GetCategoryParams, options?: RequestI
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getCategoryResponse['data'] = body ? JSON.parse(body) : {} const data: getApiV10CategoryResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as getCategoryResponse return { data, status: res.status, headers: res.headers } as getApiV10CategoryResponse
} }
export const getGetCategoryInfiniteQueryKey = (params?: GetCategoryParams,) => { export const getGetApiV10CategoryInfiniteQueryKey = (params?: GetApiV10CategoryParams,) => {
return [ return [
'infinite', `/category`, ...(params ? [params]: []) 'infinite', `/api/v1.0/category`, ...(params ? [params]: [])
] as const; ] as const;
} }
export const getGetCategoryQueryKey = (params?: GetCategoryParams,) => { export const getGetApiV10CategoryQueryKey = (params?: GetApiV10CategoryParams,) => {
return [ return [
`/category`, ...(params ? [params]: []) `/api/v1.0/category`, ...(params ? [params]: [])
] as const; ] as const;
} }
export const getGetCategoryInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getCategory>>>, TError = unknown>(params?: GetCategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10CategoryInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Category>>>, TError = unknown>(params?: GetApiV10CategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetCategoryInfiniteQueryKey(params); const queryKey = queryOptions?.queryKey ?? getGetApiV10CategoryInfiniteQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getCategory>>> = ({ signal }) => getCategory(params, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10Category>>> = ({ signal }) => getApiV10Category(params, { signal, ...fetchOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetCategoryInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getCategory>>> export type GetApiV10CategoryInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10Category>>>
export type GetCategoryInfiniteQueryError = unknown export type GetApiV10CategoryInfiniteQueryError = unknown
export function useGetCategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategory>>>, TError = unknown>( export function useGetApiV10CategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Category>>>, TError = unknown>(
params: undefined | GetCategoryParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>> & Pick< params: undefined | GetApiV10CategoryParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getCategory>>, Awaited<ReturnType<typeof getApiV10Category>>,
TError, TError,
Awaited<ReturnType<typeof getCategory>> Awaited<ReturnType<typeof getApiV10Category>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategory>>>, TError = unknown>( export function useGetApiV10CategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Category>>>, TError = unknown>(
params?: GetCategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>> & Pick< params?: GetApiV10CategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getCategory>>, Awaited<ReturnType<typeof getApiV10Category>>,
TError, TError,
Awaited<ReturnType<typeof getCategory>> Awaited<ReturnType<typeof getApiV10Category>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategory>>>, TError = unknown>( export function useGetApiV10CategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Category>>>, TError = unknown>(
params?: GetCategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10CategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get all category * @summary Get all category
*/ */
export function useGetCategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getCategory>>>, TError = unknown>( export function useGetApiV10CategoryInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Category>>>, TError = unknown>(
params?: GetCategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10CategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetCategoryInfiniteQueryOptions(params,options) const queryOptions = getGetApiV10CategoryInfiniteQueryOptions(params,options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -597,12 +597,12 @@ export function useGetCategoryInfinite<TData = InfiniteData<Awaited<ReturnType<t ...@@ -597,12 +597,12 @@ export function useGetCategoryInfinite<TData = InfiniteData<Awaited<ReturnType<t
/** /**
* @summary Get all category * @summary Get all category
*/ */
export const prefetchGetCategoryInfiniteQuery = async <TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>( export const prefetchGetApiV10CategoryInfiniteQuery = async <TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
queryClient: QueryClient, params?: GetCategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, params?: GetApiV10CategoryParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetCategoryInfiniteQueryOptions(params,options) const queryOptions = getGetApiV10CategoryInfiniteQueryOptions(params,options)
await queryClient.prefetchInfiniteQuery(queryOptions); await queryClient.prefetchInfiniteQuery(queryOptions);
...@@ -611,62 +611,62 @@ export const prefetchGetCategoryInfiniteQuery = async <TData = Awaited<ReturnTyp ...@@ -611,62 +611,62 @@ export const prefetchGetCategoryInfiniteQuery = async <TData = Awaited<ReturnTyp
export const getGetCategoryQueryOptions = <TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>(params?: GetCategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10CategoryQueryOptions = <TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(params?: GetApiV10CategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetCategoryQueryKey(params); const queryKey = queryOptions?.queryKey ?? getGetApiV10CategoryQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getCategory>>> = ({ signal }) => getCategory(params, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10Category>>> = ({ signal }) => getApiV10Category(params, { signal, ...fetchOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetCategoryQueryResult = NonNullable<Awaited<ReturnType<typeof getCategory>>> export type GetApiV10CategoryQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10Category>>>
export type GetCategoryQueryError = unknown export type GetApiV10CategoryQueryError = unknown
export function useGetCategory<TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>( export function useGetApiV10Category<TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
params: undefined | GetCategoryParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>> & Pick< params: undefined | GetApiV10CategoryParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getCategory>>, Awaited<ReturnType<typeof getApiV10Category>>,
TError, TError,
Awaited<ReturnType<typeof getCategory>> Awaited<ReturnType<typeof getApiV10Category>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategory<TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>( export function useGetApiV10Category<TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
params?: GetCategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>> & Pick< params?: GetApiV10CategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getCategory>>, Awaited<ReturnType<typeof getApiV10Category>>,
TError, TError,
Awaited<ReturnType<typeof getCategory>> Awaited<ReturnType<typeof getApiV10Category>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetCategory<TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>( export function useGetApiV10Category<TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
params?: GetCategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10CategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get all category * @summary Get all category
*/ */
export function useGetCategory<TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>( export function useGetApiV10Category<TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
params?: GetCategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10CategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetCategoryQueryOptions(params,options) const queryOptions = getGetApiV10CategoryQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -678,12 +678,12 @@ export function useGetCategory<TData = Awaited<ReturnType<typeof getCategory>>, ...@@ -678,12 +678,12 @@ export function useGetCategory<TData = Awaited<ReturnType<typeof getCategory>>,
/** /**
* @summary Get all category * @summary Get all category
*/ */
export const prefetchGetCategoryQuery = async <TData = Awaited<ReturnType<typeof getCategory>>, TError = unknown>( export const prefetchGetApiV10CategoryQuery = async <TData = Awaited<ReturnType<typeof getApiV10Category>>, TError = unknown>(
queryClient: QueryClient, params?: GetCategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCategory>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, params?: GetApiV10CategoryParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Category>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetCategoryQueryOptions(params,options) const queryOptions = getGetApiV10CategoryQueryOptions(params,options)
await queryClient.prefetchQuery(queryOptions); await queryClient.prefetchQuery(queryOptions);
...@@ -696,29 +696,29 @@ export const prefetchGetCategoryQuery = async <TData = Awaited<ReturnType<typeof ...@@ -696,29 +696,29 @@ export const prefetchGetCategoryQuery = async <TData = Awaited<ReturnType<typeof
* Create a new category record * Create a new category record
* @summary Create a category * @summary Create a category
*/ */
export type postCategoryResponse200 = { export type postApiV10CategoryResponse200 = {
data: PostCategory200 data: PostApiV10Category200
status: 200 status: 200
} }
export type postCategoryResponseSuccess = (postCategoryResponse200) & { export type postApiV10CategoryResponseSuccess = (postApiV10CategoryResponse200) & {
headers: Headers; headers: Headers;
}; };
; ;
export type postCategoryResponse = (postCategoryResponseSuccess) export type postApiV10CategoryResponse = (postApiV10CategoryResponseSuccess)
export const getPostCategoryUrl = () => { export const getPostApiV10CategoryUrl = () => {
return `/category` return `/api/v1.0/category`
} }
export const postCategory = async (categoryMutate: CategoryMutate, options?: RequestInit): Promise<postCategoryResponse> => { export const postApiV10Category = async (categoryMutate: CategoryMutate, options?: RequestInit): Promise<postApiV10CategoryResponse> => {
const res = await fetch(getPostCategoryUrl(), const res = await fetch(getPostApiV10CategoryUrl(),
{ {
...options, ...options,
method: 'POST', method: 'POST',
...@@ -730,18 +730,18 @@ export const postCategory = async (categoryMutate: CategoryMutate, options?: Req ...@@ -730,18 +730,18 @@ export const postCategory = async (categoryMutate: CategoryMutate, options?: Req
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: postCategoryResponse['data'] = body ? JSON.parse(body) : {} const data: postApiV10CategoryResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as postCategoryResponse return { data, status: res.status, headers: res.headers } as postApiV10CategoryResponse
} }
export const getPostCategoryMutationOptions = <TError = unknown, export const getPostApiV10CategoryMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postCategory>>, TError,{data: CategoryMutate}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postApiV10Category>>, TError,{data: CategoryMutate}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof postCategory>>, TError,{data: CategoryMutate}, TContext> => { ): UseMutationOptions<Awaited<ReturnType<typeof postApiV10Category>>, TError,{data: CategoryMutate}, TContext> => {
const mutationKey = ['postCategory']; const mutationKey = ['postApiV10Category'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ? const {mutation: mutationOptions, fetch: fetchOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options options
...@@ -751,10 +751,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -751,10 +751,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
const mutationFn: MutationFunction<Awaited<ReturnType<typeof postCategory>>, {data: CategoryMutate}> = (props) => { const mutationFn: MutationFunction<Awaited<ReturnType<typeof postApiV10Category>>, {data: CategoryMutate}> = (props) => {
const {data} = props ?? {}; const {data} = props ?? {};
return postCategory(data,fetchOptions) return postApiV10Category(data,fetchOptions)
} }
...@@ -762,23 +762,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -762,23 +762,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
return { mutationFn, ...mutationOptions }} return { mutationFn, ...mutationOptions }}
export type PostCategoryMutationResult = NonNullable<Awaited<ReturnType<typeof postCategory>>> export type PostApiV10CategoryMutationResult = NonNullable<Awaited<ReturnType<typeof postApiV10Category>>>
export type PostCategoryMutationBody = CategoryMutate export type PostApiV10CategoryMutationBody = CategoryMutate
export type PostCategoryMutationError = unknown export type PostApiV10CategoryMutationError = unknown
/** /**
* @summary Create a category * @summary Create a category
*/ */
export const usePostCategory = <TError = unknown, export const usePostApiV10Category = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postCategory>>, TError,{data: CategoryMutate}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postApiV10Category>>, TError,{data: CategoryMutate}, TContext>, fetch?: RequestInit}
, queryClient?: QueryClient): UseMutationResult< , queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof postCategory>>, Awaited<ReturnType<typeof postApiV10Category>>,
TError, TError,
{data: CategoryMutate}, {data: CategoryMutate},
TContext TContext
> => { > => {
const mutationOptions = getPostCategoryMutationOptions(options); const mutationOptions = getPostApiV10CategoryMutationOptions(options);
return useMutation(mutationOptions, queryClient); return useMutation(mutationOptions, queryClient);
} }
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
...@@ -31,11 +31,11 @@ import type { ...@@ -31,11 +31,11 @@ import type {
import type { import type {
ContactMutate, ContactMutate,
DeleteContactId200, DeleteApiV10ContactId200,
GetContactId200, GetApiV10ContactId200,
GetContactParams, GetApiV10ContactParams,
PostContact200, PostApiV10Contact200,
PutContactId200, PutApiV10ContactId200,
ResponseGetAllData ResponseGetAllData
} from '../models'; } from '../models';
...@@ -48,36 +48,36 @@ import type { ...@@ -48,36 +48,36 @@ import type {
* Retrieve a single contact record by its ID * Retrieve a single contact record by its ID
* @summary Get contact by ID * @summary Get contact by ID
*/ */
export type getContactIdResponse200 = { export type getApiV10ContactIdResponse200 = {
data: GetContactId200 data: GetApiV10ContactId200
status: 200 status: 200
} }
export type getContactIdResponse404 = { export type getApiV10ContactIdResponse404 = {
data: void data: void
status: 404 status: 404
} }
export type getContactIdResponseSuccess = (getContactIdResponse200) & { export type getApiV10ContactIdResponseSuccess = (getApiV10ContactIdResponse200) & {
headers: Headers; headers: Headers;
}; };
export type getContactIdResponseError = (getContactIdResponse404) & { export type getApiV10ContactIdResponseError = (getApiV10ContactIdResponse404) & {
headers: Headers; headers: Headers;
}; };
export type getContactIdResponse = (getContactIdResponseSuccess | getContactIdResponseError) export type getApiV10ContactIdResponse = (getApiV10ContactIdResponseSuccess | getApiV10ContactIdResponseError)
export const getGetContactIdUrl = (id: string,) => { export const getGetApiV10ContactIdUrl = (id: string,) => {
return `/contact/${id}` return `/api/v1.0/contact/${id}`
} }
export const getContactId = async (id: string, options?: RequestInit): Promise<getContactIdResponse> => { export const getApiV10ContactId = async (id: string, options?: RequestInit): Promise<getApiV10ContactIdResponse> => {
const res = await fetch(getGetContactIdUrl(id), const res = await fetch(getGetApiV10ContactIdUrl(id),
{ {
...options, ...options,
method: 'GET' method: 'GET'
...@@ -88,83 +88,83 @@ export const getContactId = async (id: string, options?: RequestInit): Promise<g ...@@ -88,83 +88,83 @@ export const getContactId = async (id: string, options?: RequestInit): Promise<g
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getContactIdResponse['data'] = body ? JSON.parse(body) : {} const data: getApiV10ContactIdResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as getContactIdResponse return { data, status: res.status, headers: res.headers } as getApiV10ContactIdResponse
} }
export const getGetContactIdInfiniteQueryKey = (id?: string,) => { export const getGetApiV10ContactIdInfiniteQueryKey = (id?: string,) => {
return [ return [
'infinite', `/contact/${id}` 'infinite', `/api/v1.0/contact/${id}`
] as const; ] as const;
} }
export const getGetContactIdQueryKey = (id?: string,) => { export const getGetApiV10ContactIdQueryKey = (id?: string,) => {
return [ return [
`/contact/${id}` `/api/v1.0/contact/${id}`
] as const; ] as const;
} }
export const getGetContactIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getContactId>>>, TError = void>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10ContactIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getApiV10ContactId>>>, TError = void>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetContactIdInfiniteQueryKey(id); const queryKey = queryOptions?.queryKey ?? getGetApiV10ContactIdInfiniteQueryKey(id);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getContactId>>> = ({ signal }) => getContactId(id, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10ContactId>>> = ({ signal }) => getApiV10ContactId(id, { signal, ...fetchOptions });
return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetContactIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getContactId>>> export type GetApiV10ContactIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10ContactId>>>
export type GetContactIdInfiniteQueryError = void export type GetApiV10ContactIdInfiniteQueryError = void
export function useGetContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContactId>>>, TError = void>( export function useGetApiV10ContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10ContactId>>>, TError = void>(
id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>> & Pick< id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getContactId>>, Awaited<ReturnType<typeof getApiV10ContactId>>,
TError, TError,
Awaited<ReturnType<typeof getContactId>> Awaited<ReturnType<typeof getApiV10ContactId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContactId>>>, TError = void>( export function useGetApiV10ContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10ContactId>>>, TError = void>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>> & Pick< id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getContactId>>, Awaited<ReturnType<typeof getApiV10ContactId>>,
TError, TError,
Awaited<ReturnType<typeof getContactId>> Awaited<ReturnType<typeof getApiV10ContactId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContactId>>>, TError = void>( export function useGetApiV10ContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10ContactId>>>, TError = void>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get contact by ID * @summary Get contact by ID
*/ */
export function useGetContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContactId>>>, TError = void>( export function useGetApiV10ContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10ContactId>>>, TError = void>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetContactIdInfiniteQueryOptions(id,options) const queryOptions = getGetApiV10ContactIdInfiniteQueryOptions(id,options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -176,12 +176,12 @@ export function useGetContactIdInfinite<TData = InfiniteData<Awaited<ReturnType< ...@@ -176,12 +176,12 @@ export function useGetContactIdInfinite<TData = InfiniteData<Awaited<ReturnType<
/** /**
* @summary Get contact by ID * @summary Get contact by ID
*/ */
export const prefetchGetContactIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getContactId>>, TError = void>( export const prefetchGetApiV10ContactIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getApiV10ContactId>>, TError = void>(
queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetContactIdInfiniteQueryOptions(id,options) const queryOptions = getGetApiV10ContactIdInfiniteQueryOptions(id,options)
await queryClient.prefetchInfiniteQuery(queryOptions); await queryClient.prefetchInfiniteQuery(queryOptions);
...@@ -190,62 +190,62 @@ export const prefetchGetContactIdInfiniteQuery = async <TData = Awaited<ReturnTy ...@@ -190,62 +190,62 @@ export const prefetchGetContactIdInfiniteQuery = async <TData = Awaited<ReturnTy
export const getGetContactIdQueryOptions = <TData = Awaited<ReturnType<typeof getContactId>>, TError = void>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10ContactIdQueryOptions = <TData = Awaited<ReturnType<typeof getApiV10ContactId>>, TError = void>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetContactIdQueryKey(id); const queryKey = queryOptions?.queryKey ?? getGetApiV10ContactIdQueryKey(id);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getContactId>>> = ({ signal }) => getContactId(id, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10ContactId>>> = ({ signal }) => getApiV10ContactId(id, { signal, ...fetchOptions });
return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetContactIdQueryResult = NonNullable<Awaited<ReturnType<typeof getContactId>>> export type GetApiV10ContactIdQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10ContactId>>>
export type GetContactIdQueryError = void export type GetApiV10ContactIdQueryError = void
export function useGetContactId<TData = Awaited<ReturnType<typeof getContactId>>, TError = void>( export function useGetApiV10ContactId<TData = Awaited<ReturnType<typeof getApiV10ContactId>>, TError = void>(
id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>> & Pick< id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getContactId>>, Awaited<ReturnType<typeof getApiV10ContactId>>,
TError, TError,
Awaited<ReturnType<typeof getContactId>> Awaited<ReturnType<typeof getApiV10ContactId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactId<TData = Awaited<ReturnType<typeof getContactId>>, TError = void>( export function useGetApiV10ContactId<TData = Awaited<ReturnType<typeof getApiV10ContactId>>, TError = void>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>> & Pick< id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getContactId>>, Awaited<ReturnType<typeof getApiV10ContactId>>,
TError, TError,
Awaited<ReturnType<typeof getContactId>> Awaited<ReturnType<typeof getApiV10ContactId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactId<TData = Awaited<ReturnType<typeof getContactId>>, TError = void>( export function useGetApiV10ContactId<TData = Awaited<ReturnType<typeof getApiV10ContactId>>, TError = void>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get contact by ID * @summary Get contact by ID
*/ */
export function useGetContactId<TData = Awaited<ReturnType<typeof getContactId>>, TError = void>( export function useGetApiV10ContactId<TData = Awaited<ReturnType<typeof getApiV10ContactId>>, TError = void>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetContactIdQueryOptions(id,options) const queryOptions = getGetApiV10ContactIdQueryOptions(id,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -257,12 +257,12 @@ export function useGetContactId<TData = Awaited<ReturnType<typeof getContactId>> ...@@ -257,12 +257,12 @@ export function useGetContactId<TData = Awaited<ReturnType<typeof getContactId>>
/** /**
* @summary Get contact by ID * @summary Get contact by ID
*/ */
export const prefetchGetContactIdQuery = async <TData = Awaited<ReturnType<typeof getContactId>>, TError = void>( export const prefetchGetApiV10ContactIdQuery = async <TData = Awaited<ReturnType<typeof getApiV10ContactId>>, TError = void>(
queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContactId>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10ContactId>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetContactIdQueryOptions(id,options) const queryOptions = getGetApiV10ContactIdQueryOptions(id,options)
await queryClient.prefetchQuery(queryOptions); await queryClient.prefetchQuery(queryOptions);
...@@ -275,37 +275,37 @@ export const prefetchGetContactIdQuery = async <TData = Awaited<ReturnType<typeo ...@@ -275,37 +275,37 @@ export const prefetchGetContactIdQuery = async <TData = Awaited<ReturnType<typeo
* Update a single contact record by its ID * Update a single contact record by its ID
* @summary Update contact by ID * @summary Update contact by ID
*/ */
export type putContactIdResponse200 = { export type putApiV10ContactIdResponse200 = {
data: PutContactId200 data: PutApiV10ContactId200
status: 200 status: 200
} }
export type putContactIdResponse404 = { export type putApiV10ContactIdResponse404 = {
data: void data: void
status: 404 status: 404
} }
export type putContactIdResponseSuccess = (putContactIdResponse200) & { export type putApiV10ContactIdResponseSuccess = (putApiV10ContactIdResponse200) & {
headers: Headers; headers: Headers;
}; };
export type putContactIdResponseError = (putContactIdResponse404) & { export type putApiV10ContactIdResponseError = (putApiV10ContactIdResponse404) & {
headers: Headers; headers: Headers;
}; };
export type putContactIdResponse = (putContactIdResponseSuccess | putContactIdResponseError) export type putApiV10ContactIdResponse = (putApiV10ContactIdResponseSuccess | putApiV10ContactIdResponseError)
export const getPutContactIdUrl = (id: string,) => { export const getPutApiV10ContactIdUrl = (id: string,) => {
return `/contact/${id}` return `/api/v1.0/contact/${id}`
} }
export const putContactId = async (id: string, export const putApiV10ContactId = async (id: string,
contactMutate: ContactMutate, options?: RequestInit): Promise<putContactIdResponse> => { contactMutate: ContactMutate, options?: RequestInit): Promise<putApiV10ContactIdResponse> => {
const res = await fetch(getPutContactIdUrl(id), const res = await fetch(getPutApiV10ContactIdUrl(id),
{ {
...options, ...options,
method: 'PUT', method: 'PUT',
...@@ -317,18 +317,18 @@ export const putContactId = async (id: string, ...@@ -317,18 +317,18 @@ export const putContactId = async (id: string,
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: putContactIdResponse['data'] = body ? JSON.parse(body) : {} const data: putApiV10ContactIdResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as putContactIdResponse return { data, status: res.status, headers: res.headers } as putApiV10ContactIdResponse
} }
export const getPutContactIdMutationOptions = <TError = void, export const getPutApiV10ContactIdMutationOptions = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putContactId>>, TError,{id: string;data: ContactMutate}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putApiV10ContactId>>, TError,{id: string;data: ContactMutate}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof putContactId>>, TError,{id: string;data: ContactMutate}, TContext> => { ): UseMutationOptions<Awaited<ReturnType<typeof putApiV10ContactId>>, TError,{id: string;data: ContactMutate}, TContext> => {
const mutationKey = ['putContactId']; const mutationKey = ['putApiV10ContactId'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ? const {mutation: mutationOptions, fetch: fetchOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options options
...@@ -338,10 +338,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -338,10 +338,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
const mutationFn: MutationFunction<Awaited<ReturnType<typeof putContactId>>, {id: string;data: ContactMutate}> = (props) => { const mutationFn: MutationFunction<Awaited<ReturnType<typeof putApiV10ContactId>>, {id: string;data: ContactMutate}> = (props) => {
const {id,data} = props ?? {}; const {id,data} = props ?? {};
return putContactId(id,data,fetchOptions) return putApiV10ContactId(id,data,fetchOptions)
} }
...@@ -349,23 +349,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -349,23 +349,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
return { mutationFn, ...mutationOptions }} return { mutationFn, ...mutationOptions }}
export type PutContactIdMutationResult = NonNullable<Awaited<ReturnType<typeof putContactId>>> export type PutApiV10ContactIdMutationResult = NonNullable<Awaited<ReturnType<typeof putApiV10ContactId>>>
export type PutContactIdMutationBody = ContactMutate export type PutApiV10ContactIdMutationBody = ContactMutate
export type PutContactIdMutationError = void export type PutApiV10ContactIdMutationError = void
/** /**
* @summary Update contact by ID * @summary Update contact by ID
*/ */
export const usePutContactId = <TError = void, export const usePutApiV10ContactId = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putContactId>>, TError,{id: string;data: ContactMutate}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putApiV10ContactId>>, TError,{id: string;data: ContactMutate}, TContext>, fetch?: RequestInit}
, queryClient?: QueryClient): UseMutationResult< , queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof putContactId>>, Awaited<ReturnType<typeof putApiV10ContactId>>,
TError, TError,
{id: string;data: ContactMutate}, {id: string;data: ContactMutate},
TContext TContext
> => { > => {
const mutationOptions = getPutContactIdMutationOptions(options); const mutationOptions = getPutApiV10ContactIdMutationOptions(options);
return useMutation(mutationOptions, queryClient); return useMutation(mutationOptions, queryClient);
} }
...@@ -373,36 +373,36 @@ export const usePutContactId = <TError = void, ...@@ -373,36 +373,36 @@ export const usePutContactId = <TError = void,
* Delete a single contact record by its ID * Delete a single contact record by its ID
* @summary Delete contact by ID * @summary Delete contact by ID
*/ */
export type deleteContactIdResponse200 = { export type deleteApiV10ContactIdResponse200 = {
data: DeleteContactId200 data: DeleteApiV10ContactId200
status: 200 status: 200
} }
export type deleteContactIdResponse404 = { export type deleteApiV10ContactIdResponse404 = {
data: void data: void
status: 404 status: 404
} }
export type deleteContactIdResponseSuccess = (deleteContactIdResponse200) & { export type deleteApiV10ContactIdResponseSuccess = (deleteApiV10ContactIdResponse200) & {
headers: Headers; headers: Headers;
}; };
export type deleteContactIdResponseError = (deleteContactIdResponse404) & { export type deleteApiV10ContactIdResponseError = (deleteApiV10ContactIdResponse404) & {
headers: Headers; headers: Headers;
}; };
export type deleteContactIdResponse = (deleteContactIdResponseSuccess | deleteContactIdResponseError) export type deleteApiV10ContactIdResponse = (deleteApiV10ContactIdResponseSuccess | deleteApiV10ContactIdResponseError)
export const getDeleteContactIdUrl = (id: string,) => { export const getDeleteApiV10ContactIdUrl = (id: string,) => {
return `/contact/${id}` return `/api/v1.0/contact/${id}`
} }
export const deleteContactId = async (id: string, options?: RequestInit): Promise<deleteContactIdResponse> => { export const deleteApiV10ContactId = async (id: string, options?: RequestInit): Promise<deleteApiV10ContactIdResponse> => {
const res = await fetch(getDeleteContactIdUrl(id), const res = await fetch(getDeleteApiV10ContactIdUrl(id),
{ {
...options, ...options,
method: 'DELETE' method: 'DELETE'
...@@ -413,18 +413,18 @@ export const deleteContactId = async (id: string, options?: RequestInit): Promis ...@@ -413,18 +413,18 @@ export const deleteContactId = async (id: string, options?: RequestInit): Promis
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: deleteContactIdResponse['data'] = body ? JSON.parse(body) : {} const data: deleteApiV10ContactIdResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as deleteContactIdResponse return { data, status: res.status, headers: res.headers } as deleteApiV10ContactIdResponse
} }
export const getDeleteContactIdMutationOptions = <TError = void, export const getDeleteApiV10ContactIdMutationOptions = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteContactId>>, TError,{id: string}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10ContactId>>, TError,{id: string}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof deleteContactId>>, TError,{id: string}, TContext> => { ): UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10ContactId>>, TError,{id: string}, TContext> => {
const mutationKey = ['deleteContactId']; const mutationKey = ['deleteApiV10ContactId'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ? const {mutation: mutationOptions, fetch: fetchOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options options
...@@ -434,10 +434,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -434,10 +434,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteContactId>>, {id: string}> = (props) => { const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteApiV10ContactId>>, {id: string}> = (props) => {
const {id} = props ?? {}; const {id} = props ?? {};
return deleteContactId(id,fetchOptions) return deleteApiV10ContactId(id,fetchOptions)
} }
...@@ -445,23 +445,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -445,23 +445,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
return { mutationFn, ...mutationOptions }} return { mutationFn, ...mutationOptions }}
export type DeleteContactIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteContactId>>> export type DeleteApiV10ContactIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteApiV10ContactId>>>
export type DeleteContactIdMutationError = void export type DeleteApiV10ContactIdMutationError = void
/** /**
* @summary Delete contact by ID * @summary Delete contact by ID
*/ */
export const useDeleteContactId = <TError = void, export const useDeleteApiV10ContactId = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteContactId>>, TError,{id: string}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10ContactId>>, TError,{id: string}, TContext>, fetch?: RequestInit}
, queryClient?: QueryClient): UseMutationResult< , queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof deleteContactId>>, Awaited<ReturnType<typeof deleteApiV10ContactId>>,
TError, TError,
{id: string}, {id: string},
TContext TContext
> => { > => {
const mutationOptions = getDeleteContactIdMutationOptions(options); const mutationOptions = getDeleteApiV10ContactIdMutationOptions(options);
return useMutation(mutationOptions, queryClient); return useMutation(mutationOptions, queryClient);
} }
...@@ -469,19 +469,19 @@ export const useDeleteContactId = <TError = void, ...@@ -469,19 +469,19 @@ export const useDeleteContactId = <TError = void,
* Retrieve a list of contact with pagination, filtering and sorting * Retrieve a list of contact with pagination, filtering and sorting
* @summary Get all contact * @summary Get all contact
*/ */
export type getContactResponse200 = { export type getApiV10ContactResponse200 = {
data: ResponseGetAllData data: ResponseGetAllData
status: 200 status: 200
} }
export type getContactResponseSuccess = (getContactResponse200) & { export type getApiV10ContactResponseSuccess = (getApiV10ContactResponse200) & {
headers: Headers; headers: Headers;
}; };
; ;
export type getContactResponse = (getContactResponseSuccess) export type getApiV10ContactResponse = (getApiV10ContactResponseSuccess)
export const getGetContactUrl = (params?: GetContactParams,) => { export const getGetApiV10ContactUrl = (params?: GetApiV10ContactParams,) => {
const normalizedParams = new URLSearchParams(); const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => { Object.entries(params || {}).forEach(([key, value]) => {
...@@ -493,12 +493,12 @@ export const getGetContactUrl = (params?: GetContactParams,) => { ...@@ -493,12 +493,12 @@ export const getGetContactUrl = (params?: GetContactParams,) => {
const stringifiedParams = normalizedParams.toString(); const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `/contact?${stringifiedParams}` : `/contact` return stringifiedParams.length > 0 ? `/api/v1.0/contact?${stringifiedParams}` : `/api/v1.0/contact`
} }
export const getContact = async (params?: GetContactParams, options?: RequestInit): Promise<getContactResponse> => { export const getApiV10Contact = async (params?: GetApiV10ContactParams, options?: RequestInit): Promise<getApiV10ContactResponse> => {
const res = await fetch(getGetContactUrl(params), const res = await fetch(getGetApiV10ContactUrl(params),
{ {
...options, ...options,
method: 'GET' method: 'GET'
...@@ -509,83 +509,83 @@ export const getContact = async (params?: GetContactParams, options?: RequestIni ...@@ -509,83 +509,83 @@ export const getContact = async (params?: GetContactParams, options?: RequestIni
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getContactResponse['data'] = body ? JSON.parse(body) : {} const data: getApiV10ContactResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as getContactResponse return { data, status: res.status, headers: res.headers } as getApiV10ContactResponse
} }
export const getGetContactInfiniteQueryKey = (params?: GetContactParams,) => { export const getGetApiV10ContactInfiniteQueryKey = (params?: GetApiV10ContactParams,) => {
return [ return [
'infinite', `/contact`, ...(params ? [params]: []) 'infinite', `/api/v1.0/contact`, ...(params ? [params]: [])
] as const; ] as const;
} }
export const getGetContactQueryKey = (params?: GetContactParams,) => { export const getGetApiV10ContactQueryKey = (params?: GetApiV10ContactParams,) => {
return [ return [
`/contact`, ...(params ? [params]: []) `/api/v1.0/contact`, ...(params ? [params]: [])
] as const; ] as const;
} }
export const getGetContactInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getContact>>>, TError = unknown>(params?: GetContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10ContactInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Contact>>>, TError = unknown>(params?: GetApiV10ContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetContactInfiniteQueryKey(params); const queryKey = queryOptions?.queryKey ?? getGetApiV10ContactInfiniteQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getContact>>> = ({ signal }) => getContact(params, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10Contact>>> = ({ signal }) => getApiV10Contact(params, { signal, ...fetchOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetContactInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getContact>>> export type GetApiV10ContactInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10Contact>>>
export type GetContactInfiniteQueryError = unknown export type GetApiV10ContactInfiniteQueryError = unknown
export function useGetContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContact>>>, TError = unknown>( export function useGetApiV10ContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Contact>>>, TError = unknown>(
params: undefined | GetContactParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>> & Pick< params: undefined | GetApiV10ContactParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getContact>>, Awaited<ReturnType<typeof getApiV10Contact>>,
TError, TError,
Awaited<ReturnType<typeof getContact>> Awaited<ReturnType<typeof getApiV10Contact>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContact>>>, TError = unknown>( export function useGetApiV10ContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Contact>>>, TError = unknown>(
params?: GetContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>> & Pick< params?: GetApiV10ContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getContact>>, Awaited<ReturnType<typeof getApiV10Contact>>,
TError, TError,
Awaited<ReturnType<typeof getContact>> Awaited<ReturnType<typeof getApiV10Contact>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContact>>>, TError = unknown>( export function useGetApiV10ContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Contact>>>, TError = unknown>(
params?: GetContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10ContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get all contact * @summary Get all contact
*/ */
export function useGetContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getContact>>>, TError = unknown>( export function useGetApiV10ContactInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10Contact>>>, TError = unknown>(
params?: GetContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10ContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetContactInfiniteQueryOptions(params,options) const queryOptions = getGetApiV10ContactInfiniteQueryOptions(params,options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -597,12 +597,12 @@ export function useGetContactInfinite<TData = InfiniteData<Awaited<ReturnType<ty ...@@ -597,12 +597,12 @@ export function useGetContactInfinite<TData = InfiniteData<Awaited<ReturnType<ty
/** /**
* @summary Get all contact * @summary Get all contact
*/ */
export const prefetchGetContactInfiniteQuery = async <TData = Awaited<ReturnType<typeof getContact>>, TError = unknown>( export const prefetchGetApiV10ContactInfiniteQuery = async <TData = Awaited<ReturnType<typeof getApiV10Contact>>, TError = unknown>(
queryClient: QueryClient, params?: GetContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, params?: GetApiV10ContactParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetContactInfiniteQueryOptions(params,options) const queryOptions = getGetApiV10ContactInfiniteQueryOptions(params,options)
await queryClient.prefetchInfiniteQuery(queryOptions); await queryClient.prefetchInfiniteQuery(queryOptions);
...@@ -611,62 +611,62 @@ export const prefetchGetContactInfiniteQuery = async <TData = Awaited<ReturnType ...@@ -611,62 +611,62 @@ export const prefetchGetContactInfiniteQuery = async <TData = Awaited<ReturnType
export const getGetContactQueryOptions = <TData = Awaited<ReturnType<typeof getContact>>, TError = unknown>(params?: GetContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10ContactQueryOptions = <TData = Awaited<ReturnType<typeof getApiV10Contact>>, TError = unknown>(params?: GetApiV10ContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetContactQueryKey(params); const queryKey = queryOptions?.queryKey ?? getGetApiV10ContactQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getContact>>> = ({ signal }) => getContact(params, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10Contact>>> = ({ signal }) => getApiV10Contact(params, { signal, ...fetchOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetContactQueryResult = NonNullable<Awaited<ReturnType<typeof getContact>>> export type GetApiV10ContactQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10Contact>>>
export type GetContactQueryError = unknown export type GetApiV10ContactQueryError = unknown
export function useGetContact<TData = Awaited<ReturnType<typeof getContact>>, TError = unknown>( export function useGetApiV10Contact<TData = Awaited<ReturnType<typeof getApiV10Contact>>, TError = unknown>(
params: undefined | GetContactParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>> & Pick< params: undefined | GetApiV10ContactParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getContact>>, Awaited<ReturnType<typeof getApiV10Contact>>,
TError, TError,
Awaited<ReturnType<typeof getContact>> Awaited<ReturnType<typeof getApiV10Contact>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContact<TData = Awaited<ReturnType<typeof getContact>>, TError = unknown>( export function useGetApiV10Contact<TData = Awaited<ReturnType<typeof getApiV10Contact>>, TError = unknown>(
params?: GetContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>> & Pick< params?: GetApiV10ContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getContact>>, Awaited<ReturnType<typeof getApiV10Contact>>,
TError, TError,
Awaited<ReturnType<typeof getContact>> Awaited<ReturnType<typeof getApiV10Contact>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetContact<TData = Awaited<ReturnType<typeof getContact>>, TError = unknown>( export function useGetApiV10Contact<TData = Awaited<ReturnType<typeof getApiV10Contact>>, TError = unknown>(
params?: GetContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10ContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get all contact * @summary Get all contact
*/ */
export function useGetContact<TData = Awaited<ReturnType<typeof getContact>>, TError = unknown>( export function useGetApiV10Contact<TData = Awaited<ReturnType<typeof getApiV10Contact>>, TError = unknown>(
params?: GetContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10ContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetContactQueryOptions(params,options) const queryOptions = getGetApiV10ContactQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -678,12 +678,12 @@ export function useGetContact<TData = Awaited<ReturnType<typeof getContact>>, TE ...@@ -678,12 +678,12 @@ export function useGetContact<TData = Awaited<ReturnType<typeof getContact>>, TE
/** /**
* @summary Get all contact * @summary Get all contact
*/ */
export const prefetchGetContactQuery = async <TData = Awaited<ReturnType<typeof getContact>>, TError = unknown>( export const prefetchGetApiV10ContactQuery = async <TData = Awaited<ReturnType<typeof getApiV10Contact>>, TError = unknown>(
queryClient: QueryClient, params?: GetContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getContact>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, params?: GetApiV10ContactParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10Contact>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetContactQueryOptions(params,options) const queryOptions = getGetApiV10ContactQueryOptions(params,options)
await queryClient.prefetchQuery(queryOptions); await queryClient.prefetchQuery(queryOptions);
...@@ -696,29 +696,29 @@ export const prefetchGetContactQuery = async <TData = Awaited<ReturnType<typeof ...@@ -696,29 +696,29 @@ export const prefetchGetContactQuery = async <TData = Awaited<ReturnType<typeof
* Create a new contact record * Create a new contact record
* @summary Create a contact * @summary Create a contact
*/ */
export type postContactResponse200 = { export type postApiV10ContactResponse200 = {
data: PostContact200 data: PostApiV10Contact200
status: 200 status: 200
} }
export type postContactResponseSuccess = (postContactResponse200) & { export type postApiV10ContactResponseSuccess = (postApiV10ContactResponse200) & {
headers: Headers; headers: Headers;
}; };
; ;
export type postContactResponse = (postContactResponseSuccess) export type postApiV10ContactResponse = (postApiV10ContactResponseSuccess)
export const getPostContactUrl = () => { export const getPostApiV10ContactUrl = () => {
return `/contact` return `/api/v1.0/contact`
} }
export const postContact = async (contactMutate: ContactMutate, options?: RequestInit): Promise<postContactResponse> => { export const postApiV10Contact = async (contactMutate: ContactMutate, options?: RequestInit): Promise<postApiV10ContactResponse> => {
const res = await fetch(getPostContactUrl(), const res = await fetch(getPostApiV10ContactUrl(),
{ {
...options, ...options,
method: 'POST', method: 'POST',
...@@ -730,18 +730,18 @@ export const postContact = async (contactMutate: ContactMutate, options?: Reques ...@@ -730,18 +730,18 @@ export const postContact = async (contactMutate: ContactMutate, options?: Reques
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: postContactResponse['data'] = body ? JSON.parse(body) : {} const data: postApiV10ContactResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as postContactResponse return { data, status: res.status, headers: res.headers } as postApiV10ContactResponse
} }
export const getPostContactMutationOptions = <TError = unknown, export const getPostApiV10ContactMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postContact>>, TError,{data: ContactMutate}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postApiV10Contact>>, TError,{data: ContactMutate}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof postContact>>, TError,{data: ContactMutate}, TContext> => { ): UseMutationOptions<Awaited<ReturnType<typeof postApiV10Contact>>, TError,{data: ContactMutate}, TContext> => {
const mutationKey = ['postContact']; const mutationKey = ['postApiV10Contact'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ? const {mutation: mutationOptions, fetch: fetchOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options options
...@@ -751,10 +751,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -751,10 +751,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
const mutationFn: MutationFunction<Awaited<ReturnType<typeof postContact>>, {data: ContactMutate}> = (props) => { const mutationFn: MutationFunction<Awaited<ReturnType<typeof postApiV10Contact>>, {data: ContactMutate}> = (props) => {
const {data} = props ?? {}; const {data} = props ?? {};
return postContact(data,fetchOptions) return postApiV10Contact(data,fetchOptions)
} }
...@@ -762,23 +762,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -762,23 +762,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
return { mutationFn, ...mutationOptions }} return { mutationFn, ...mutationOptions }}
export type PostContactMutationResult = NonNullable<Awaited<ReturnType<typeof postContact>>> export type PostApiV10ContactMutationResult = NonNullable<Awaited<ReturnType<typeof postApiV10Contact>>>
export type PostContactMutationBody = ContactMutate export type PostApiV10ContactMutationBody = ContactMutate
export type PostContactMutationError = unknown export type PostApiV10ContactMutationError = unknown
/** /**
* @summary Create a contact * @summary Create a contact
*/ */
export const usePostContact = <TError = unknown, export const usePostApiV10Contact = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postContact>>, TError,{data: ContactMutate}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postApiV10Contact>>, TError,{data: ContactMutate}, TContext>, fetch?: RequestInit}
, queryClient?: QueryClient): UseMutationResult< , queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof postContact>>, Awaited<ReturnType<typeof postApiV10Contact>>,
TError, TError,
{data: ContactMutate}, {data: ContactMutate},
TContext TContext
> => { > => {
const mutationOptions = getPostContactMutationOptions(options); const mutationOptions = getPostApiV10ContactMutationOptions(options);
return useMutation(mutationOptions, queryClient); return useMutation(mutationOptions, queryClient);
} }
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
...@@ -30,9 +30,9 @@ import type { ...@@ -30,9 +30,9 @@ import type {
} from '@tanstack/react-query'; } from '@tanstack/react-query';
import type { import type {
GetPageConfigParams, GetApiV10PageConfigParams,
PostPageConfigBody, PostApiV10PageConfigBody,
PutPageConfigIdBody PutApiV10PageConfigIdBody
} from '../models'; } from '../models';
...@@ -44,36 +44,36 @@ import type { ...@@ -44,36 +44,36 @@ import type {
* Retrieve hierarchical page config by its ID * Retrieve hierarchical page config by its ID
* @summary Get hierarchical pageConfig by ID * @summary Get hierarchical pageConfig by ID
*/ */
export type getPageConfigIdResponse200 = { export type getApiV10PageConfigIdResponse200 = {
data: void data: void
status: 200 status: 200
} }
export type getPageConfigIdResponse404 = { export type getApiV10PageConfigIdResponse404 = {
data: void data: void
status: 404 status: 404
} }
export type getPageConfigIdResponseSuccess = (getPageConfigIdResponse200) & { export type getApiV10PageConfigIdResponseSuccess = (getApiV10PageConfigIdResponse200) & {
headers: Headers; headers: Headers;
}; };
export type getPageConfigIdResponseError = (getPageConfigIdResponse404) & { export type getApiV10PageConfigIdResponseError = (getApiV10PageConfigIdResponse404) & {
headers: Headers; headers: Headers;
}; };
export type getPageConfigIdResponse = (getPageConfigIdResponseSuccess | getPageConfigIdResponseError) export type getApiV10PageConfigIdResponse = (getApiV10PageConfigIdResponseSuccess | getApiV10PageConfigIdResponseError)
export const getGetPageConfigIdUrl = (id: string,) => { export const getGetApiV10PageConfigIdUrl = (id: string,) => {
return `/pageConfig/${id}` return `/api/v1.0/pageConfig/${id}`
} }
export const getPageConfigId = async (id: string, options?: RequestInit): Promise<getPageConfigIdResponse> => { export const getApiV10PageConfigId = async (id: string, options?: RequestInit): Promise<getApiV10PageConfigIdResponse> => {
const res = await fetch(getGetPageConfigIdUrl(id), const res = await fetch(getGetApiV10PageConfigIdUrl(id),
{ {
...options, ...options,
method: 'GET' method: 'GET'
...@@ -84,83 +84,83 @@ export const getPageConfigId = async (id: string, options?: RequestInit): Promis ...@@ -84,83 +84,83 @@ export const getPageConfigId = async (id: string, options?: RequestInit): Promis
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getPageConfigIdResponse['data'] = body ? JSON.parse(body) : {} const data: getApiV10PageConfigIdResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as getPageConfigIdResponse return { data, status: res.status, headers: res.headers } as getApiV10PageConfigIdResponse
} }
export const getGetPageConfigIdInfiniteQueryKey = (id?: string,) => { export const getGetApiV10PageConfigIdInfiniteQueryKey = (id?: string,) => {
return [ return [
'infinite', `/pageConfig/${id}` 'infinite', `/api/v1.0/pageConfig/${id}`
] as const; ] as const;
} }
export const getGetPageConfigIdQueryKey = (id?: string,) => { export const getGetApiV10PageConfigIdQueryKey = (id?: string,) => {
return [ return [
`/pageConfig/${id}` `/api/v1.0/pageConfig/${id}`
] as const; ] as const;
} }
export const getGetPageConfigIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getPageConfigId>>>, TError = void>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10PageConfigIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getApiV10PageConfigId>>>, TError = void>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetPageConfigIdInfiniteQueryKey(id); const queryKey = queryOptions?.queryKey ?? getGetApiV10PageConfigIdInfiniteQueryKey(id);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getPageConfigId>>> = ({ signal }) => getPageConfigId(id, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10PageConfigId>>> = ({ signal }) => getApiV10PageConfigId(id, { signal, ...fetchOptions });
return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetPageConfigIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getPageConfigId>>> export type GetApiV10PageConfigIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10PageConfigId>>>
export type GetPageConfigIdInfiniteQueryError = void export type GetApiV10PageConfigIdInfiniteQueryError = void
export function useGetPageConfigIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPageConfigId>>>, TError = void>( export function useGetApiV10PageConfigIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10PageConfigId>>>, TError = void>(
id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>> & Pick< id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getPageConfigId>>, Awaited<ReturnType<typeof getApiV10PageConfigId>>,
TError, TError,
Awaited<ReturnType<typeof getPageConfigId>> Awaited<ReturnType<typeof getApiV10PageConfigId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPageConfigIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPageConfigId>>>, TError = void>( export function useGetApiV10PageConfigIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10PageConfigId>>>, TError = void>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>> & Pick< id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getPageConfigId>>, Awaited<ReturnType<typeof getApiV10PageConfigId>>,
TError, TError,
Awaited<ReturnType<typeof getPageConfigId>> Awaited<ReturnType<typeof getApiV10PageConfigId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPageConfigIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPageConfigId>>>, TError = void>( export function useGetApiV10PageConfigIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10PageConfigId>>>, TError = void>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get hierarchical pageConfig by ID * @summary Get hierarchical pageConfig by ID
*/ */
export function useGetPageConfigIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPageConfigId>>>, TError = void>( export function useGetApiV10PageConfigIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10PageConfigId>>>, TError = void>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetPageConfigIdInfiniteQueryOptions(id,options) const queryOptions = getGetApiV10PageConfigIdInfiniteQueryOptions(id,options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -172,12 +172,12 @@ export function useGetPageConfigIdInfinite<TData = InfiniteData<Awaited<ReturnTy ...@@ -172,12 +172,12 @@ export function useGetPageConfigIdInfinite<TData = InfiniteData<Awaited<ReturnTy
/** /**
* @summary Get hierarchical pageConfig by ID * @summary Get hierarchical pageConfig by ID
*/ */
export const prefetchGetPageConfigIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getPageConfigId>>, TError = void>( export const prefetchGetApiV10PageConfigIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError = void>(
queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetPageConfigIdInfiniteQueryOptions(id,options) const queryOptions = getGetApiV10PageConfigIdInfiniteQueryOptions(id,options)
await queryClient.prefetchInfiniteQuery(queryOptions); await queryClient.prefetchInfiniteQuery(queryOptions);
...@@ -186,62 +186,62 @@ export const prefetchGetPageConfigIdInfiniteQuery = async <TData = Awaited<Retur ...@@ -186,62 +186,62 @@ export const prefetchGetPageConfigIdInfiniteQuery = async <TData = Awaited<Retur
export const getGetPageConfigIdQueryOptions = <TData = Awaited<ReturnType<typeof getPageConfigId>>, TError = void>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10PageConfigIdQueryOptions = <TData = Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError = void>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetPageConfigIdQueryKey(id); const queryKey = queryOptions?.queryKey ?? getGetApiV10PageConfigIdQueryKey(id);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getPageConfigId>>> = ({ signal }) => getPageConfigId(id, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10PageConfigId>>> = ({ signal }) => getApiV10PageConfigId(id, { signal, ...fetchOptions });
return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetPageConfigIdQueryResult = NonNullable<Awaited<ReturnType<typeof getPageConfigId>>> export type GetApiV10PageConfigIdQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10PageConfigId>>>
export type GetPageConfigIdQueryError = void export type GetApiV10PageConfigIdQueryError = void
export function useGetPageConfigId<TData = Awaited<ReturnType<typeof getPageConfigId>>, TError = void>( export function useGetApiV10PageConfigId<TData = Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError = void>(
id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>> & Pick< id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getPageConfigId>>, Awaited<ReturnType<typeof getApiV10PageConfigId>>,
TError, TError,
Awaited<ReturnType<typeof getPageConfigId>> Awaited<ReturnType<typeof getApiV10PageConfigId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPageConfigId<TData = Awaited<ReturnType<typeof getPageConfigId>>, TError = void>( export function useGetApiV10PageConfigId<TData = Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError = void>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>> & Pick< id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getPageConfigId>>, Awaited<ReturnType<typeof getApiV10PageConfigId>>,
TError, TError,
Awaited<ReturnType<typeof getPageConfigId>> Awaited<ReturnType<typeof getApiV10PageConfigId>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPageConfigId<TData = Awaited<ReturnType<typeof getPageConfigId>>, TError = void>( export function useGetApiV10PageConfigId<TData = Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError = void>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get hierarchical pageConfig by ID * @summary Get hierarchical pageConfig by ID
*/ */
export function useGetPageConfigId<TData = Awaited<ReturnType<typeof getPageConfigId>>, TError = void>( export function useGetApiV10PageConfigId<TData = Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError = void>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>>, fetch?: RequestInit} id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetPageConfigIdQueryOptions(id,options) const queryOptions = getGetApiV10PageConfigIdQueryOptions(id,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -253,12 +253,12 @@ export function useGetPageConfigId<TData = Awaited<ReturnType<typeof getPageConf ...@@ -253,12 +253,12 @@ export function useGetPageConfigId<TData = Awaited<ReturnType<typeof getPageConf
/** /**
* @summary Get hierarchical pageConfig by ID * @summary Get hierarchical pageConfig by ID
*/ */
export const prefetchGetPageConfigIdQuery = async <TData = Awaited<ReturnType<typeof getPageConfigId>>, TError = void>( export const prefetchGetApiV10PageConfigIdQuery = async <TData = Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError = void>(
queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfigId>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfigId>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetPageConfigIdQueryOptions(id,options) const queryOptions = getGetApiV10PageConfigIdQueryOptions(id,options)
await queryClient.prefetchQuery(queryOptions); await queryClient.prefetchQuery(queryOptions);
...@@ -271,60 +271,60 @@ export const prefetchGetPageConfigIdQuery = async <TData = Awaited<ReturnType<ty ...@@ -271,60 +271,60 @@ export const prefetchGetPageConfigIdQuery = async <TData = Awaited<ReturnType<ty
* Update a single pageConfig record by its ID. level is computed if parent_id changes and must not be sent. * Update a single pageConfig record by its ID. level is computed if parent_id changes and must not be sent.
* @summary Update pageConfig by ID * @summary Update pageConfig by ID
*/ */
export type putPageConfigIdResponse200 = { export type putApiV10PageConfigIdResponse200 = {
data: void data: void
status: 200 status: 200
} }
export type putPageConfigIdResponse404 = { export type putApiV10PageConfigIdResponse404 = {
data: void data: void
status: 404 status: 404
} }
export type putPageConfigIdResponseSuccess = (putPageConfigIdResponse200) & { export type putApiV10PageConfigIdResponseSuccess = (putApiV10PageConfigIdResponse200) & {
headers: Headers; headers: Headers;
}; };
export type putPageConfigIdResponseError = (putPageConfigIdResponse404) & { export type putApiV10PageConfigIdResponseError = (putApiV10PageConfigIdResponse404) & {
headers: Headers; headers: Headers;
}; };
export type putPageConfigIdResponse = (putPageConfigIdResponseSuccess | putPageConfigIdResponseError) export type putApiV10PageConfigIdResponse = (putApiV10PageConfigIdResponseSuccess | putApiV10PageConfigIdResponseError)
export const getPutPageConfigIdUrl = (id: string,) => { export const getPutApiV10PageConfigIdUrl = (id: string,) => {
return `/pageConfig/${id}` return `/api/v1.0/pageConfig/${id}`
} }
export const putPageConfigId = async (id: string, export const putApiV10PageConfigId = async (id: string,
putPageConfigIdBody: PutPageConfigIdBody, options?: RequestInit): Promise<putPageConfigIdResponse> => { putApiV10PageConfigIdBody: PutApiV10PageConfigIdBody, options?: RequestInit): Promise<putApiV10PageConfigIdResponse> => {
const res = await fetch(getPutPageConfigIdUrl(id), const res = await fetch(getPutApiV10PageConfigIdUrl(id),
{ {
...options, ...options,
method: 'PUT', method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers }, headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify( body: JSON.stringify(
putPageConfigIdBody,) putApiV10PageConfigIdBody,)
} }
) )
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: putPageConfigIdResponse['data'] = body ? JSON.parse(body) : {} const data: putApiV10PageConfigIdResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as putPageConfigIdResponse return { data, status: res.status, headers: res.headers } as putApiV10PageConfigIdResponse
} }
export const getPutPageConfigIdMutationOptions = <TError = void, export const getPutApiV10PageConfigIdMutationOptions = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putPageConfigId>>, TError,{id: string;data: PutPageConfigIdBody}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putApiV10PageConfigId>>, TError,{id: string;data: PutApiV10PageConfigIdBody}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof putPageConfigId>>, TError,{id: string;data: PutPageConfigIdBody}, TContext> => { ): UseMutationOptions<Awaited<ReturnType<typeof putApiV10PageConfigId>>, TError,{id: string;data: PutApiV10PageConfigIdBody}, TContext> => {
const mutationKey = ['putPageConfigId']; const mutationKey = ['putApiV10PageConfigId'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ? const {mutation: mutationOptions, fetch: fetchOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options options
...@@ -334,10 +334,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -334,10 +334,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
const mutationFn: MutationFunction<Awaited<ReturnType<typeof putPageConfigId>>, {id: string;data: PutPageConfigIdBody}> = (props) => { const mutationFn: MutationFunction<Awaited<ReturnType<typeof putApiV10PageConfigId>>, {id: string;data: PutApiV10PageConfigIdBody}> = (props) => {
const {id,data} = props ?? {}; const {id,data} = props ?? {};
return putPageConfigId(id,data,fetchOptions) return putApiV10PageConfigId(id,data,fetchOptions)
} }
...@@ -345,23 +345,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -345,23 +345,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
return { mutationFn, ...mutationOptions }} return { mutationFn, ...mutationOptions }}
export type PutPageConfigIdMutationResult = NonNullable<Awaited<ReturnType<typeof putPageConfigId>>> export type PutApiV10PageConfigIdMutationResult = NonNullable<Awaited<ReturnType<typeof putApiV10PageConfigId>>>
export type PutPageConfigIdMutationBody = PutPageConfigIdBody export type PutApiV10PageConfigIdMutationBody = PutApiV10PageConfigIdBody
export type PutPageConfigIdMutationError = void export type PutApiV10PageConfigIdMutationError = void
/** /**
* @summary Update pageConfig by ID * @summary Update pageConfig by ID
*/ */
export const usePutPageConfigId = <TError = void, export const usePutApiV10PageConfigId = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putPageConfigId>>, TError,{id: string;data: PutPageConfigIdBody}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putApiV10PageConfigId>>, TError,{id: string;data: PutApiV10PageConfigIdBody}, TContext>, fetch?: RequestInit}
, queryClient?: QueryClient): UseMutationResult< , queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof putPageConfigId>>, Awaited<ReturnType<typeof putApiV10PageConfigId>>,
TError, TError,
{id: string;data: PutPageConfigIdBody}, {id: string;data: PutApiV10PageConfigIdBody},
TContext TContext
> => { > => {
const mutationOptions = getPutPageConfigIdMutationOptions(options); const mutationOptions = getPutApiV10PageConfigIdMutationOptions(options);
return useMutation(mutationOptions, queryClient); return useMutation(mutationOptions, queryClient);
} }
...@@ -369,36 +369,36 @@ export const usePutPageConfigId = <TError = void, ...@@ -369,36 +369,36 @@ export const usePutPageConfigId = <TError = void,
* Delete a single pageConfig record by its ID * Delete a single pageConfig record by its ID
* @summary Delete pageConfig by ID * @summary Delete pageConfig by ID
*/ */
export type deletePageConfigIdResponse200 = { export type deleteApiV10PageConfigIdResponse200 = {
data: void data: void
status: 200 status: 200
} }
export type deletePageConfigIdResponse404 = { export type deleteApiV10PageConfigIdResponse404 = {
data: void data: void
status: 404 status: 404
} }
export type deletePageConfigIdResponseSuccess = (deletePageConfigIdResponse200) & { export type deleteApiV10PageConfigIdResponseSuccess = (deleteApiV10PageConfigIdResponse200) & {
headers: Headers; headers: Headers;
}; };
export type deletePageConfigIdResponseError = (deletePageConfigIdResponse404) & { export type deleteApiV10PageConfigIdResponseError = (deleteApiV10PageConfigIdResponse404) & {
headers: Headers; headers: Headers;
}; };
export type deletePageConfigIdResponse = (deletePageConfigIdResponseSuccess | deletePageConfigIdResponseError) export type deleteApiV10PageConfigIdResponse = (deleteApiV10PageConfigIdResponseSuccess | deleteApiV10PageConfigIdResponseError)
export const getDeletePageConfigIdUrl = (id: string,) => { export const getDeleteApiV10PageConfigIdUrl = (id: string,) => {
return `/pageConfig/${id}` return `/api/v1.0/pageConfig/${id}`
} }
export const deletePageConfigId = async (id: string, options?: RequestInit): Promise<deletePageConfigIdResponse> => { export const deleteApiV10PageConfigId = async (id: string, options?: RequestInit): Promise<deleteApiV10PageConfigIdResponse> => {
const res = await fetch(getDeletePageConfigIdUrl(id), const res = await fetch(getDeleteApiV10PageConfigIdUrl(id),
{ {
...options, ...options,
method: 'DELETE' method: 'DELETE'
...@@ -409,18 +409,18 @@ export const deletePageConfigId = async (id: string, options?: RequestInit): Pro ...@@ -409,18 +409,18 @@ export const deletePageConfigId = async (id: string, options?: RequestInit): Pro
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: deletePageConfigIdResponse['data'] = body ? JSON.parse(body) : {} const data: deleteApiV10PageConfigIdResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as deletePageConfigIdResponse return { data, status: res.status, headers: res.headers } as deleteApiV10PageConfigIdResponse
} }
export const getDeletePageConfigIdMutationOptions = <TError = void, export const getDeleteApiV10PageConfigIdMutationOptions = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deletePageConfigId>>, TError,{id: string}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10PageConfigId>>, TError,{id: string}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof deletePageConfigId>>, TError,{id: string}, TContext> => { ): UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10PageConfigId>>, TError,{id: string}, TContext> => {
const mutationKey = ['deletePageConfigId']; const mutationKey = ['deleteApiV10PageConfigId'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ? const {mutation: mutationOptions, fetch: fetchOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options options
...@@ -430,10 +430,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -430,10 +430,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deletePageConfigId>>, {id: string}> = (props) => { const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteApiV10PageConfigId>>, {id: string}> = (props) => {
const {id} = props ?? {}; const {id} = props ?? {};
return deletePageConfigId(id,fetchOptions) return deleteApiV10PageConfigId(id,fetchOptions)
} }
...@@ -441,23 +441,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -441,23 +441,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
return { mutationFn, ...mutationOptions }} return { mutationFn, ...mutationOptions }}
export type DeletePageConfigIdMutationResult = NonNullable<Awaited<ReturnType<typeof deletePageConfigId>>> export type DeleteApiV10PageConfigIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteApiV10PageConfigId>>>
export type DeletePageConfigIdMutationError = void export type DeleteApiV10PageConfigIdMutationError = void
/** /**
* @summary Delete pageConfig by ID * @summary Delete pageConfig by ID
*/ */
export const useDeletePageConfigId = <TError = void, export const useDeleteApiV10PageConfigId = <TError = void,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deletePageConfigId>>, TError,{id: string}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteApiV10PageConfigId>>, TError,{id: string}, TContext>, fetch?: RequestInit}
, queryClient?: QueryClient): UseMutationResult< , queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof deletePageConfigId>>, Awaited<ReturnType<typeof deleteApiV10PageConfigId>>,
TError, TError,
{id: string}, {id: string},
TContext TContext
> => { > => {
const mutationOptions = getDeletePageConfigIdMutationOptions(options); const mutationOptions = getDeleteApiV10PageConfigIdMutationOptions(options);
return useMutation(mutationOptions, queryClient); return useMutation(mutationOptions, queryClient);
} }
...@@ -465,19 +465,19 @@ export const useDeletePageConfigId = <TError = void, ...@@ -465,19 +465,19 @@ export const useDeletePageConfigId = <TError = void,
* Retrieve hierarchical page config by id, static_link, or code. If no parameters are provided, returns the root hierarchical structure. * Retrieve hierarchical page config by id, static_link, or code. If no parameters are provided, returns the root hierarchical structure.
* @summary Get hierarchical pageConfig * @summary Get hierarchical pageConfig
*/ */
export type getPageConfigResponse200 = { export type getApiV10PageConfigResponse200 = {
data: void data: void
status: 200 status: 200
} }
export type getPageConfigResponseSuccess = (getPageConfigResponse200) & { export type getApiV10PageConfigResponseSuccess = (getApiV10PageConfigResponse200) & {
headers: Headers; headers: Headers;
}; };
; ;
export type getPageConfigResponse = (getPageConfigResponseSuccess) export type getApiV10PageConfigResponse = (getApiV10PageConfigResponseSuccess)
export const getGetPageConfigUrl = (params?: GetPageConfigParams,) => { export const getGetApiV10PageConfigUrl = (params?: GetApiV10PageConfigParams,) => {
const normalizedParams = new URLSearchParams(); const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => { Object.entries(params || {}).forEach(([key, value]) => {
...@@ -489,12 +489,12 @@ export const getGetPageConfigUrl = (params?: GetPageConfigParams,) => { ...@@ -489,12 +489,12 @@ export const getGetPageConfigUrl = (params?: GetPageConfigParams,) => {
const stringifiedParams = normalizedParams.toString(); const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `/pageConfig?${stringifiedParams}` : `/pageConfig` return stringifiedParams.length > 0 ? `/api/v1.0/pageConfig?${stringifiedParams}` : `/api/v1.0/pageConfig`
} }
export const getPageConfig = async (params?: GetPageConfigParams, options?: RequestInit): Promise<getPageConfigResponse> => { export const getApiV10PageConfig = async (params?: GetApiV10PageConfigParams, options?: RequestInit): Promise<getApiV10PageConfigResponse> => {
const res = await fetch(getGetPageConfigUrl(params), const res = await fetch(getGetApiV10PageConfigUrl(params),
{ {
...options, ...options,
method: 'GET' method: 'GET'
...@@ -505,83 +505,83 @@ export const getPageConfig = async (params?: GetPageConfigParams, options?: Requ ...@@ -505,83 +505,83 @@ export const getPageConfig = async (params?: GetPageConfigParams, options?: Requ
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: getPageConfigResponse['data'] = body ? JSON.parse(body) : {} const data: getApiV10PageConfigResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as getPageConfigResponse return { data, status: res.status, headers: res.headers } as getApiV10PageConfigResponse
} }
export const getGetPageConfigInfiniteQueryKey = (params?: GetPageConfigParams,) => { export const getGetApiV10PageConfigInfiniteQueryKey = (params?: GetApiV10PageConfigParams,) => {
return [ return [
'infinite', `/pageConfig`, ...(params ? [params]: []) 'infinite', `/api/v1.0/pageConfig`, ...(params ? [params]: [])
] as const; ] as const;
} }
export const getGetPageConfigQueryKey = (params?: GetPageConfigParams,) => { export const getGetApiV10PageConfigQueryKey = (params?: GetApiV10PageConfigParams,) => {
return [ return [
`/pageConfig`, ...(params ? [params]: []) `/api/v1.0/pageConfig`, ...(params ? [params]: [])
] as const; ] as const;
} }
export const getGetPageConfigInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getPageConfig>>>, TError = unknown>(params?: GetPageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10PageConfigInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getApiV10PageConfig>>>, TError = unknown>(params?: GetApiV10PageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetPageConfigInfiniteQueryKey(params); const queryKey = queryOptions?.queryKey ?? getGetApiV10PageConfigInfiniteQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getPageConfig>>> = ({ signal }) => getPageConfig(params, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10PageConfig>>> = ({ signal }) => getApiV10PageConfig(params, { signal, ...fetchOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetPageConfigInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getPageConfig>>> export type GetApiV10PageConfigInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10PageConfig>>>
export type GetPageConfigInfiniteQueryError = unknown export type GetApiV10PageConfigInfiniteQueryError = unknown
export function useGetPageConfigInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPageConfig>>>, TError = unknown>( export function useGetApiV10PageConfigInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10PageConfig>>>, TError = unknown>(
params: undefined | GetPageConfigParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>> & Pick< params: undefined | GetApiV10PageConfigParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getPageConfig>>, Awaited<ReturnType<typeof getApiV10PageConfig>>,
TError, TError,
Awaited<ReturnType<typeof getPageConfig>> Awaited<ReturnType<typeof getApiV10PageConfig>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPageConfigInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPageConfig>>>, TError = unknown>( export function useGetApiV10PageConfigInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10PageConfig>>>, TError = unknown>(
params?: GetPageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>> & Pick< params?: GetApiV10PageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getPageConfig>>, Awaited<ReturnType<typeof getApiV10PageConfig>>,
TError, TError,
Awaited<ReturnType<typeof getPageConfig>> Awaited<ReturnType<typeof getApiV10PageConfig>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPageConfigInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPageConfig>>>, TError = unknown>( export function useGetApiV10PageConfigInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10PageConfig>>>, TError = unknown>(
params?: GetPageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10PageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get hierarchical pageConfig * @summary Get hierarchical pageConfig
*/ */
export function useGetPageConfigInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getPageConfig>>>, TError = unknown>( export function useGetApiV10PageConfigInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getApiV10PageConfig>>>, TError = unknown>(
params?: GetPageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10PageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetPageConfigInfiniteQueryOptions(params,options) const queryOptions = getGetApiV10PageConfigInfiniteQueryOptions(params,options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -593,12 +593,12 @@ export function useGetPageConfigInfinite<TData = InfiniteData<Awaited<ReturnType ...@@ -593,12 +593,12 @@ export function useGetPageConfigInfinite<TData = InfiniteData<Awaited<ReturnType
/** /**
* @summary Get hierarchical pageConfig * @summary Get hierarchical pageConfig
*/ */
export const prefetchGetPageConfigInfiniteQuery = async <TData = Awaited<ReturnType<typeof getPageConfig>>, TError = unknown>( export const prefetchGetApiV10PageConfigInfiniteQuery = async <TData = Awaited<ReturnType<typeof getApiV10PageConfig>>, TError = unknown>(
queryClient: QueryClient, params?: GetPageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, params?: GetApiV10PageConfigParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetPageConfigInfiniteQueryOptions(params,options) const queryOptions = getGetApiV10PageConfigInfiniteQueryOptions(params,options)
await queryClient.prefetchInfiniteQuery(queryOptions); await queryClient.prefetchInfiniteQuery(queryOptions);
...@@ -607,62 +607,62 @@ export const prefetchGetPageConfigInfiniteQuery = async <TData = Awaited<ReturnT ...@@ -607,62 +607,62 @@ export const prefetchGetPageConfigInfiniteQuery = async <TData = Awaited<ReturnT
export const getGetPageConfigQueryOptions = <TData = Awaited<ReturnType<typeof getPageConfig>>, TError = unknown>(params?: GetPageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>>, fetch?: RequestInit} export const getGetApiV10PageConfigQueryOptions = <TData = Awaited<ReturnType<typeof getApiV10PageConfig>>, TError = unknown>(params?: GetApiV10PageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>>, fetch?: RequestInit}
) => { ) => {
const {query: queryOptions, fetch: fetchOptions} = options ?? {}; const {query: queryOptions, fetch: fetchOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetPageConfigQueryKey(params); const queryKey = queryOptions?.queryKey ?? getGetApiV10PageConfigQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getPageConfig>>> = ({ signal }) => getPageConfig(params, { signal, ...fetchOptions }); const queryFn: QueryFunction<Awaited<ReturnType<typeof getApiV10PageConfig>>> = ({ signal }) => getApiV10PageConfig(params, { signal, ...fetchOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> } return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
} }
export type GetPageConfigQueryResult = NonNullable<Awaited<ReturnType<typeof getPageConfig>>> export type GetApiV10PageConfigQueryResult = NonNullable<Awaited<ReturnType<typeof getApiV10PageConfig>>>
export type GetPageConfigQueryError = unknown export type GetApiV10PageConfigQueryError = unknown
export function useGetPageConfig<TData = Awaited<ReturnType<typeof getPageConfig>>, TError = unknown>( export function useGetApiV10PageConfig<TData = Awaited<ReturnType<typeof getApiV10PageConfig>>, TError = unknown>(
params: undefined | GetPageConfigParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>> & Pick< params: undefined | GetApiV10PageConfigParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>> & Pick<
DefinedInitialDataOptions< DefinedInitialDataOptions<
Awaited<ReturnType<typeof getPageConfig>>, Awaited<ReturnType<typeof getApiV10PageConfig>>,
TError, TError,
Awaited<ReturnType<typeof getPageConfig>> Awaited<ReturnType<typeof getApiV10PageConfig>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPageConfig<TData = Awaited<ReturnType<typeof getPageConfig>>, TError = unknown>( export function useGetApiV10PageConfig<TData = Awaited<ReturnType<typeof getApiV10PageConfig>>, TError = unknown>(
params?: GetPageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>> & Pick< params?: GetApiV10PageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>> & Pick<
UndefinedInitialDataOptions< UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getPageConfig>>, Awaited<ReturnType<typeof getApiV10PageConfig>>,
TError, TError,
Awaited<ReturnType<typeof getPageConfig>> Awaited<ReturnType<typeof getApiV10PageConfig>>
> , 'initialData' > , 'initialData'
>, fetch?: RequestInit} >, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetPageConfig<TData = Awaited<ReturnType<typeof getPageConfig>>, TError = unknown>( export function useGetApiV10PageConfig<TData = Awaited<ReturnType<typeof getApiV10PageConfig>>, TError = unknown>(
params?: GetPageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10PageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/** /**
* @summary Get hierarchical pageConfig * @summary Get hierarchical pageConfig
*/ */
export function useGetPageConfig<TData = Awaited<ReturnType<typeof getPageConfig>>, TError = unknown>( export function useGetApiV10PageConfig<TData = Awaited<ReturnType<typeof getApiV10PageConfig>>, TError = unknown>(
params?: GetPageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>>, fetch?: RequestInit} params?: GetApiV10PageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>>, fetch?: RequestInit}
, queryClient?: QueryClient , queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } { ): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetPageConfigQueryOptions(params,options) const queryOptions = getGetApiV10PageConfigQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }; const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
...@@ -674,12 +674,12 @@ export function useGetPageConfig<TData = Awaited<ReturnType<typeof getPageConfig ...@@ -674,12 +674,12 @@ export function useGetPageConfig<TData = Awaited<ReturnType<typeof getPageConfig
/** /**
* @summary Get hierarchical pageConfig * @summary Get hierarchical pageConfig
*/ */
export const prefetchGetPageConfigQuery = async <TData = Awaited<ReturnType<typeof getPageConfig>>, TError = unknown>( export const prefetchGetApiV10PageConfigQuery = async <TData = Awaited<ReturnType<typeof getApiV10PageConfig>>, TError = unknown>(
queryClient: QueryClient, params?: GetPageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getPageConfig>>, TError, TData>>, fetch?: RequestInit} queryClient: QueryClient, params?: GetApiV10PageConfigParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getApiV10PageConfig>>, TError, TData>>, fetch?: RequestInit}
): Promise<QueryClient> => { ): Promise<QueryClient> => {
const queryOptions = getGetPageConfigQueryOptions(params,options) const queryOptions = getGetApiV10PageConfigQueryOptions(params,options)
await queryClient.prefetchQuery(queryOptions); await queryClient.prefetchQuery(queryOptions);
...@@ -692,52 +692,52 @@ export const prefetchGetPageConfigQuery = async <TData = Awaited<ReturnType<type ...@@ -692,52 +692,52 @@ export const prefetchGetPageConfigQuery = async <TData = Awaited<ReturnType<type
* Create a new pageConfig record. parent_id is required. level is computed from parent and must not be sent. * Create a new pageConfig record. parent_id is required. level is computed from parent and must not be sent.
* @summary Create a pageConfig * @summary Create a pageConfig
*/ */
export type postPageConfigResponse200 = { export type postApiV10PageConfigResponse200 = {
data: void data: void
status: 200 status: 200
} }
export type postPageConfigResponseSuccess = (postPageConfigResponse200) & { export type postApiV10PageConfigResponseSuccess = (postApiV10PageConfigResponse200) & {
headers: Headers; headers: Headers;
}; };
; ;
export type postPageConfigResponse = (postPageConfigResponseSuccess) export type postApiV10PageConfigResponse = (postApiV10PageConfigResponseSuccess)
export const getPostPageConfigUrl = () => { export const getPostApiV10PageConfigUrl = () => {
return `/pageConfig` return `/api/v1.0/pageConfig`
} }
export const postPageConfig = async (postPageConfigBody: PostPageConfigBody, options?: RequestInit): Promise<postPageConfigResponse> => { export const postApiV10PageConfig = async (postApiV10PageConfigBody: PostApiV10PageConfigBody, options?: RequestInit): Promise<postApiV10PageConfigResponse> => {
const res = await fetch(getPostPageConfigUrl(), const res = await fetch(getPostApiV10PageConfigUrl(),
{ {
...options, ...options,
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers }, headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify( body: JSON.stringify(
postPageConfigBody,) postApiV10PageConfigBody,)
} }
) )
const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const body = [204, 205, 304].includes(res.status) ? null : await res.text();
const data: postPageConfigResponse['data'] = body ? JSON.parse(body) : {} const data: postApiV10PageConfigResponse['data'] = body ? JSON.parse(body) : {}
return { data, status: res.status, headers: res.headers } as postPageConfigResponse return { data, status: res.status, headers: res.headers } as postApiV10PageConfigResponse
} }
export const getPostPageConfigMutationOptions = <TError = unknown, export const getPostApiV10PageConfigMutationOptions = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postPageConfig>>, TError,{data: PostPageConfigBody}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postApiV10PageConfig>>, TError,{data: PostApiV10PageConfigBody}, TContext>, fetch?: RequestInit}
): UseMutationOptions<Awaited<ReturnType<typeof postPageConfig>>, TError,{data: PostPageConfigBody}, TContext> => { ): UseMutationOptions<Awaited<ReturnType<typeof postApiV10PageConfig>>, TError,{data: PostApiV10PageConfigBody}, TContext> => {
const mutationKey = ['postPageConfig']; const mutationKey = ['postApiV10PageConfig'];
const {mutation: mutationOptions, fetch: fetchOptions} = options ? const {mutation: mutationOptions, fetch: fetchOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options options
...@@ -747,10 +747,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -747,10 +747,10 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
const mutationFn: MutationFunction<Awaited<ReturnType<typeof postPageConfig>>, {data: PostPageConfigBody}> = (props) => { const mutationFn: MutationFunction<Awaited<ReturnType<typeof postApiV10PageConfig>>, {data: PostApiV10PageConfigBody}> = (props) => {
const {data} = props ?? {}; const {data} = props ?? {};
return postPageConfig(data,fetchOptions) return postApiV10PageConfig(data,fetchOptions)
} }
...@@ -758,23 +758,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ? ...@@ -758,23 +758,23 @@ const {mutation: mutationOptions, fetch: fetchOptions} = options ?
return { mutationFn, ...mutationOptions }} return { mutationFn, ...mutationOptions }}
export type PostPageConfigMutationResult = NonNullable<Awaited<ReturnType<typeof postPageConfig>>> export type PostApiV10PageConfigMutationResult = NonNullable<Awaited<ReturnType<typeof postApiV10PageConfig>>>
export type PostPageConfigMutationBody = PostPageConfigBody export type PostApiV10PageConfigMutationBody = PostApiV10PageConfigBody
export type PostPageConfigMutationError = unknown export type PostApiV10PageConfigMutationError = unknown
/** /**
* @summary Create a pageConfig * @summary Create a pageConfig
*/ */
export const usePostPageConfig = <TError = unknown, export const usePostApiV10PageConfig = <TError = unknown,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postPageConfig>>, TError,{data: PostPageConfigBody}, TContext>, fetch?: RequestInit} TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postApiV10PageConfig>>, TError,{data: PostApiV10PageConfigBody}, TContext>, fetch?: RequestInit}
, queryClient?: QueryClient): UseMutationResult< , queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof postPageConfig>>, Awaited<ReturnType<typeof postApiV10PageConfig>>,
TError, TError,
{data: PostPageConfigBody}, {data: PostApiV10PageConfigBody},
TContext TContext
> => { > => {
const mutationOptions = getPostPageConfigMutationOptions(options); const mutationOptions = getPostApiV10PageConfigMutationOptions(options);
return useMutation(mutationOptions, queryClient); return useMutation(mutationOptions, queryClient);
} }
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* Backend Template API * VietProDev CMS Backend API
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
......
...@@ -68,6 +68,20 @@ const createAxiosInstance = () => { ...@@ -68,6 +68,20 @@ const createAxiosInstance = () => {
}; };
const AXIOS_INSTANCE = createAxiosInstance(); const AXIOS_INSTANCE = createAxiosInstance();
const GET_CACHE_TTL = 2 * 60 * 1000;
const MAX_GET_CACHE_SIZE = 100;
type CustomClientPromise<T> = Promise<T> & {
cancel?: () => void;
};
type CachedGetResponse = {
expiresAt: number;
value: unknown;
};
const inFlightGetRequests = new Map<string, CustomClientPromise<unknown>>();
const cachedGetResponses = new Map<string, CachedGetResponse>();
const shouldSkipAuthHandling = (url?: string | null) => { const shouldSkipAuthHandling = (url?: string | null) => {
if (!url) return false; if (!url) return false;
...@@ -96,23 +110,115 @@ const convertHeaders = (headers?: HeadersInit): Record<string, string> | undefin ...@@ -96,23 +110,115 @@ const convertHeaders = (headers?: HeadersInit): Record<string, string> | undefin
return headers as Record<string, string>; return headers as Record<string, string>;
}; };
const getRequestMethod = (options?: RequestInit) =>
(options?.method || "GET").toUpperCase();
const shouldUseGetCache = (url: string, options?: RequestInit) => {
const method = getRequestMethod(options);
const headers = convertHeaders(options?.headers);
const hasAuthorizationHeader = Object.keys(headers ?? {}).some(
(key) => key.toLowerCase() === "authorization",
);
return (
method === "GET" &&
!options?.body &&
!hasAuthorizationHeader &&
!shouldSkipAuthHandling(url)
);
};
const makeGetCacheKey = (url: string, options?: RequestInit) => {
const headers = convertHeaders(options?.headers);
const headerKey = headers
? Object.entries(headers)
.sort(([left], [right]) => left.localeCompare(right))
.map(([key, value]) => `${key}:${value}`)
.join("|")
: "";
return `${url}::${headerKey}`;
};
const clearGetCache = () => {
inFlightGetRequests.clear();
cachedGetResponses.clear();
};
const trimGetCache = () => {
while (cachedGetResponses.size > MAX_GET_CACHE_SIZE) {
const firstKey = cachedGetResponses.keys().next().value;
if (!firstKey) return;
cachedGetResponses.delete(firstKey);
}
};
const withNoopCancel = <T>(promise: Promise<T>): CustomClientPromise<T> => {
const nextPromise = promise as CustomClientPromise<T>;
nextPromise.cancel = () => {};
return nextPromise;
};
const useCustomClient = <T>(url: string, options?: RequestInit): Promise<T> => { const useCustomClient = <T>(url: string, options?: RequestInit): Promise<T> => {
const method = getRequestMethod(options);
const shouldCacheGet = shouldUseGetCache(url, options);
const cacheKey = shouldCacheGet ? makeGetCacheKey(url, options) : "";
if (shouldCacheGet) {
const cachedResponse = cachedGetResponses.get(cacheKey);
if (cachedResponse && cachedResponse.expiresAt > Date.now()) {
return withNoopCancel(Promise.resolve(cachedResponse.value as T));
}
cachedGetResponses.delete(cacheKey);
const inFlightRequest = inFlightGetRequests.get(cacheKey);
if (inFlightRequest) {
return withNoopCancel(inFlightRequest as Promise<T>);
}
} else if (method !== "GET") {
clearGetCache();
}
const source = Axios.CancelToken.source(); const source = Axios.CancelToken.source();
const axiosConfig: AxiosRequestConfig = { const axiosConfig: AxiosRequestConfig = {
url, url,
method: options?.method || "GET", method,
headers: convertHeaders(options?.headers), headers: convertHeaders(options?.headers),
data: options?.body, data: options?.body,
signal: options?.signal || undefined, signal: options?.signal || undefined,
cancelToken: source.token, cancelToken: source.token,
}; };
const promise = AXIOS_INSTANCE(axiosConfig).then(({ data, status }) => { const promise = AXIOS_INSTANCE(axiosConfig)
return data instanceof Blob ? data : { ...data, statusCode: status }; .then(({ data, status }) => {
}); const response = data instanceof Blob ? data : { ...data, statusCode: status };
if (shouldCacheGet) {
cachedGetResponses.set(cacheKey, {
expiresAt: Date.now() + GET_CACHE_TTL,
value: response,
});
trimGetCache();
} else if (method !== "GET") {
clearGetCache();
}
return response;
})
.finally(() => {
if (shouldCacheGet) {
inFlightGetRequests.delete(cacheKey);
}
}) as CustomClientPromise<T>;
if (shouldCacheGet) {
inFlightGetRequests.set(cacheKey, promise as CustomClientPromise<unknown>);
}
// @ts-expect-error not exist cancel
promise.cancel = () => { promise.cancel = () => {
source.cancel("Query was cancelled"); source.cancel("Query was cancelled");
}; };
......
const GET_CACHE_TTL = 2 * 60 * 1000;
const MAX_GET_CACHE_SIZE = 100;
type CustomClientPromise<T> = Promise<T> & {
cancel?: () => void;
};
type CachedGetResponse = {
expiresAt: number;
value: unknown;
};
const inFlightGetRequests = new Map<string, CustomClientPromise<unknown>>();
const cachedGetResponses = new Map<string, CachedGetResponse>();
const getRequestMethod = (options?: RequestInit) =>
(options?.method || "GET").toUpperCase();
const convertHeaders = (headers?: HeadersInit): Record<string, string> | undefined => {
if (!headers) return undefined;
if (headers instanceof Headers) {
const result: Record<string, string> = {};
headers.forEach((value, key) => {
result[key] = value;
});
return result;
}
if (Array.isArray(headers)) {
const result: Record<string, string> = {};
headers.forEach(([key, value]) => {
result[key] = value;
});
return result;
}
return headers as Record<string, string>;
};
const shouldUseGetCache = (options?: RequestInit) => {
const headers = convertHeaders(options?.headers);
const hasAuthorizationHeader = Object.keys(headers ?? {}).some(
(key) => key.toLowerCase() === "authorization",
);
return getRequestMethod(options) === "GET" && !options?.body && !hasAuthorizationHeader;
};
const makeGetCacheKey = (url: string, options?: RequestInit) => {
const headers = convertHeaders(options?.headers);
const headerKey = headers
? Object.entries(headers)
.sort(([left], [right]) => left.localeCompare(right))
.map(([key, value]) => `${key}:${value}`)
.join("|")
: "";
return `${url}::${headerKey}`;
};
const clearGetCache = () => {
inFlightGetRequests.clear();
cachedGetResponses.clear();
};
const trimGetCache = () => {
while (cachedGetResponses.size > MAX_GET_CACHE_SIZE) {
const firstKey = cachedGetResponses.keys().next().value;
if (!firstKey) return;
cachedGetResponses.delete(firstKey);
}
};
const withNoopCancel = <T>(promise: Promise<T>): CustomClientPromise<T> => {
const nextPromise = promise as CustomClientPromise<T>;
nextPromise.cancel = () => {};
return nextPromise;
};
const useCustomClient = async <T>(url: string, options?: RequestInit): Promise<T> => { const useCustomClient = async <T>(url: string, options?: RequestInit): Promise<T> => {
const response = await fetch(url, { const method = getRequestMethod(options);
method: options?.method || "GET", const shouldCacheGet = shouldUseGetCache(options);
const cacheKey = shouldCacheGet ? makeGetCacheKey(url, options) : "";
if (shouldCacheGet) {
const cachedResponse = cachedGetResponses.get(cacheKey);
if (cachedResponse && cachedResponse.expiresAt > Date.now()) {
return withNoopCancel(Promise.resolve(cachedResponse.value as T));
}
cachedGetResponses.delete(cacheKey);
const inFlightRequest = inFlightGetRequests.get(cacheKey);
if (inFlightRequest) {
return withNoopCancel(inFlightRequest as Promise<T>);
}
} else if (method !== "GET") {
clearGetCache();
}
const promise = fetch(url, {
method,
headers: options?.headers, headers: options?.headers,
body: options?.body, body: options?.body,
signal: options?.signal, signal: options?.signal,
}); })
.then(async (response) => {
const data = await response.json();
const result = { ...data, statusCode: response.status } as T;
if (shouldCacheGet) {
cachedGetResponses.set(cacheKey, {
expiresAt: Date.now() + GET_CACHE_TTL,
value: result,
});
trimGetCache();
} else if (method !== "GET") {
clearGetCache();
}
return result;
})
.finally(() => {
if (shouldCacheGet) {
inFlightGetRequests.delete(cacheKey);
}
}) as CustomClientPromise<T>;
promise.cancel = () => {};
if (shouldCacheGet) {
inFlightGetRequests.set(cacheKey, promise as CustomClientPromise<unknown>);
}
const data = await response.json(); return promise;
return { ...data, statusCode: response.status };
}; };
export { useCustomClient }; export { useCustomClient };
export type ErrorType<Error> = Error; export type ErrorType<Error> = Error;
export type BodyType<BodyData> = BodyData; export type BodyType<BodyData> = BodyData;
\ No newline at end of file
"use client"; "use client";
import React from "react"; import React from "react";
import { useParams, useRouter } from "next/navigation"; import { useParams, useRouter, useSearchParams } from "next/navigation";
import { toast } from "sonner"; import { toast } from "sonner";
import { AdminNewsForm } from "@/components/admin/news-form"; import { AdminNewsForm } from "@/components/admin/news-form";
import { fetchHeaderConfigItems, type CmsHeaderCategoryItem } from "@/lib/api/cms-admin"; import { fetchHeaderConfigItems, type CmsHeaderCategoryItem } from "@/lib/api/cms-admin";
...@@ -9,8 +9,10 @@ import { fetchHeaderConfigItems, type CmsHeaderCategoryItem } from "@/lib/api/cm ...@@ -9,8 +9,10 @@ import { fetchHeaderConfigItems, type CmsHeaderCategoryItem } from "@/lib/api/cm
export default function HeaderCategoryPostFormPage() { export default function HeaderCategoryPostFormPage() {
const params = useParams(); const params = useParams();
const router = useRouter(); const router = useRouter();
const searchParams = useSearchParams();
const categoryId = String(params.categoryId ?? ""); const categoryId = String(params.categoryId ?? "");
const postId = String(params.postId ?? ""); const postId = String(params.postId ?? "");
const returnTo = searchParams.get("returnTo");
const [category, setCategory] = React.useState<CmsHeaderCategoryItem | null>(null); const [category, setCategory] = React.useState<CmsHeaderCategoryItem | null>(null);
const [ready, setReady] = React.useState(false); const [ready, setReady] = React.useState(false);
...@@ -60,7 +62,7 @@ export default function HeaderCategoryPostFormPage() { ...@@ -60,7 +62,7 @@ export default function HeaderCategoryPostFormPage() {
newsId={postId} newsId={postId}
presetHeaderCategoryId={category.id} presetHeaderCategoryId={category.id}
lockedType={category.type === "page" ? "baiviettrang" : "tintuc"} lockedType={category.type === "page" ? "baiviettrang" : "tintuc"}
returnPath={`/admin/header-config/${category.id}/posts`} returnPath={returnTo || `/admin/header-config/${category.id}/posts`}
/> />
); );
} }
...@@ -3,11 +3,12 @@ ...@@ -3,11 +3,12 @@
import React from "react"; import React from "react";
import dayjs from "dayjs"; import dayjs from "dayjs";
import Link from "next/link"; import Link from "next/link";
import { useParams, useRouter } from "next/navigation"; import { useParams, usePathname, useRouter, useSearchParams } from "next/navigation";
import { toast } from "sonner"; import { toast } from "sonner";
import { import {
ArrowLeft, ArrowLeft,
EyeOff, ChevronLeft,
ChevronRight,
FileText, FileText,
Plus, Plus,
Star, Star,
...@@ -63,7 +64,7 @@ function HeaderCategoryPostsLoading() { ...@@ -63,7 +64,7 @@ function HeaderCategoryPostsLoading() {
key={`loading-${index}`} key={`loading-${index}`}
className={index % 2 === 0 ? "bg-white" : "bg-[#063e8e]/[0.03]"} className={index % 2 === 0 ? "bg-white" : "bg-[#063e8e]/[0.03]"}
> >
<TableCell colSpan={7} className="px-4 py-4"> <TableCell colSpan={6} className="px-4 py-4">
<div className="h-20 animate-pulse rounded-2xl bg-[#063e8e]/10" /> <div className="h-20 animate-pulse rounded-2xl bg-[#063e8e]/10" />
</TableCell> </TableCell>
</TableRow> </TableRow>
...@@ -73,12 +74,39 @@ function HeaderCategoryPostsLoading() { ...@@ -73,12 +74,39 @@ function HeaderCategoryPostsLoading() {
export default function HeaderCategoryPostsPage() { export default function HeaderCategoryPostsPage() {
const params = useParams(); const params = useParams();
const router = useRouter(); const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const categoryId = String(params.categoryId ?? ""); const categoryId = String(params.categoryId ?? "");
const [items, setItems] = React.useState<CmsNewsItem[]>([]); const [items, setItems] = React.useState<CmsNewsItem[]>([]);
const [headerItems, setHeaderItems] = React.useState<CmsHeaderCategoryItem[]>([]); const [headerItems, setHeaderItems] = React.useState<CmsHeaderCategoryItem[]>([]);
const [search, setSearch] = React.useState(""); const [search, setSearch] = React.useState(() => searchParams.get("q") ?? "");
const [ready, setReady] = React.useState(false); const [ready, setReady] = React.useState(false);
const [deleteTarget, setDeleteTarget] = React.useState<CmsNewsItem | null>(null); const [deleteTarget, setDeleteTarget] = React.useState<CmsNewsItem | null>(null);
const didMountRef = React.useRef(false);
const [page, setPage] = React.useState(() => {
const parsedPage = Number(searchParams.get("page") ?? 1);
return Number.isFinite(parsedPage) && parsedPage > 0 ? Math.floor(parsedPage) : 1;
});
const [pageSize] = React.useState(20);
const listQueryString = React.useMemo(() => {
const nextParams = new URLSearchParams();
if (page > 1) {
nextParams.set("page", String(page));
}
if (search.trim()) {
nextParams.set("q", search.trim());
}
return nextParams.toString();
}, [page, search]);
const listPath = React.useMemo(
() => (listQueryString ? `${pathname}?${listQueryString}` : pathname),
[listQueryString, pathname],
);
React.useEffect(() => { React.useEffect(() => {
let cancelled = false; let cancelled = false;
...@@ -124,7 +152,11 @@ export default function HeaderCategoryPostsPage() { ...@@ -124,7 +152,11 @@ export default function HeaderCategoryPostsPage() {
const categoryPosts = React.useMemo(() => { const categoryPosts = React.useMemo(() => {
return items return items
.filter((item) => item.header_category_id === categoryId) .filter(
(item) =>
item.header_category_id === categoryId ||
item.category_ids.includes(categoryId),
)
.sort((left, right) => { .sort((left, right) => {
const leftFeatured = left.type === "tintuc" && left.is_featured ? 1 : 0; const leftFeatured = left.type === "tintuc" && left.is_featured ? 1 : 0;
const rightFeatured = right.type === "tintuc" && right.is_featured ? 1 : 0; const rightFeatured = right.type === "tintuc" && right.is_featured ? 1 : 0;
...@@ -152,6 +184,11 @@ export default function HeaderCategoryPostsPage() { ...@@ -152,6 +184,11 @@ export default function HeaderCategoryPostsPage() {
}); });
}, [categoryPosts, search]); }, [categoryPosts, search]);
const totalPages = Math.ceil(filteredPosts.length / pageSize);
const paginatedPosts = React.useMemo(() => {
const start = (page - 1) * pageSize;
return filteredPosts.slice(start, start + pageSize);
}, [filteredPosts, page, pageSize]);
const isSinglePostCategory = category?.type === "page"; const isSinglePostCategory = category?.type === "page";
const createHref = `/admin/header-config/${categoryId}/posts/new`; const createHref = `/admin/header-config/${categoryId}/posts/new`;
...@@ -162,6 +199,30 @@ export default function HeaderCategoryPostsPage() { ...@@ -162,6 +199,30 @@ export default function HeaderCategoryPostsPage() {
} }
}, [canManagePosts, category, ready, router]); }, [canManagePosts, category, ready, router]);
React.useEffect(() => {
const nextPath = listQueryString ? `${pathname}?${listQueryString}` : pathname;
const currentPath = `${pathname}${searchParams.toString() ? `?${searchParams.toString()}` : ""}`;
if (nextPath !== currentPath) {
router.replace(nextPath, { scroll: false });
}
}, [listQueryString, pathname, router, searchParams]);
React.useEffect(() => {
if (!didMountRef.current) {
didMountRef.current = true;
return;
}
setPage((currentPage) => (currentPage === 1 ? currentPage : 1));
}, [search]);
React.useEffect(() => {
if (totalPages > 0 && page > totalPages) {
setPage(totalPages);
}
}, [page, totalPages]);
const stats = React.useMemo(() => { const stats = React.useMemo(() => {
return [ return [
{ {
...@@ -195,6 +256,12 @@ export default function HeaderCategoryPostsPage() { ...@@ -195,6 +256,12 @@ export default function HeaderCategoryPostsPage() {
} }
}; };
const handlePageChange = (newPage: number) => {
if (newPage >= 1 && newPage <= totalPages) {
setPage(newPage);
}
};
if (!ready || !category || !canManagePosts) { if (!ready || !category || !canManagePosts) {
return ( return (
<div className="rounded-2xl border border-[#063e8e]/15 bg-white p-8 text-center text-sm text-gray-700 shadow-sm"> <div className="rounded-2xl border border-[#063e8e]/15 bg-white p-8 text-center text-sm text-gray-700 shadow-sm">
...@@ -239,16 +306,12 @@ export default function HeaderCategoryPostsPage() { ...@@ -239,16 +306,12 @@ export default function HeaderCategoryPostsPage() {
actionIcon={<Plus className="mr-2 h-4 w-4" />} actionIcon={<Plus className="mr-2 h-4 w-4" />}
actionDisabled={isSinglePostCategory && categoryPosts.length >= 1} actionDisabled={isSinglePostCategory && categoryPosts.length >= 1}
onSearchChange={setSearch} onSearchChange={setSearch}
onActionClick={() => router.push(createHref)} onActionClick={() =>
filters={ router.push(`${createHref}?returnTo=${encodeURIComponent(listPath)}`)
<div className="rounded-xl border border-[#063e8e]/15 bg-[#063e8e]/[0.03] px-4 py-2 text-sm text-gray-700">
<span className="font-semibold text-[#063e8e]">{categoryPosts.length}</span>{" "}
bài viết thuộc danh mục này
</div>
} }
> >
<div className="scrollbar overflow-x-auto"> <div className="scrollbar overflow-x-auto">
<Table className="min-w-[980px] table-fixed"> <Table className="min-w-[900px] table-fixed">
<TableHeader> <TableHeader>
<TableRow className="border-0 bg-[#063e8e] hover:bg-[#063e8e]"> <TableRow className="border-0 bg-[#063e8e] hover:bg-[#063e8e]">
<TableHead className="w-[300px] py-4 text-center text-white"> <TableHead className="w-[300px] py-4 text-center text-white">
...@@ -266,10 +329,7 @@ export default function HeaderCategoryPostsPage() { ...@@ -266,10 +329,7 @@ export default function HeaderCategoryPostsPage() {
<TableHead className="w-[170px] py-4 text-center text-white"> <TableHead className="w-[170px] py-4 text-center text-white">
Ngày hết hạn Ngày hết hạn
</TableHead> </TableHead>
<TableHead className="w-[120px] py-4 text-center text-white"> <TableHead className="w-[130px] py-4 text-center text-white">
Hiển thị
</TableHead>
<TableHead className="w-[100px] py-4 text-center text-white">
Thao tác Thao tác
</TableHead> </TableHead>
</TableRow> </TableRow>
...@@ -279,14 +339,14 @@ export default function HeaderCategoryPostsPage() { ...@@ -279,14 +339,14 @@ export default function HeaderCategoryPostsPage() {
<HeaderCategoryPostsLoading /> <HeaderCategoryPostsLoading />
) : filteredPosts.length === 0 ? ( ) : filteredPosts.length === 0 ? (
<TableRow> <TableRow>
<TableCell colSpan={7} className="py-12 text-center text-sm text-gray-700"> <TableCell colSpan={6} className="py-12 text-center text-sm text-gray-700">
{categoryPosts.length === 0 {categoryPosts.length === 0
? "Danh mục này chưa có bài viết nào." ? "Danh mục này chưa có bài viết nào."
: "Không có bài viết nào phù hợp."} : "Không có bài viết nào phù hợp."}
</TableCell> </TableCell>
</TableRow> </TableRow>
) : ( ) : (
filteredPosts.map((item, index) => ( paginatedPosts.map((item, index) => (
<TableRow <TableRow
key={item.id} key={item.id}
className={index % 2 === 0 ? "bg-white" : "bg-[#063e8e]/[0.03]"} className={index % 2 === 0 ? "bg-white" : "bg-[#063e8e]/[0.03]"}
...@@ -337,40 +397,95 @@ export default function HeaderCategoryPostsPage() { ...@@ -337,40 +397,95 @@ export default function HeaderCategoryPostsPage() {
</TableCell> </TableCell>
<TableCell className="text-center"> <TableCell className="text-center">
{item.is_hidden ? ( <AdminRowActions
<span className="inline-flex items-center rounded-full border border-gray-300 px-2.5 py-1 text-sm text-gray-700"> actions={[
<EyeOff className="mr-1.5 h-3.5 w-3.5" /> {
Ẩn kind: item.is_hidden ? "hidden" : "visible",
</span> label: item.is_hidden
) : ( ? "B\u00e0i vi\u1ebft \u0111ang \u1ea9n"
<span className="inline-flex items-center rounded-full border border-[#063e8e]/20 bg-[#063e8e]/10 px-2.5 py-1 text-sm text-[#063e8e]"> : "B\u00e0i vi\u1ebft \u0111ang hi\u1ec3n th\u1ecb",
Hiển thị },
</span> {
)} kind: "edit",
label: "Ch\u1ec9nh s\u1eeda b\u00e0i vi\u1ebft",
onClick: () =>
router.push(
`/admin/header-config/${categoryId}/posts/${item.id}?returnTo=${encodeURIComponent(listPath)}`,
),
},
{
kind: "delete",
label: "X\u00f3a b\u00e0i vi\u1ebft",
onClick: () => setDeleteTarget(item),
},
]}
/>
</TableCell> </TableCell>
<TableCell className="text-center">
<AdminRowActions
actions={[
{
kind: "edit",
label: "Chỉnh sửa bài viết",
onClick: () => router.push(`/admin/header-config/${categoryId}/posts/${item.id}`),
},
{
kind: "delete",
label: "Xóa bài viết",
onClick: () => setDeleteTarget(item),
},
]}
/>
</TableCell>
</TableRow> </TableRow>
)) ))
)} )}
</TableBody> </TableBody>
</Table> </Table>
</div> </div>
{totalPages > 1 && (
<div className="flex items-center justify-between border-t border-[#063e8e]/10 px-4 py-3">
<div className="text-sm text-gray-700">
{"Hi\u1ec3n th\u1ecb"} {(page - 1) * pageSize + 1} {"\u0111\u1ebfn"}{" "}
{Math.min(page * pageSize, filteredPosts.length)} {"c\u1ee7a"}{" "}
{filteredPosts.length} {"b\u00e0i vi\u1ebft"}
</div>
<div className="flex items-center gap-2">
<Button
variant="outline"
size="icon"
className="h-8 w-8 border-[#063e8e]/15 bg-white text-[#063e8e] hover:bg-[#063e8e]/10"
onClick={() => handlePageChange(page - 1)}
disabled={page === 1}
>
<ChevronLeft className="h-4 w-4" />
</Button>
<div className="flex items-center gap-1">
{Array.from({ length: Math.min(totalPages, 5) }, (_, index) => {
let pageNum;
if (totalPages <= 5) {
pageNum = index + 1;
} else if (page <= 3) {
pageNum = index + 1;
} else if (page >= totalPages - 2) {
pageNum = totalPages - 4 + index;
} else {
pageNum = page - 2 + index;
}
return (
<Button
key={pageNum}
variant={page === pageNum ? "default" : "outline"}
size="icon"
className={
page === pageNum
? "h-8 w-8 bg-[#063e8e] text-white hover:bg-[#063e8e]/90"
: "h-8 w-8 border-[#063e8e]/15 bg-white text-[#063e8e] hover:bg-[#063e8e]/10"
}
onClick={() => handlePageChange(pageNum)}
>
{pageNum}
</Button>
);
})}
</div>
<Button
variant="outline"
size="icon"
className="h-8 w-8 border-[#063e8e]/15 bg-white text-[#063e8e] hover:bg-[#063e8e]/10"
onClick={() => handlePageChange(page + 1)}
disabled={page === totalPages}
>
<ChevronRight className="h-4 w-4" />
</Button>
</div>
</div>
)}
</AdminTableLayout> </AdminTableLayout>
<AdminDeleteDialog <AdminDeleteDialog
......
...@@ -4,12 +4,17 @@ interface AdminNewsDetailPageProps { ...@@ -4,12 +4,17 @@ interface AdminNewsDetailPageProps {
params: Promise<{ params: Promise<{
id: string; id: string;
}>; }>;
searchParams: Promise<{
returnTo?: string;
}>;
} }
export default async function AdminNewsDetailPage({ export default async function AdminNewsDetailPage({
params, params,
searchParams,
}: AdminNewsDetailPageProps) { }: AdminNewsDetailPageProps) {
const { id } = await params; const { id } = await params;
const { returnTo } = await searchParams;
return <AdminNewsForm newsId={id} />; return <AdminNewsForm newsId={id} returnPath={returnTo || "/admin/news"} />;
} }
...@@ -5,13 +5,12 @@ import dayjs from "dayjs"; ...@@ -5,13 +5,12 @@ import dayjs from "dayjs";
import { import {
Check, Check,
ChevronsUpDown, ChevronsUpDown,
EyeOff,
Plus, Plus,
Star, Star,
Tag, Tag,
} from "lucide-react"; } from "lucide-react";
import Link from "next/link"; import Link from "next/link";
import { useRouter } from "next/navigation"; import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { toast } from "sonner"; import { toast } from "sonner";
import { AdminDeleteDialog } from "@/components/admin/admin-delete-dialog"; import { AdminDeleteDialog } from "@/components/admin/admin-delete-dialog";
import { AdminRowActions } from "@/components/admin/admin-row-actions"; import { AdminRowActions } from "@/components/admin/admin-row-actions";
...@@ -46,6 +45,7 @@ import { ...@@ -46,6 +45,7 @@ import {
import { import {
deleteCmsNewsItem, deleteCmsNewsItem,
fetchCmsNewsItems, fetchCmsNewsItems,
fetchCmsPostCount,
fetchHeaderConfigItems, fetchHeaderConfigItems,
} from "@/lib/api/cms-admin"; } from "@/lib/api/cms-admin";
import { ChevronLeft, ChevronRight } from "lucide-react"; import { ChevronLeft, ChevronRight } from "lucide-react";
...@@ -177,6 +177,22 @@ function formatDateTime(value: string) { ...@@ -177,6 +177,22 @@ function formatDateTime(value: string) {
return value ? dayjs(value).format("DD/MM/YYYY HH:mm") : "—"; return value ? dayjs(value).format("DD/MM/YYYY HH:mm") : "—";
} }
function getDisplayCategoryNames(
item: AdminNewsItem,
categories: HeaderCategoryItem[],
) {
const categoryIds = Array.from(
new Set([
...item.category_ids,
...(item.header_category_id ? [item.header_category_id] : []),
]),
);
return categoryIds
.map((categoryId) => categories.find((entry) => entry.id === categoryId)?.name)
.filter((name): name is string => Boolean(name));
}
function useDebouncedValue<T>(value: T, delay = 350) { function useDebouncedValue<T>(value: T, delay = 350) {
const [debouncedValue, setDebouncedValue] = React.useState(value); const [debouncedValue, setDebouncedValue] = React.useState(value);
...@@ -197,7 +213,7 @@ function AdminNewsTableLoading() { ...@@ -197,7 +213,7 @@ function AdminNewsTableLoading() {
key={`loading-${index}`} key={`loading-${index}`}
className={index % 2 === 0 ? "bg-white" : "bg-[#063e8e]/[0.03]"} className={index % 2 === 0 ? "bg-white" : "bg-[#063e8e]/[0.03]"}
> >
<TableCell colSpan={8} className="px-4 py-4"> <TableCell colSpan={7} className="px-4 py-4">
<div className="h-20 animate-pulse rounded-2xl bg-[#063e8e]/10" /> <div className="h-20 animate-pulse rounded-2xl bg-[#063e8e]/10" />
</TableCell> </TableCell>
</TableRow> </TableRow>
...@@ -206,20 +222,89 @@ function AdminNewsTableLoading() { ...@@ -206,20 +222,89 @@ function AdminNewsTableLoading() {
export default function AdminNewsPage() { export default function AdminNewsPage() {
const router = useRouter(); const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const [items, setItems] = React.useState<AdminNewsItem[]>([]); const [items, setItems] = React.useState<AdminNewsItem[]>([]);
const [headerItems, setHeaderItems] = React.useState<HeaderCategoryItem[]>([]); const [headerItems, setHeaderItems] = React.useState<HeaderCategoryItem[]>([]);
const [search, setSearch] = React.useState(""); const [search, setSearch] = React.useState(() => searchParams.get("q") ?? "");
const [typeFilter, setTypeFilter] = React.useState("all"); const [typeFilter, setTypeFilter] = React.useState(
const [categoryFilter, setCategoryFilter] = React.useState("all"); () => searchParams.get("type") ?? "all",
const [statusFilter, setStatusFilter] = React.useState("all"); );
const [categoryFilter, setCategoryFilter] = React.useState(
() => searchParams.get("category") ?? "all",
);
const [statusFilter, setStatusFilter] = React.useState(
() => searchParams.get("status") ?? "all",
);
const [deleteTarget, setDeleteTarget] = React.useState<AdminNewsItem | null>(null); const [deleteTarget, setDeleteTarget] = React.useState<AdminNewsItem | null>(null);
const [ready, setReady] = React.useState(false); const [ready, setReady] = React.useState(false);
const [isDeleting, setIsDeleting] = React.useState(false); const [isDeleting, setIsDeleting] = React.useState(false);
const [page, setPage] = React.useState(1); const [page, setPage] = React.useState(() => {
const parsedPage = Number(searchParams.get("page") ?? 1);
return Number.isFinite(parsedPage) && parsedPage > 0 ? Math.floor(parsedPage) : 1;
});
const [pageSize] = React.useState(20); const [pageSize] = React.useState(20);
const [total, setTotal] = React.useState(0); const [total, setTotal] = React.useState(0);
const [publishedTotal, setPublishedTotal] = React.useState(0);
const [featuredTotal, setFeaturedTotal] = React.useState(0);
const didMountRef = React.useRef(false);
const debouncedSearch = useDebouncedValue(search); const debouncedSearch = useDebouncedValue(search);
const listQueryString = React.useMemo(() => {
const params = new URLSearchParams();
if (page > 1) {
params.set("page", String(page));
}
if (debouncedSearch.trim()) {
params.set("q", debouncedSearch.trim());
}
if (typeFilter !== "all") {
params.set("type", typeFilter);
}
if (categoryFilter !== "all") {
params.set("category", categoryFilter);
}
if (statusFilter !== "all") {
params.set("status", statusFilter);
}
return params.toString();
}, [categoryFilter, debouncedSearch, page, statusFilter, typeFilter]);
const listPath = React.useMemo(
() => (listQueryString ? `${pathname}?${listQueryString}` : pathname),
[listQueryString, pathname],
);
React.useEffect(() => {
void fetchHeaderConfigItems()
.then((headerConfig) => {
setHeaderItems(headerConfig.items);
})
.catch((error) => {
toast.error(
error instanceof Error
? error.message
: "Kh\u00f4ng th\u1ec3 t\u1ea3i danh m\u1ee5c hi\u1ec3n th\u1ecb",
);
});
}, []);
const loadStats = React.useCallback(async () => {
const [nextPublishedTotal, nextFeaturedTotal] = await Promise.all([
fetchCmsPostCount("status==published"),
fetchCmsPostCount("is_featured==true"),
]);
setPublishedTotal(nextPublishedTotal);
setFeaturedTotal(nextFeaturedTotal);
}, []);
const apiFilters = React.useMemo(() => { const apiFilters = React.useMemo(() => {
const filters: string[] = []; const filters: string[] = [];
const keyword = debouncedSearch.trim(); const keyword = debouncedSearch.trim();
...@@ -244,23 +329,29 @@ export default function AdminNewsPage() { ...@@ -244,23 +329,29 @@ export default function AdminNewsPage() {
const load = React.useCallback(async () => { const load = React.useCallback(async () => {
setReady(false); setReady(false);
const [newsData, headerConfig] = await Promise.all([ const newsData = await fetchCmsNewsItems({
fetchCmsNewsItems({ page,
page, pageSize,
pageSize, sortField: "created_at",
sortField: "created_at", sortOrder: "desc",
sortOrder: "desc", filters: apiFilters,
filters: apiFilters, });
}),
fetchHeaderConfigItems(),
]);
setItems(newsData.items); setItems(newsData.items);
setTotal(newsData.total); setTotal(newsData.total);
setHeaderItems(headerConfig.items);
setReady(true); setReady(true);
}, [apiFilters, page, pageSize]); }, [apiFilters, page, pageSize]);
React.useEffect(() => {
void loadStats().catch((error) => {
toast.error(
error instanceof Error
? error.message
: "Kh\u00f4ng th\u1ec3 t\u1ea3i s\u1ed1 li\u1ec7u b\u00e0i vi\u1ebft",
);
});
}, [loadStats]);
React.useEffect(() => { React.useEffect(() => {
void load().catch((error) => { void load().catch((error) => {
toast.error( toast.error(
...@@ -273,6 +364,20 @@ export default function AdminNewsPage() { ...@@ -273,6 +364,20 @@ export default function AdminNewsPage() {
}, [load]); }, [load]);
React.useEffect(() => { React.useEffect(() => {
const nextPath = listQueryString ? `${pathname}?${listQueryString}` : pathname;
const currentPath = `${pathname}${searchParams.toString() ? `?${searchParams.toString()}` : ""}`;
if (nextPath !== currentPath) {
router.replace(nextPath, { scroll: false });
}
}, [listQueryString, pathname, router, searchParams]);
React.useEffect(() => {
if (!didMountRef.current) {
didMountRef.current = true;
return;
}
setPage((currentPage) => (currentPage === 1 ? currentPage : 1)); setPage((currentPage) => (currentPage === 1 ? currentPage : 1));
}, [apiFilters, typeFilter]); }, [apiFilters, typeFilter]);
...@@ -299,16 +404,16 @@ export default function AdminNewsPage() { ...@@ -299,16 +404,16 @@ export default function AdminNewsPage() {
}, },
{ {
label: "Đang hiển thị", label: "Đang hiển thị",
value: filteredItems.filter((item) => !item.is_hidden).length, value: publishedTotal,
icon: <Tag className="h-4 w-4 text-[#063e8e]" />, icon: <Tag className="h-4 w-4 text-[#063e8e]" />,
}, },
{ {
label: "Tin nổi bật", label: "Tin nổi bật",
value: filteredItems.filter((item) => item.type === "tintuc" && item.is_featured).length, value: featuredTotal,
icon: <Tag className="h-4 w-4 text-[#063e8e]" />, icon: <Tag className="h-4 w-4 text-[#063e8e]" />,
}, },
]; ];
}, [filteredItems, total]); }, [featuredTotal, publishedTotal, total]);
const handleDelete = async () => { const handleDelete = async () => {
if (!deleteTarget || isDeleting) return; if (!deleteTarget || isDeleting) return;
...@@ -319,7 +424,7 @@ export default function AdminNewsPage() { ...@@ -319,7 +424,7 @@ export default function AdminNewsPage() {
await deleteCmsNewsItem(deleteTarget.id); await deleteCmsNewsItem(deleteTarget.id);
toast.success("Đã xóa bài viết"); toast.success("Đã xóa bài viết");
setDeleteTarget(null); setDeleteTarget(null);
await load(); await Promise.all([load(), loadStats()]);
} catch (error) { } catch (error) {
toast.error( toast.error(
error instanceof Error ? error.message : "Không thể xóa bài viết", error instanceof Error ? error.message : "Không thể xóa bài viết",
...@@ -396,7 +501,7 @@ export default function AdminNewsPage() { ...@@ -396,7 +501,7 @@ export default function AdminNewsPage() {
} }
> >
<div className="scrollbar overflow-x-auto"> <div className="scrollbar overflow-x-auto">
<Table className="min-w-[1250px] table-fixed"> <Table className="min-w-[1120px] table-fixed">
<TableHeader> <TableHeader>
<TableRow className="border-0 bg-[#063e8e] hover:bg-[#063e8e]"> <TableRow className="border-0 bg-[#063e8e] hover:bg-[#063e8e]">
<TableHead className="w-[260px] py-4 text-center text-white"> <TableHead className="w-[260px] py-4 text-center text-white">
...@@ -417,10 +522,7 @@ export default function AdminNewsPage() { ...@@ -417,10 +522,7 @@ export default function AdminNewsPage() {
<TableHead className="w-[170px] py-4 text-center text-white"> <TableHead className="w-[170px] py-4 text-center text-white">
Ngày hết hạn Ngày hết hạn
</TableHead> </TableHead>
<TableHead className="w-[120px] py-4 text-center text-white"> <TableHead className="w-[130px] py-4 text-center text-white">
Hiển thị
</TableHead>
<TableHead className="w-[100px] py-4 text-center text-white">
Thao tác Thao tác
</TableHead> </TableHead>
</TableRow> </TableRow>
...@@ -431,13 +533,15 @@ export default function AdminNewsPage() { ...@@ -431,13 +533,15 @@ export default function AdminNewsPage() {
<AdminNewsTableLoading /> <AdminNewsTableLoading />
) : filteredItems.length === 0 ? ( ) : filteredItems.length === 0 ? (
<TableRow> <TableRow>
<TableCell colSpan={8} className="py-12 text-center text-sm text-gray-700"> <TableCell colSpan={7} className="py-12 text-center text-sm text-gray-700">
Không có bài viết nào phù hợp. Không có bài viết nào phù hợp.
</TableCell> </TableCell>
</TableRow> </TableRow>
) : ( ) : (
filteredItems.map((item, index) => { filteredItems.map((item, index) => {
const category = headerItems.find((entry) => entry.id === item.header_category_id); const categoryNames = getDisplayCategoryNames(item, headerItems);
const primaryCategoryName = categoryNames[0] ?? "\u2014";
const extraCategoryCount = Math.max(categoryNames.length - 1, 0);
return ( return (
<TableRow <TableRow
...@@ -482,7 +586,8 @@ export default function AdminNewsPage() { ...@@ -482,7 +586,8 @@ export default function AdminNewsPage() {
</TableCell> </TableCell>
<TableCell className="text-center text-sm text-gray-700"> <TableCell className="text-center text-sm text-gray-700">
{category?.name || "—"} {primaryCategoryName}
{extraCategoryCount > 0 ? ` (+${extraCategoryCount})` : ""}
</TableCell> </TableCell>
<TableCell className="text-center text-sm text-gray-700"> <TableCell className="text-center text-sm text-gray-700">
...@@ -492,27 +597,22 @@ export default function AdminNewsPage() { ...@@ -492,27 +597,22 @@ export default function AdminNewsPage() {
<TableCell className="text-center text-sm text-gray-700"> <TableCell className="text-center text-sm text-gray-700">
{formatDateTime(item.expired_at)} {formatDateTime(item.expired_at)}
</TableCell> </TableCell>
<TableCell className="text-center">
{item.is_hidden ? (
<span className="inline-flex items-center rounded-full border border-gray-300 px-2.5 py-1 text-sm text-gray-700">
<EyeOff className="mr-1.5 h-3.5 w-3.5" />
Ẩn
</span>
) : (
<span className="inline-flex items-center rounded-full border border-[#063e8e]/20 bg-[#063e8e]/10 px-2.5 py-1 text-sm text-[#063e8e]">
Hiển thị
</span>
)}
</TableCell>
<TableCell className="text-center"> <TableCell className="text-center">
<AdminRowActions <AdminRowActions
actions={[ actions={[
{
kind: item.is_hidden ? "hidden" : "visible",
label: item.is_hidden
? "B\u00e0i vi\u1ebft \u0111ang \u1ea9n"
: "B\u00e0i vi\u1ebft \u0111ang hi\u1ec3n th\u1ecb",
},
{ {
kind: "edit", kind: "edit",
label: "Chỉnh sửa bài viết", label: "Chỉnh sửa bài viết",
onClick: () => router.push(`/admin/news/${item.id}`), onClick: () =>
router.push(
`/admin/news/${item.id}?returnTo=${encodeURIComponent(listPath)}`,
),
}, },
{ {
kind: "delete", kind: "delete",
......
...@@ -5,6 +5,7 @@ import type { ReactNode } from "react"; ...@@ -5,6 +5,7 @@ import type { ReactNode } from "react";
import Link from "next/link"; import Link from "next/link";
import { import {
Eye, Eye,
EyeOff,
FileText, FileText,
FolderPlus, FolderPlus,
PencilLine, PencilLine,
...@@ -14,7 +15,14 @@ import { ...@@ -14,7 +15,14 @@ import {
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
type AdminRowActionKind = "edit" | "view" | "delete" | "manage" | "create-child"; type AdminRowActionKind =
| "edit"
| "view"
| "hidden"
| "visible"
| "delete"
| "manage"
| "create-child";
type AdminRowActionBase = { type AdminRowActionBase = {
label: string; label: string;
...@@ -30,6 +38,14 @@ type AdminRowAction = ...@@ -30,6 +38,14 @@ type AdminRowAction =
kind: "view"; kind: "view";
onClick: () => void; onClick: () => void;
}) })
| (AdminRowActionBase & {
kind: "visible";
onClick?: () => void;
})
| (AdminRowActionBase & {
kind: "hidden";
onClick?: () => void;
})
| (AdminRowActionBase & { | (AdminRowActionBase & {
kind: "delete"; kind: "delete";
onClick: () => void; onClick: () => void;
...@@ -65,6 +81,16 @@ const actionStyles: Record< ...@@ -65,6 +81,16 @@ const actionStyles: Record<
"border-emerald-100 bg-white text-emerald-600 hover:border-emerald-200 hover:bg-emerald-50 hover:text-emerald-700", "border-emerald-100 bg-white text-emerald-600 hover:border-emerald-200 hover:bg-emerald-50 hover:text-emerald-700",
icon: <Eye className="h-4 w-4" />, icon: <Eye className="h-4 w-4" />,
}, },
visible: {
button:
"border-emerald-100 bg-white text-emerald-600 hover:border-emerald-200 hover:bg-emerald-50 hover:text-emerald-700",
icon: <Eye className="h-4 w-4" />,
},
hidden: {
button:
"border-red-100 bg-white text-red-600 hover:border-red-200 hover:bg-red-50 hover:text-red-700",
icon: <EyeOff className="h-4 w-4" />,
},
delete: { delete: {
button: button:
"border-red-100 bg-white text-red-600 hover:border-red-200 hover:bg-red-50 hover:text-red-700", "border-red-100 bg-white text-red-600 hover:border-red-200 hover:bg-red-50 hover:text-red-700",
......
...@@ -79,6 +79,8 @@ const selectContentClassName = "border-[#063e8e]/15 bg-white text-gray-700"; ...@@ -79,6 +79,8 @@ const selectContentClassName = "border-[#063e8e]/15 bg-white text-gray-700";
const selectItemClassName = const selectItemClassName =
"text-gray-700 focus:bg-[#063e8e]/10 focus:text-[#063e8e]"; "text-gray-700 focus:bg-[#063e8e]/10 focus:text-[#063e8e]";
const SEARCH_TAG_VISIBLE_LIMIT = 20;
function flattenHeaderTree( function flattenHeaderTree(
items: HeaderCategoryTreeItem[], items: HeaderCategoryTreeItem[],
depth = 0, depth = 0,
...@@ -99,9 +101,9 @@ function isCategoryCompatible( ...@@ -99,9 +101,9 @@ function isCategoryCompatible(
postType: AdminNewsType | "", postType: AdminNewsType | "",
) { ) {
if (!postType) return true; if (!postType) return true;
if (headerType === "news") return postType !== "baiviettrang"; if (postType === "tintuc") return headerType === "news";
if (headerType === "page") return postType === "baiviettrang"; if (postType === "baiviettrang") return headerType === "page";
return true; return false;
} }
function toImageRef(item: AdminMediaItem): AdminNewsImageRef { function toImageRef(item: AdminMediaItem): AdminNewsImageRef {
...@@ -259,6 +261,124 @@ function HeaderCategoryCombobox({ ...@@ -259,6 +261,124 @@ function HeaderCategoryCombobox({
); );
} }
function HeaderCategoryMultiPicker({
values,
options,
disabled,
onChange,
}: {
values: string[];
options: Array<{
id: string;
name: string;
type: HeaderCategoryItem["type"];
depth: number;
}>;
disabled?: boolean;
onChange: (values: string[]) => void;
}) {
const [search, setSearch] = React.useState("");
const selectedIds = React.useMemo(() => new Set(values), [values]);
const selectedOptions = React.useMemo(
() => options.filter((option) => selectedIds.has(option.id)),
[options, selectedIds],
);
const filteredOptions = React.useMemo(() => {
const keyword = search.trim().toLowerCase();
const availableOptions = options.filter((option) => !selectedIds.has(option.id));
const matchedOptions = keyword
? availableOptions.filter((option) =>
option.name.toLowerCase().includes(keyword),
)
: availableOptions;
return [...selectedOptions, ...matchedOptions.slice(0, 20)];
}, [options, search, selectedIds, selectedOptions]);
const toggleValue = (id: string, checked: boolean) => {
onChange(checked ? [...values, id] : values.filter((item) => item !== id));
};
return (
<div className="space-y-2">
<div className="mb-3 flex flex-col gap-3 md:flex-row md:items-end md:justify-between">
<div className="min-w-0 flex-1">
<Label className="mb-1.5 block text-gray-700">
Danh mục hiển thị <span className="text-red-600">*</span>
</Label>
<Input
value={search}
onChange={(event) => setSearch(event.target.value)}
placeholder="Tìm danh mục theo tên"
disabled={disabled}
className={fieldClassName}
/>
</div>
<div className="rounded-lg border border-[#063e8e]/10 bg-white px-3 py-2 text-sm text-gray-700">
Đã chọn {values.length} danh mục
</div>
</div>
<div className="max-h-64 overflow-y-auto rounded-xl border border-[#063e8e]/10 bg-white p-2">
{filteredOptions.length > 0 ? (
<div className="grid grid-cols-1 gap-2 md:grid-cols-2">
{filteredOptions.map((option) => (
<label
key={option.id}
className="flex items-center gap-3 rounded-lg border border-[#063e8e]/10 bg-white px-3 py-2"
>
<Checkbox
checked={selectedIds.has(option.id)}
disabled={disabled}
onCheckedChange={(checked) => toggleValue(option.id, checked === true)}
className="border-[#063e8e]/30 data-[state=checked]:border-[#063e8e] data-[state=checked]:bg-[#063e8e]"
/>
<span className="min-w-0 truncate text-sm text-gray-700">
{formatHeaderCategoryOptionLabel(option)}
</span>
</label>
))}
</div>
) : (
<p className="px-3 py-2 text-sm text-gray-700">
{"Kh\u00f4ng t\u00ecm th\u1ea5y danh m\u1ee5c ph\u00f9 h\u1ee3p."}
</p>
)}
</div>
</div>
);
}
function HeaderCategorySinglePicker({
value,
options,
disabled,
onChange,
}: {
value: string;
options: Array<{
id: string;
name: string;
type: HeaderCategoryItem["type"];
depth: number;
}>;
disabled?: boolean;
onChange: (value: string) => void;
}) {
return (
<div className="space-y-2">
<Label className="mb-1.5 block text-gray-700">
Danh mục hiển thị <span className="text-red-600">*</span>
</Label>
<HeaderCategoryCombobox
value={value}
onChange={onChange}
disabled={disabled}
options={options}
/>
</div>
);
}
export function AdminNewsForm({ export function AdminNewsForm({
newsId, newsId,
presetHeaderCategoryId, presetHeaderCategoryId,
...@@ -275,6 +395,7 @@ export function AdminNewsForm({ ...@@ -275,6 +395,7 @@ export function AdminNewsForm({
const [allTags, setAllTags] = React.useState<CmsTagItem[]>([]); const [allTags, setAllTags] = React.useState<CmsTagItem[]>([]);
const [form, setForm] = React.useState<AdminNewsFormValues | null>(null); const [form, setForm] = React.useState<AdminNewsFormValues | null>(null);
const [pickerOpen, setPickerOpen] = React.useState(false); const [pickerOpen, setPickerOpen] = React.useState(false);
const [tagSearch, setTagSearch] = React.useState("");
const [isSubmitting, setIsSubmitting] = React.useState(false); const [isSubmitting, setIsSubmitting] = React.useState(false);
const [isLoadingInitialData, setIsLoadingInitialData] = React.useState(true); const [isLoadingInitialData, setIsLoadingInitialData] = React.useState(true);
const [isMissingPost, setIsMissingPost] = React.useState(false); const [isMissingPost, setIsMissingPost] = React.useState(false);
...@@ -309,7 +430,7 @@ export function AdminNewsForm({ ...@@ -309,7 +430,7 @@ export function AdminNewsForm({
...cloneAdminNewsFormValues(), ...cloneAdminNewsFormValues(),
type: lockedType ?? (presetHeader?.type === "page" ? "baiviettrang" : "tintuc"), type: lockedType ?? (presetHeader?.type === "page" ? "baiviettrang" : "tintuc"),
header_category_id: presetHeaderCategoryId ?? "", header_category_id: presetHeaderCategoryId ?? "",
category_ids: presetHeader?.category_ids ?? [], category_ids: presetHeaderCategoryId ? [presetHeaderCategoryId] : [],
created_at: now, created_at: now,
updated_at: now, updated_at: now,
}); });
...@@ -328,10 +449,12 @@ export function AdminNewsForm({ ...@@ -328,10 +449,12 @@ export function AdminNewsForm({
return; return;
} }
if ( const belongsToPresetHeaderCategory =
presetHeaderCategoryId && !presetHeaderCategoryId ||
currentItem.header_category_id !== presetHeaderCategoryId currentItem.header_category_id === presetHeaderCategoryId ||
) { currentItem.category_ids.includes(presetHeaderCategoryId);
if (!belongsToPresetHeaderCategory) {
setIsMissingPost(true); setIsMissingPost(true);
setForm(null); setForm(null);
return; return;
...@@ -344,7 +467,16 @@ export function AdminNewsForm({ ...@@ -344,7 +467,16 @@ export function AdminNewsForm({
} }
setIsMissingPost(false); setIsMissingPost(false);
setForm(cloneAdminNewsFormValues(currentItem)); const nextForm = cloneAdminNewsFormValues(currentItem);
if (
presetHeaderCategoryId &&
currentItem.type === "tintuc" &&
!nextForm.category_ids.includes(presetHeaderCategoryId)
) {
nextForm.category_ids = [presetHeaderCategoryId, ...nextForm.category_ids];
nextForm.header_category_id = nextForm.category_ids[0] ?? "";
}
setForm(nextForm);
} catch (error) { } catch (error) {
if (cancelled) return; if (cancelled) return;
toast.error(error instanceof Error ? error.message : "Không thể tải bài viết"); toast.error(error instanceof Error ? error.message : "Không thể tải bài viết");
...@@ -365,9 +497,7 @@ export function AdminNewsForm({ ...@@ -365,9 +497,7 @@ export function AdminNewsForm({
}, [isCreate, lockedType, newsId, presetHeaderCategoryId]); }, [isCreate, lockedType, newsId, presetHeaderCategoryId]);
const headerOptions = React.useMemo(() => { const headerOptions = React.useMemo(() => {
return flattenHeaderTree(buildHeaderCategoryTree(headerItems)).filter( return flattenHeaderTree(buildHeaderCategoryTree(headerItems));
(item) => item.type === "news" || item.type === "page",
);
}, [headerItems]); }, [headerItems]);
const selectedHeaderCategory = React.useMemo(() => { const selectedHeaderCategory = React.useMemo(() => {
...@@ -375,12 +505,12 @@ export function AdminNewsForm({ ...@@ -375,12 +505,12 @@ export function AdminNewsForm({
}, [form?.header_category_id, headerItems]); }, [form?.header_category_id, headerItems]);
const availableSearchTags = React.useMemo(() => { const availableSearchTags = React.useMemo(() => {
if (!selectedHeaderCategory || selectedHeaderCategory.type !== "news") return []; if (form?.type !== "tintuc") return [];
return allTags.map((item) => item.name); return allTags.map((item) => item.name);
}, [allTags, selectedHeaderCategory]); }, [allTags, form?.type]);
const selectedTagIds = React.useMemo(() => { const selectedTagIds = React.useMemo(() => {
if (!selectedHeaderCategory || selectedHeaderCategory.type !== "news") return []; if (form?.type !== "tintuc") return [];
const tagMap = new Map( const tagMap = new Map(
allTags.map((item) => [item.name.trim().toLowerCase(), item.id] as const), allTags.map((item) => [item.name.trim().toLowerCase(), item.id] as const),
...@@ -389,7 +519,38 @@ export function AdminNewsForm({ ...@@ -389,7 +519,38 @@ export function AdminNewsForm({
return form?.tagsearch_values return form?.tagsearch_values
.map((name) => tagMap.get(name.trim().toLowerCase())) .map((name) => tagMap.get(name.trim().toLowerCase()))
.filter((value): value is string => Boolean(value)) ?? []; .filter((value): value is string => Boolean(value)) ?? [];
}, [allTags, form?.tagsearch_values, selectedHeaderCategory]); }, [allTags, form?.tagsearch_values, form?.type]);
const visibleSearchTags = React.useMemo(() => {
if (form?.type !== "tintuc") return [];
const normalizedKeyword = tagSearch.trim().toLowerCase();
const selectedNames = new Set(form.tagsearch_values);
const selectedTags = availableSearchTags.filter((item) => selectedNames.has(item));
const availableTags = availableSearchTags.filter((item) => !selectedNames.has(item));
const matchedTags = normalizedKeyword
? availableTags.filter((item) => item.toLowerCase().includes(normalizedKeyword))
: availableTags;
return [
...selectedTags,
...matchedTags.slice(
0,
Math.max(SEARCH_TAG_VISIBLE_LIMIT - selectedTags.length, 0),
),
];
}, [availableSearchTags, form?.tagsearch_values, form?.type, tagSearch]);
const matchedSearchTagTotal = React.useMemo(() => {
if (form?.type !== "tintuc") return 0;
const normalizedKeyword = tagSearch.trim().toLowerCase();
if (!normalizedKeyword) return availableSearchTags.length;
return availableSearchTags.filter((item) =>
item.toLowerCase().includes(normalizedKeyword),
).length;
}, [availableSearchTags, form?.type, tagSearch]);
const articlePageAlreadyUsed = React.useMemo(() => { const articlePageAlreadyUsed = React.useMemo(() => {
if (!form?.header_category_id || form.type !== "baiviettrang") return false; if (!form?.header_category_id || form.type !== "baiviettrang") return false;
...@@ -439,13 +600,24 @@ export function AdminNewsForm({ ...@@ -439,13 +600,24 @@ export function AdminNewsForm({
return { return {
...current, ...current,
type: nextType, type: nextType,
header_category_id: compatibleHeader ? current.header_category_id : "", header_category_id:
nextType === "baiviettrang"
? compatibleHeader
? current.header_category_id
: ""
: current.category_ids.find((id) =>
headerOptions.some(
(option) => option.id === id && isCategoryCompatible(option.type, nextType),
),
) ?? "",
category_ids: category_ids:
nextType === "baiviettrang" nextType === "baiviettrang"
? [] ? []
: compatibleHeader : current.category_ids.filter((id) =>
? current.category_ids headerOptions.some(
: [], (option) => option.id === id && isCategoryCompatible(option.type, nextType),
),
),
tagsearch_values: nextType === "baiviettrang" ? [] : current.tagsearch_values, tagsearch_values: nextType === "baiviettrang" ? [] : current.tagsearch_values,
is_featured: nextType === "tintuc" ? current.is_featured : false, is_featured: nextType === "tintuc" ? current.is_featured : false,
}; };
...@@ -454,16 +626,16 @@ export function AdminNewsForm({ ...@@ -454,16 +626,16 @@ export function AdminNewsForm({
const handleHeaderCategoryChange = (value: string) => { const handleHeaderCategoryChange = (value: string) => {
const nextCategory = headerItems.find((item) => item.id === value) ?? null; const nextCategory = headerItems.find((item) => item.id === value) ?? null;
const nextSearchTags =
nextCategory?.type === "news" ? allTags.map((item) => item.name) : [];
setForm((current) => { setForm((current) => {
if (!current) return current; if (!current) return current;
const nextSearchTags =
current.type === "tintuc" ? allTags.map((item) => item.name) : [];
return { return {
...current, ...current,
header_category_id: value, header_category_id: value,
category_ids: nextCategory?.category_ids ?? [], category_ids: nextCategory?.id ? [nextCategory.id] : [],
tagsearch_values: current.tagsearch_values.filter((item) => tagsearch_values: current.tagsearch_values.filter((item) =>
nextSearchTags.includes(item), nextSearchTags.includes(item),
), ),
...@@ -471,6 +643,18 @@ export function AdminNewsForm({ ...@@ -471,6 +643,18 @@ export function AdminNewsForm({
}); });
}; };
const handleHeaderCategoriesChange = (values: string[]) => {
setForm((current) => {
if (!current) return current;
return {
...current,
header_category_id: values[0] ?? "",
category_ids: values,
};
});
};
const handleToggleSearchTag = (value: string, checked: boolean) => { const handleToggleSearchTag = (value: string, checked: boolean) => {
setForm((current) => { setForm((current) => {
if (!current) return current; if (!current) return current;
...@@ -507,7 +691,12 @@ export function AdminNewsForm({ ...@@ -507,7 +691,12 @@ export function AdminNewsForm({
return; return;
} }
if (!form.header_category_id) { if (form.type === "baiviettrang" && !form.header_category_id) {
toast.error("Vui lòng chọn danh mục hiển thị");
return;
}
if (form.type === "tintuc" && form.category_ids.length === 0) {
toast.error("Vui lòng chọn danh mục hiển thị"); toast.error("Vui lòng chọn danh mục hiển thị");
return; return;
} }
...@@ -522,13 +711,13 @@ export function AdminNewsForm({ ...@@ -522,13 +711,13 @@ export function AdminNewsForm({
slug: slugifyAdminNews(form.slug.trim()), slug: slugifyAdminNews(form.slug.trim()),
summary: form.summary, summary: form.summary,
type: form.type, type: form.type,
header_category_id: form.header_category_id, header_category_id: form.type === "tintuc" ? form.category_ids[0] ?? "" : form.header_category_id,
category_ids: category_ids:
form.type === "baiviettrang" form.type === "baiviettrang"
? form.header_category_id ? form.header_category_id
? [form.header_category_id] ? [form.header_category_id]
: [] : []
: selectedHeaderCategory?.category_ids ?? [], : form.category_ids,
tag_ids: form.type === "baiviettrang" ? [] : selectedTagIds, tag_ids: form.type === "baiviettrang" ? [] : selectedTagIds,
is_featured: form.type === "tintuc" ? form.is_featured : false, is_featured: form.type === "tintuc" ? form.is_featured : false,
thumbnail_id: form.thumbnail && isUuid(form.thumbnail.id) ? form.thumbnail.id : null, thumbnail_id: form.thumbnail && isUuid(form.thumbnail.id) ? form.thumbnail.id : null,
...@@ -741,20 +930,6 @@ export function AdminNewsForm({ ...@@ -741,20 +930,6 @@ export function AdminNewsForm({
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
<div>
<Label className="mb-1.5 block text-gray-700">
Danh mục hiển thị
</Label>
<HeaderCategoryCombobox
value={form.header_category_id}
onChange={handleHeaderCategoryChange}
disabled={isHeaderCategoryLocked}
options={headerOptions.filter((option) =>
isCategoryCompatible(option.type, form.type),
)}
/>
</div>
</div> </div>
<div className="grid grid-cols-1 gap-4 md:grid-cols-2"> <div className="grid grid-cols-1 gap-4 md:grid-cols-2">
...@@ -820,26 +995,85 @@ export function AdminNewsForm({ ...@@ -820,26 +995,85 @@ export function AdminNewsForm({
</div> </div>
</div> </div>
{availableSearchTags.length > 0 ? ( <div className="rounded-xl border border-[#063e8e]/15 bg-[#063e8e]/[0.02] p-4 xl:col-span-2">
{form.type === "tintuc" ? (
<HeaderCategoryMultiPicker
values={form.category_ids}
onChange={handleHeaderCategoriesChange}
disabled={isHeaderCategoryLocked}
options={headerOptions.filter((option) =>
isCategoryCompatible(option.type, form.type),
)}
/>
) : (
<HeaderCategorySinglePicker
value={form.header_category_id}
onChange={handleHeaderCategoryChange}
disabled={isHeaderCategoryLocked}
options={headerOptions.filter((option) =>
isCategoryCompatible(option.type, form.type),
)}
/>
)}
</div>
{form.type === "tintuc" ? (
<div className="rounded-xl border border-[#063e8e]/15 bg-[#063e8e]/[0.02] p-4 xl:col-span-2"> <div className="rounded-xl border border-[#063e8e]/15 bg-[#063e8e]/[0.02] p-4 xl:col-span-2">
<Label className="mb-3 block text-gray-700">Tag tìm kiếm</Label> <div className="mb-3 flex flex-col gap-3 md:flex-row md:items-end md:justify-between">
<div className="grid grid-cols-1 gap-2 md:grid-cols-2"> <div className="min-w-0 flex-1">
{availableSearchTags.map((item) => ( <Label className="mb-1.5 block text-gray-700">Tag tìm kiếm</Label>
<label <Input
key={item} value={tagSearch}
className="flex items-center gap-3 rounded-lg border border-[#063e8e]/10 bg-white px-3 py-2" onChange={(event) => setTagSearch(event.target.value)}
> placeholder="Tìm tag theo tên"
<Checkbox className={fieldClassName}
checked={form.tagsearch_values.includes(item)} />
onCheckedChange={(checked) => </div>
handleToggleSearchTag(item, checked === true) <div className="rounded-lg border border-[#063e8e]/10 bg-white px-3 py-2 text-sm text-gray-700">
} Đã chọn {form.tagsearch_values.length} tag
className="border-[#063e8e]/30 data-[state=checked]:border-[#063e8e] data-[state=checked]:bg-[#063e8e]" </div>
/>
<span className="text-sm text-gray-700">{item}</span>
</label>
))}
</div> </div>
{availableSearchTags.length > 0 ? (
<>
{visibleSearchTags.length > 0 ? (
<div className="max-h-64 overflow-y-auto rounded-xl border border-[#063e8e]/10 bg-white p-2">
<div className="grid grid-cols-1 gap-2 md:grid-cols-2">
{visibleSearchTags.map((item) => (
<label
key={item}
className="flex items-center gap-3 rounded-lg border border-[#063e8e]/10 bg-white px-3 py-2"
>
<Checkbox
checked={form.tagsearch_values.includes(item)}
onCheckedChange={(checked) =>
handleToggleSearchTag(item, checked === true)
}
className="border-[#063e8e]/30 data-[state=checked]:border-[#063e8e] data-[state=checked]:bg-[#063e8e]"
/>
<span className="min-w-0 truncate text-sm text-gray-700">
{item}
</span>
</label>
))}
</div>
</div>
) : (
<p className="rounded-lg border border-dashed border-[#063e8e]/20 bg-white px-3 py-2 text-sm text-gray-700">
Không tìm thấy tag phù hợp.
</p>
)}
{matchedSearchTagTotal > visibleSearchTags.length ? (
<p className="mt-2 text-sm text-gray-700">
Đang hiển thị {visibleSearchTags.length} trong{" "}
{matchedSearchTagTotal} tag phù hợp. Nhập thêm từ khóa để lọc nhanh hơn.
</p>
) : null}
</>
) : (
<p className="rounded-lg border border-dashed border-[#063e8e]/20 bg-white px-3 py-2 text-sm text-gray-700">
{"Ch\u01b0a c\u00f3 tag t\u00ecm ki\u1ebfm n\u00e0o. Vui l\u00f2ng t\u1ea1o tag trong m\u1ee5c qu\u1ea3n l\u00fd tag tr\u01b0\u1edbc khi g\u00e1n cho b\u00e0i vi\u1ebft."}
</p>
)}
</div> </div>
) : null} ) : null}
</div> </div>
......
...@@ -319,9 +319,9 @@ const parseLegacyPostContent = (content?: string | null): CmsPostContentSection[ ...@@ -319,9 +319,9 @@ const parseLegacyPostContent = (content?: string | null): CmsPostContentSection[
const transformPost = ( const transformPost = (
post: CmsRawPostItem, post: CmsRawPostItem,
tagMap: Map<string, CmsTagItem[]>, tagMap?: Map<string, CmsTagItem[]>,
): CmsNewsItem => { ): CmsNewsItem => {
const tagItems = tagMap.get(post.id ?? "") ?? []; const tagItems = tagMap?.get(post.id ?? "") ?? [];
const categories = Array.isArray(post.categories) ? post.categories : []; const categories = Array.isArray(post.categories) ? post.categories : [];
const primaryCategory = categories[0] ?? null; const primaryCategory = categories[0] ?? null;
const primaryCategoryType = primaryCategory?.type ?? null; const primaryCategoryType = primaryCategory?.type ?? null;
...@@ -387,14 +387,6 @@ async function fetchTagsForPost(postId: string) { ...@@ -387,14 +387,6 @@ async function fetchTagsForPost(postId: string) {
}); });
} }
async function fetchTagMapForPosts(postIds: string[]) {
const entries = await Promise.all(
postIds.map(async (postId) => [postId, await fetchTagsForPost(postId)] as const),
);
return new Map(entries);
}
function buildHeaderItemsFromTree( function buildHeaderItemsFromTree(
node: CmsPageConfigNode, node: CmsPageConfigNode,
rootId: string, rootId: string,
...@@ -760,16 +752,32 @@ export async function fetchCmsNewsItems(params?: { ...@@ -760,16 +752,32 @@ export async function fetchCmsNewsItems(params?: {
); );
const rows = result.rows ?? []; const rows = result.rows ?? [];
const tagMap = await fetchTagMapForPosts(rows.map((item) => item.id ?? "").filter(Boolean));
return { return {
items: rows.map((item) => transformPost(item, tagMap)), items: rows.map((item) => transformPost(item)),
total: result.count ?? 0, total: result.count ?? 0,
page: result.page ?? 1, page: result.page ?? 1,
pageSize: result.pageSize ?? 20, pageSize: result.pageSize ?? 20,
}; };
} }
export async function fetchCmsPostCount(filters?: string) {
const queryParams = new URLSearchParams();
if (filters?.trim()) {
queryParams.set("filters", filters.trim());
}
queryParams.set("page", "1");
queryParams.set("pageSize", "1");
const result = await cmsRequest<CmsPagedResult<CmsRawPostItem>>(
`/post?${queryParams.toString()}`,
);
return result.count ?? 0;
}
export async function fetchCmsNewsItem(id: string) { export async function fetchCmsNewsItem(id: string) {
const post = await cmsRequest<CmsRawPostItem>(`/post/${id}`); const post = await cmsRequest<CmsRawPostItem>(`/post/${id}`);
const tags = post.id ? await fetchTagsForPost(post.id) : []; const tags = post.id ? await fetchTagsForPost(post.id) : [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment