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

fix siteInformation

parent 67165167
...@@ -125,6 +125,8 @@ const orvalConfig = async () => { ...@@ -125,6 +125,8 @@ const orvalConfig = async () => {
'NewsPageConfig', 'NewsPageConfig',
'Video', 'Video',
'NewsletterSubscription', 'NewsletterSubscription',
'SiteInformation',
'Logo',
], ],
}, },
}, },
......
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import {
useInfiniteQuery,
useMutation,
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseInfiniteQueryResult,
DefinedUseQueryResult,
InfiniteData,
MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseInfiniteQueryOptions,
UseInfiniteQueryResult,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
DeleteLogoId200,
GetLogoId200,
GetLogoParams,
LogoCreate,
LogoUpdate,
PostLogo200,
PutLogoId200,
ResponseGetAllData
} from '../models';
import { useCustomClient } from '../mutator/custom-client';
import type { ErrorType , BodyType } from '../mutator/custom-client';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Retrieve a single logo record by its ID
* @summary Get logo by ID
*/
export type getLogoIdResponse200 = {
data: GetLogoId200
status: 200
}
export type getLogoIdResponse404 = {
data: void
status: 404
}
export type getLogoIdResponseSuccess = (getLogoIdResponse200) & {
headers: Headers;
};
export type getLogoIdResponseError = (getLogoIdResponse404) & {
headers: Headers;
};
export type getLogoIdResponse = (getLogoIdResponseSuccess | getLogoIdResponseError)
export const getGetLogoIdUrl = (id: string,) => {
return `/logo/${id}`
}
export const getLogoId = async (id: string, options?: RequestInit): Promise<getLogoIdResponse> => {
return useCustomClient<getLogoIdResponse>(getGetLogoIdUrl(id),
{
...options,
method: 'GET'
}
);}
export const getGetLogoIdInfiniteQueryKey = (id?: string,) => {
return [
'infinite', `/logo/${id}`
] as const;
}
export const getGetLogoIdQueryKey = (id?: string,) => {
return [
`/logo/${id}`
] as const;
}
export const getGetLogoIdInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getLogoId>>>, TError = ErrorType<void>>(id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetLogoIdInfiniteQueryKey(id);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getLogoId>>> = ({ signal }) => getLogoId(id, { signal, ...requestOptions });
return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetLogoIdInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getLogoId>>>
export type GetLogoIdInfiniteQueryError = ErrorType<void>
export function useGetLogoIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getLogoId>>>, TError = ErrorType<void>>(
id: string, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getLogoId>>,
TError,
Awaited<ReturnType<typeof getLogoId>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetLogoIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getLogoId>>>, TError = ErrorType<void>>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getLogoId>>,
TError,
Awaited<ReturnType<typeof getLogoId>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetLogoIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getLogoId>>>, TError = ErrorType<void>>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get logo by ID
*/
export function useGetLogoIdInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getLogoId>>>, TError = ErrorType<void>>(
id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetLogoIdInfiniteQueryOptions(id,options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary Get logo by ID
*/
export const prefetchGetLogoIdInfiniteQuery = async <TData = Awaited<ReturnType<typeof getLogoId>>, TError = ErrorType<void>>(
queryClient: QueryClient, id: string, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
): Promise<QueryClient> => {
const queryOptions = getGetLogoIdInfiniteQueryOptions(id,options)
await queryClient.prefetchInfiniteQuery(queryOptions);
return queryClient;
}
export const getGetLogoIdQueryOptions = <TData = Awaited<ReturnType<typeof getLogoId>>, TError = ErrorType<void>>(id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetLogoIdQueryKey(id);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getLogoId>>> = ({ signal }) => getLogoId(id, { signal, ...requestOptions });
return { queryKey, queryFn, enabled: !!(id), retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetLogoIdQueryResult = NonNullable<Awaited<ReturnType<typeof getLogoId>>>
export type GetLogoIdQueryError = ErrorType<void>
export function useGetLogoId<TData = Awaited<ReturnType<typeof getLogoId>>, TError = ErrorType<void>>(
id: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getLogoId>>,
TError,
Awaited<ReturnType<typeof getLogoId>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetLogoId<TData = Awaited<ReturnType<typeof getLogoId>>, TError = ErrorType<void>>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getLogoId>>,
TError,
Awaited<ReturnType<typeof getLogoId>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetLogoId<TData = Awaited<ReturnType<typeof getLogoId>>, TError = ErrorType<void>>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get logo by ID
*/
export function useGetLogoId<TData = Awaited<ReturnType<typeof getLogoId>>, TError = ErrorType<void>>(
id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetLogoIdQueryOptions(id,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary Get logo by ID
*/
export const prefetchGetLogoIdQuery = async <TData = Awaited<ReturnType<typeof getLogoId>>, TError = ErrorType<void>>(
queryClient: QueryClient, id: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogoId>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
): Promise<QueryClient> => {
const queryOptions = getGetLogoIdQueryOptions(id,options)
await queryClient.prefetchQuery(queryOptions);
return queryClient;
}
/**
* Update a single logo record by its ID
* @summary Update logo by ID
*/
export type putLogoIdResponse200 = {
data: PutLogoId200
status: 200
}
export type putLogoIdResponse400 = {
data: void
status: 400
}
export type putLogoIdResponse404 = {
data: void
status: 404
}
export type putLogoIdResponse409 = {
data: void
status: 409
}
export type putLogoIdResponseSuccess = (putLogoIdResponse200) & {
headers: Headers;
};
export type putLogoIdResponseError = (putLogoIdResponse400 | putLogoIdResponse404 | putLogoIdResponse409) & {
headers: Headers;
};
export type putLogoIdResponse = (putLogoIdResponseSuccess | putLogoIdResponseError)
export const getPutLogoIdUrl = (id: string,) => {
return `/logo/${id}`
}
export const putLogoId = async (id: string,
logoUpdate: LogoUpdate, options?: RequestInit): Promise<putLogoIdResponse> => {
return useCustomClient<putLogoIdResponse>(getPutLogoIdUrl(id),
{
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(
logoUpdate,)
}
);}
export const getPutLogoIdMutationOptions = <TError = ErrorType<void>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putLogoId>>, TError,{id: string;data: BodyType<LogoUpdate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof putLogoId>>, TError,{id: string;data: BodyType<LogoUpdate>}, TContext> => {
const mutationKey = ['putLogoId'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof putLogoId>>, {id: string;data: BodyType<LogoUpdate>}> = (props) => {
const {id,data} = props ?? {};
return putLogoId(id,data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type PutLogoIdMutationResult = NonNullable<Awaited<ReturnType<typeof putLogoId>>>
export type PutLogoIdMutationBody = BodyType<LogoUpdate>
export type PutLogoIdMutationError = ErrorType<void>
/**
* @summary Update logo by ID
*/
export const usePutLogoId = <TError = ErrorType<void>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putLogoId>>, TError,{id: string;data: BodyType<LogoUpdate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof putLogoId>>,
TError,
{id: string;data: BodyType<LogoUpdate>},
TContext
> => {
const mutationOptions = getPutLogoIdMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Delete a single logo record by its ID
* @summary Delete logo by ID
*/
export type deleteLogoIdResponse200 = {
data: DeleteLogoId200
status: 200
}
export type deleteLogoIdResponse404 = {
data: void
status: 404
}
export type deleteLogoIdResponse409 = {
data: void
status: 409
}
export type deleteLogoIdResponseSuccess = (deleteLogoIdResponse200) & {
headers: Headers;
};
export type deleteLogoIdResponseError = (deleteLogoIdResponse404 | deleteLogoIdResponse409) & {
headers: Headers;
};
export type deleteLogoIdResponse = (deleteLogoIdResponseSuccess | deleteLogoIdResponseError)
export const getDeleteLogoIdUrl = (id: string,) => {
return `/logo/${id}`
}
export const deleteLogoId = async (id: string, options?: RequestInit): Promise<deleteLogoIdResponse> => {
return useCustomClient<deleteLogoIdResponse>(getDeleteLogoIdUrl(id),
{
...options,
method: 'DELETE'
}
);}
export const getDeleteLogoIdMutationOptions = <TError = ErrorType<void>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteLogoId>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof deleteLogoId>>, TError,{id: string}, TContext> => {
const mutationKey = ['deleteLogoId'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteLogoId>>, {id: string}> = (props) => {
const {id} = props ?? {};
return deleteLogoId(id,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type DeleteLogoIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteLogoId>>>
export type DeleteLogoIdMutationError = ErrorType<void>
/**
* @summary Delete logo by ID
*/
export const useDeleteLogoId = <TError = ErrorType<void>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteLogoId>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof deleteLogoId>>,
TError,
{id: string},
TContext
> => {
const mutationOptions = getDeleteLogoIdMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* Retrieve a list of logos with pagination, filtering and sorting
* @summary Get all logos
*/
export type getLogoResponse200 = {
data: ResponseGetAllData
status: 200
}
export type getLogoResponseSuccess = (getLogoResponse200) & {
headers: Headers;
};
;
export type getLogoResponse = (getLogoResponseSuccess)
export const getGetLogoUrl = (params?: GetLogoParams,) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString())
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `/logo?${stringifiedParams}` : `/logo`
}
export const getLogo = async (params?: GetLogoParams, options?: RequestInit): Promise<getLogoResponse> => {
return useCustomClient<getLogoResponse>(getGetLogoUrl(params),
{
...options,
method: 'GET'
}
);}
export const getGetLogoInfiniteQueryKey = (params?: GetLogoParams,) => {
return [
'infinite', `/logo`, ...(params ? [params]: [])
] as const;
}
export const getGetLogoQueryKey = (params?: GetLogoParams,) => {
return [
`/logo`, ...(params ? [params]: [])
] as const;
}
export const getGetLogoInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getLogo>>>, TError = ErrorType<unknown>>(params?: GetLogoParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetLogoInfiniteQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getLogo>>> = ({ signal }) => getLogo(params, { signal, ...requestOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetLogoInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getLogo>>>
export type GetLogoInfiniteQueryError = ErrorType<unknown>
export function useGetLogoInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getLogo>>>, TError = ErrorType<unknown>>(
params: undefined | GetLogoParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getLogo>>,
TError,
Awaited<ReturnType<typeof getLogo>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetLogoInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getLogo>>>, TError = ErrorType<unknown>>(
params?: GetLogoParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getLogo>>,
TError,
Awaited<ReturnType<typeof getLogo>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetLogoInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getLogo>>>, TError = ErrorType<unknown>>(
params?: GetLogoParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get all logos
*/
export function useGetLogoInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getLogo>>>, TError = ErrorType<unknown>>(
params?: GetLogoParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetLogoInfiniteQueryOptions(params,options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary Get all logos
*/
export const prefetchGetLogoInfiniteQuery = async <TData = Awaited<ReturnType<typeof getLogo>>, TError = ErrorType<unknown>>(
queryClient: QueryClient, params?: GetLogoParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
): Promise<QueryClient> => {
const queryOptions = getGetLogoInfiniteQueryOptions(params,options)
await queryClient.prefetchInfiniteQuery(queryOptions);
return queryClient;
}
export const getGetLogoQueryOptions = <TData = Awaited<ReturnType<typeof getLogo>>, TError = ErrorType<unknown>>(params?: GetLogoParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetLogoQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getLogo>>> = ({ signal }) => getLogo(params, { signal, ...requestOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetLogoQueryResult = NonNullable<Awaited<ReturnType<typeof getLogo>>>
export type GetLogoQueryError = ErrorType<unknown>
export function useGetLogo<TData = Awaited<ReturnType<typeof getLogo>>, TError = ErrorType<unknown>>(
params: undefined | GetLogoParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getLogo>>,
TError,
Awaited<ReturnType<typeof getLogo>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetLogo<TData = Awaited<ReturnType<typeof getLogo>>, TError = ErrorType<unknown>>(
params?: GetLogoParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getLogo>>,
TError,
Awaited<ReturnType<typeof getLogo>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetLogo<TData = Awaited<ReturnType<typeof getLogo>>, TError = ErrorType<unknown>>(
params?: GetLogoParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get all logos
*/
export function useGetLogo<TData = Awaited<ReturnType<typeof getLogo>>, TError = ErrorType<unknown>>(
params?: GetLogoParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetLogoQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary Get all logos
*/
export const prefetchGetLogoQuery = async <TData = Awaited<ReturnType<typeof getLogo>>, TError = ErrorType<unknown>>(
queryClient: QueryClient, params?: GetLogoParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getLogo>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
): Promise<QueryClient> => {
const queryOptions = getGetLogoQueryOptions(params,options)
await queryClient.prefetchQuery(queryOptions);
return queryClient;
}
/**
* Create a new logo record
* @summary Create a logo
*/
export type postLogoResponse200 = {
data: PostLogo200
status: 200
}
export type postLogoResponse400 = {
data: void
status: 400
}
export type postLogoResponse404 = {
data: void
status: 404
}
export type postLogoResponse409 = {
data: void
status: 409
}
export type postLogoResponseSuccess = (postLogoResponse200) & {
headers: Headers;
};
export type postLogoResponseError = (postLogoResponse400 | postLogoResponse404 | postLogoResponse409) & {
headers: Headers;
};
export type postLogoResponse = (postLogoResponseSuccess | postLogoResponseError)
export const getPostLogoUrl = () => {
return `/logo`
}
export const postLogo = async (logoCreate: LogoCreate, options?: RequestInit): Promise<postLogoResponse> => {
return useCustomClient<postLogoResponse>(getPostLogoUrl(),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(
logoCreate,)
}
);}
export const getPostLogoMutationOptions = <TError = ErrorType<void>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postLogo>>, TError,{data: BodyType<LogoCreate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof postLogo>>, TError,{data: BodyType<LogoCreate>}, TContext> => {
const mutationKey = ['postLogo'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof postLogo>>, {data: BodyType<LogoCreate>}> = (props) => {
const {data} = props ?? {};
return postLogo(data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type PostLogoMutationResult = NonNullable<Awaited<ReturnType<typeof postLogo>>>
export type PostLogoMutationBody = BodyType<LogoCreate>
export type PostLogoMutationError = ErrorType<void>
/**
* @summary Create a logo
*/
export const usePostLogo = <TError = ErrorType<void>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postLogo>>, TError,{data: BodyType<LogoCreate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof postLogo>>,
TError,
{data: BodyType<LogoCreate>},
TContext
> => {
const mutationOptions = getPostLogoMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
\ No newline at end of file
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import {
useInfiniteQuery,
useMutation,
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseInfiniteQueryResult,
DefinedUseQueryResult,
InfiniteData,
MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseInfiniteQueryOptions,
UseInfiniteQueryResult,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
GetSiteInformation200,
GetSiteInformationParams,
PutSiteInformation200,
SiteInformationBranchMutate,
SiteInformationSocialMutate,
SiteInformationUpdateBody
} from '../models';
import { useCustomClient } from '../mutator/custom-client';
import type { ErrorType , BodyType } from '../mutator/custom-client';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Retrieve current public site information configuration.
* @summary Get current site information
*/
export type getSiteInformationResponse200 = {
data: GetSiteInformation200
status: 200
}
export type getSiteInformationResponseSuccess = (getSiteInformationResponse200) & {
headers: Headers;
};
;
export type getSiteInformationResponse = (getSiteInformationResponseSuccess)
export const getGetSiteInformationUrl = (params?: GetSiteInformationParams,) => {
const normalizedParams = new URLSearchParams();
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : value.toString())
}
});
const stringifiedParams = normalizedParams.toString();
return stringifiedParams.length > 0 ? `/siteInformation?${stringifiedParams}` : `/siteInformation`
}
export const getSiteInformation = async (params?: GetSiteInformationParams, options?: RequestInit): Promise<getSiteInformationResponse> => {
return useCustomClient<getSiteInformationResponse>(getGetSiteInformationUrl(params),
{
...options,
method: 'GET'
}
);}
export const getGetSiteInformationInfiniteQueryKey = (params?: GetSiteInformationParams,) => {
return [
'infinite', `/siteInformation`, ...(params ? [params]: [])
] as const;
}
export const getGetSiteInformationQueryKey = (params?: GetSiteInformationParams,) => {
return [
`/siteInformation`, ...(params ? [params]: [])
] as const;
}
export const getGetSiteInformationInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformation>>>, TError = ErrorType<unknown>>(params?: GetSiteInformationParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetSiteInformationInfiniteQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSiteInformation>>> = ({ signal }) => getSiteInformation(params, { signal, ...requestOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetSiteInformationInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getSiteInformation>>>
export type GetSiteInformationInfiniteQueryError = ErrorType<unknown>
export function useGetSiteInformationInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformation>>>, TError = ErrorType<unknown>>(
params: undefined | GetSiteInformationParams, options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformation>>,
TError,
Awaited<ReturnType<typeof getSiteInformation>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformationInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformation>>>, TError = ErrorType<unknown>>(
params?: GetSiteInformationParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformation>>,
TError,
Awaited<ReturnType<typeof getSiteInformation>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformationInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformation>>>, TError = ErrorType<unknown>>(
params?: GetSiteInformationParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get current site information
*/
export function useGetSiteInformationInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformation>>>, TError = ErrorType<unknown>>(
params?: GetSiteInformationParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetSiteInformationInfiniteQueryOptions(params,options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary Get current site information
*/
export const prefetchGetSiteInformationInfiniteQuery = async <TData = Awaited<ReturnType<typeof getSiteInformation>>, TError = ErrorType<unknown>>(
queryClient: QueryClient, params?: GetSiteInformationParams, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
): Promise<QueryClient> => {
const queryOptions = getGetSiteInformationInfiniteQueryOptions(params,options)
await queryClient.prefetchInfiniteQuery(queryOptions);
return queryClient;
}
export const getGetSiteInformationQueryOptions = <TData = Awaited<ReturnType<typeof getSiteInformation>>, TError = ErrorType<unknown>>(params?: GetSiteInformationParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetSiteInformationQueryKey(params);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSiteInformation>>> = ({ signal }) => getSiteInformation(params, { signal, ...requestOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetSiteInformationQueryResult = NonNullable<Awaited<ReturnType<typeof getSiteInformation>>>
export type GetSiteInformationQueryError = ErrorType<unknown>
export function useGetSiteInformation<TData = Awaited<ReturnType<typeof getSiteInformation>>, TError = ErrorType<unknown>>(
params: undefined | GetSiteInformationParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformation>>,
TError,
Awaited<ReturnType<typeof getSiteInformation>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformation<TData = Awaited<ReturnType<typeof getSiteInformation>>, TError = ErrorType<unknown>>(
params?: GetSiteInformationParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformation>>,
TError,
Awaited<ReturnType<typeof getSiteInformation>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformation<TData = Awaited<ReturnType<typeof getSiteInformation>>, TError = ErrorType<unknown>>(
params?: GetSiteInformationParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get current site information
*/
export function useGetSiteInformation<TData = Awaited<ReturnType<typeof getSiteInformation>>, TError = ErrorType<unknown>>(
params?: GetSiteInformationParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetSiteInformationQueryOptions(params,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary Get current site information
*/
export const prefetchGetSiteInformationQuery = async <TData = Awaited<ReturnType<typeof getSiteInformation>>, TError = ErrorType<unknown>>(
queryClient: QueryClient, params?: GetSiteInformationParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformation>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
): Promise<QueryClient> => {
const queryOptions = getGetSiteInformationQueryOptions(params,options)
await queryClient.prefetchQuery(queryOptions);
return queryClient;
}
/**
* Update current site information configuration
* @summary Update current site information
*/
export type putSiteInformationResponse200 = {
data: PutSiteInformation200
status: 200
}
export type putSiteInformationResponse400 = {
data: void
status: 400
}
export type putSiteInformationResponse401 = {
data: void
status: 401
}
export type putSiteInformationResponseSuccess = (putSiteInformationResponse200) & {
headers: Headers;
};
export type putSiteInformationResponseError = (putSiteInformationResponse400 | putSiteInformationResponse401) & {
headers: Headers;
};
export type putSiteInformationResponse = (putSiteInformationResponseSuccess | putSiteInformationResponseError)
export const getPutSiteInformationUrl = () => {
return `/siteInformation`
}
export const putSiteInformation = async (siteInformationUpdateBody: SiteInformationUpdateBody, options?: RequestInit): Promise<putSiteInformationResponse> => {
return useCustomClient<putSiteInformationResponse>(getPutSiteInformationUrl(),
{
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(
siteInformationUpdateBody,)
}
);}
export const getPutSiteInformationMutationOptions = <TError = ErrorType<void>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putSiteInformation>>, TError,{data: BodyType<SiteInformationUpdateBody>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof putSiteInformation>>, TError,{data: BodyType<SiteInformationUpdateBody>}, TContext> => {
const mutationKey = ['putSiteInformation'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof putSiteInformation>>, {data: BodyType<SiteInformationUpdateBody>}> = (props) => {
const {data} = props ?? {};
return putSiteInformation(data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type PutSiteInformationMutationResult = NonNullable<Awaited<ReturnType<typeof putSiteInformation>>>
export type PutSiteInformationMutationBody = BodyType<SiteInformationUpdateBody>
export type PutSiteInformationMutationError = ErrorType<void>
/**
* @summary Update current site information
*/
export const usePutSiteInformation = <TError = ErrorType<void>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof putSiteInformation>>, TError,{data: BodyType<SiteInformationUpdateBody>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof putSiteInformation>>,
TError,
{data: BodyType<SiteInformationUpdateBody>},
TContext
> => {
const mutationOptions = getPutSiteInformationMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* @summary Update fixed site social link
*/
export type patchSiteInformationSocialsIdResponse200 = {
data: void
status: 200
}
export type patchSiteInformationSocialsIdResponseSuccess = (patchSiteInformationSocialsIdResponse200) & {
headers: Headers;
};
;
export type patchSiteInformationSocialsIdResponse = (patchSiteInformationSocialsIdResponseSuccess)
export const getPatchSiteInformationSocialsIdUrl = (id: string,) => {
return `/siteInformation/socials/${id}`
}
export const patchSiteInformationSocialsId = async (id: string,
siteInformationSocialMutate: SiteInformationSocialMutate, options?: RequestInit): Promise<patchSiteInformationSocialsIdResponse> => {
return useCustomClient<patchSiteInformationSocialsIdResponse>(getPatchSiteInformationSocialsIdUrl(id),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(
siteInformationSocialMutate,)
}
);}
export const getPatchSiteInformationSocialsIdMutationOptions = <TError = ErrorType<unknown>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchSiteInformationSocialsId>>, TError,{id: string;data: BodyType<SiteInformationSocialMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof patchSiteInformationSocialsId>>, TError,{id: string;data: BodyType<SiteInformationSocialMutate>}, TContext> => {
const mutationKey = ['patchSiteInformationSocialsId'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchSiteInformationSocialsId>>, {id: string;data: BodyType<SiteInformationSocialMutate>}> = (props) => {
const {id,data} = props ?? {};
return patchSiteInformationSocialsId(id,data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type PatchSiteInformationSocialsIdMutationResult = NonNullable<Awaited<ReturnType<typeof patchSiteInformationSocialsId>>>
export type PatchSiteInformationSocialsIdMutationBody = BodyType<SiteInformationSocialMutate>
export type PatchSiteInformationSocialsIdMutationError = ErrorType<unknown>
/**
* @summary Update fixed site social link
*/
export const usePatchSiteInformationSocialsId = <TError = ErrorType<unknown>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchSiteInformationSocialsId>>, TError,{id: string;data: BodyType<SiteInformationSocialMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof patchSiteInformationSocialsId>>,
TError,
{id: string;data: BodyType<SiteInformationSocialMutate>},
TContext
> => {
const mutationOptions = getPatchSiteInformationSocialsIdMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* @summary Get fixed site social links
*/
export type getSiteInformationSocialsResponse200 = {
data: void
status: 200
}
export type getSiteInformationSocialsResponseSuccess = (getSiteInformationSocialsResponse200) & {
headers: Headers;
};
;
export type getSiteInformationSocialsResponse = (getSiteInformationSocialsResponseSuccess)
export const getGetSiteInformationSocialsUrl = () => {
return `/siteInformation/socials`
}
export const getSiteInformationSocials = async ( options?: RequestInit): Promise<getSiteInformationSocialsResponse> => {
return useCustomClient<getSiteInformationSocialsResponse>(getGetSiteInformationSocialsUrl(),
{
...options,
method: 'GET'
}
);}
export const getGetSiteInformationSocialsInfiniteQueryKey = () => {
return [
'infinite', `/siteInformation/socials`
] as const;
}
export const getGetSiteInformationSocialsQueryKey = () => {
return [
`/siteInformation/socials`
] as const;
}
export const getGetSiteInformationSocialsInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformationSocials>>>, TError = ErrorType<unknown>>( options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetSiteInformationSocialsInfiniteQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSiteInformationSocials>>> = ({ signal }) => getSiteInformationSocials({ signal, ...requestOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetSiteInformationSocialsInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getSiteInformationSocials>>>
export type GetSiteInformationSocialsInfiniteQueryError = ErrorType<unknown>
export function useGetSiteInformationSocialsInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformationSocials>>>, TError = ErrorType<unknown>>(
options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformationSocials>>,
TError,
Awaited<ReturnType<typeof getSiteInformationSocials>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformationSocialsInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformationSocials>>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformationSocials>>,
TError,
Awaited<ReturnType<typeof getSiteInformationSocials>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformationSocialsInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformationSocials>>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get fixed site social links
*/
export function useGetSiteInformationSocialsInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformationSocials>>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetSiteInformationSocialsInfiniteQueryOptions(options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary Get fixed site social links
*/
export const prefetchGetSiteInformationSocialsInfiniteQuery = async <TData = Awaited<ReturnType<typeof getSiteInformationSocials>>, TError = ErrorType<unknown>>(
queryClient: QueryClient, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
): Promise<QueryClient> => {
const queryOptions = getGetSiteInformationSocialsInfiniteQueryOptions(options)
await queryClient.prefetchInfiniteQuery(queryOptions);
return queryClient;
}
export const getGetSiteInformationSocialsQueryOptions = <TData = Awaited<ReturnType<typeof getSiteInformationSocials>>, TError = ErrorType<unknown>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetSiteInformationSocialsQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSiteInformationSocials>>> = ({ signal }) => getSiteInformationSocials({ signal, ...requestOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetSiteInformationSocialsQueryResult = NonNullable<Awaited<ReturnType<typeof getSiteInformationSocials>>>
export type GetSiteInformationSocialsQueryError = ErrorType<unknown>
export function useGetSiteInformationSocials<TData = Awaited<ReturnType<typeof getSiteInformationSocials>>, TError = ErrorType<unknown>>(
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformationSocials>>,
TError,
Awaited<ReturnType<typeof getSiteInformationSocials>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformationSocials<TData = Awaited<ReturnType<typeof getSiteInformationSocials>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformationSocials>>,
TError,
Awaited<ReturnType<typeof getSiteInformationSocials>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformationSocials<TData = Awaited<ReturnType<typeof getSiteInformationSocials>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get fixed site social links
*/
export function useGetSiteInformationSocials<TData = Awaited<ReturnType<typeof getSiteInformationSocials>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetSiteInformationSocialsQueryOptions(options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary Get fixed site social links
*/
export const prefetchGetSiteInformationSocialsQuery = async <TData = Awaited<ReturnType<typeof getSiteInformationSocials>>, TError = ErrorType<unknown>>(
queryClient: QueryClient, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationSocials>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
): Promise<QueryClient> => {
const queryOptions = getGetSiteInformationSocialsQueryOptions(options)
await queryClient.prefetchQuery(queryOptions);
return queryClient;
}
/**
* @summary Update site information branch
*/
export type patchSiteInformationBranchesIdResponse200 = {
data: void
status: 200
}
export type patchSiteInformationBranchesIdResponseSuccess = (patchSiteInformationBranchesIdResponse200) & {
headers: Headers;
};
;
export type patchSiteInformationBranchesIdResponse = (patchSiteInformationBranchesIdResponseSuccess)
export const getPatchSiteInformationBranchesIdUrl = (id: string,) => {
return `/siteInformation/branches/${id}`
}
export const patchSiteInformationBranchesId = async (id: string,
siteInformationBranchMutate: SiteInformationBranchMutate, options?: RequestInit): Promise<patchSiteInformationBranchesIdResponse> => {
return useCustomClient<patchSiteInformationBranchesIdResponse>(getPatchSiteInformationBranchesIdUrl(id),
{
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(
siteInformationBranchMutate,)
}
);}
export const getPatchSiteInformationBranchesIdMutationOptions = <TError = ErrorType<unknown>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchSiteInformationBranchesId>>, TError,{id: string;data: BodyType<SiteInformationBranchMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof patchSiteInformationBranchesId>>, TError,{id: string;data: BodyType<SiteInformationBranchMutate>}, TContext> => {
const mutationKey = ['patchSiteInformationBranchesId'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof patchSiteInformationBranchesId>>, {id: string;data: BodyType<SiteInformationBranchMutate>}> = (props) => {
const {id,data} = props ?? {};
return patchSiteInformationBranchesId(id,data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type PatchSiteInformationBranchesIdMutationResult = NonNullable<Awaited<ReturnType<typeof patchSiteInformationBranchesId>>>
export type PatchSiteInformationBranchesIdMutationBody = BodyType<SiteInformationBranchMutate>
export type PatchSiteInformationBranchesIdMutationError = ErrorType<unknown>
/**
* @summary Update site information branch
*/
export const usePatchSiteInformationBranchesId = <TError = ErrorType<unknown>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof patchSiteInformationBranchesId>>, TError,{id: string;data: BodyType<SiteInformationBranchMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof patchSiteInformationBranchesId>>,
TError,
{id: string;data: BodyType<SiteInformationBranchMutate>},
TContext
> => {
const mutationOptions = getPatchSiteInformationBranchesIdMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* @summary Delete site information branch
*/
export type deleteSiteInformationBranchesIdResponse200 = {
data: void
status: 200
}
export type deleteSiteInformationBranchesIdResponseSuccess = (deleteSiteInformationBranchesIdResponse200) & {
headers: Headers;
};
;
export type deleteSiteInformationBranchesIdResponse = (deleteSiteInformationBranchesIdResponseSuccess)
export const getDeleteSiteInformationBranchesIdUrl = (id: string,) => {
return `/siteInformation/branches/${id}`
}
export const deleteSiteInformationBranchesId = async (id: string, options?: RequestInit): Promise<deleteSiteInformationBranchesIdResponse> => {
return useCustomClient<deleteSiteInformationBranchesIdResponse>(getDeleteSiteInformationBranchesIdUrl(id),
{
...options,
method: 'DELETE'
}
);}
export const getDeleteSiteInformationBranchesIdMutationOptions = <TError = ErrorType<unknown>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteSiteInformationBranchesId>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof deleteSiteInformationBranchesId>>, TError,{id: string}, TContext> => {
const mutationKey = ['deleteSiteInformationBranchesId'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteSiteInformationBranchesId>>, {id: string}> = (props) => {
const {id} = props ?? {};
return deleteSiteInformationBranchesId(id,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type DeleteSiteInformationBranchesIdMutationResult = NonNullable<Awaited<ReturnType<typeof deleteSiteInformationBranchesId>>>
export type DeleteSiteInformationBranchesIdMutationError = ErrorType<unknown>
/**
* @summary Delete site information branch
*/
export const useDeleteSiteInformationBranchesId = <TError = ErrorType<unknown>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteSiteInformationBranchesId>>, TError,{id: string}, TContext>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof deleteSiteInformationBranchesId>>,
TError,
{id: string},
TContext
> => {
const mutationOptions = getDeleteSiteInformationBranchesIdMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
/**
* @summary Get site information branches
*/
export type getSiteInformationBranchesResponse200 = {
data: void
status: 200
}
export type getSiteInformationBranchesResponseSuccess = (getSiteInformationBranchesResponse200) & {
headers: Headers;
};
;
export type getSiteInformationBranchesResponse = (getSiteInformationBranchesResponseSuccess)
export const getGetSiteInformationBranchesUrl = () => {
return `/siteInformation/branches`
}
export const getSiteInformationBranches = async ( options?: RequestInit): Promise<getSiteInformationBranchesResponse> => {
return useCustomClient<getSiteInformationBranchesResponse>(getGetSiteInformationBranchesUrl(),
{
...options,
method: 'GET'
}
);}
export const getGetSiteInformationBranchesInfiniteQueryKey = () => {
return [
'infinite', `/siteInformation/branches`
] as const;
}
export const getGetSiteInformationBranchesQueryKey = () => {
return [
`/siteInformation/branches`
] as const;
}
export const getGetSiteInformationBranchesInfiniteQueryOptions = <TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformationBranches>>>, TError = ErrorType<unknown>>( options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetSiteInformationBranchesInfiniteQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSiteInformationBranches>>> = ({ signal }) => getSiteInformationBranches({ signal, ...requestOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetSiteInformationBranchesInfiniteQueryResult = NonNullable<Awaited<ReturnType<typeof getSiteInformationBranches>>>
export type GetSiteInformationBranchesInfiniteQueryError = ErrorType<unknown>
export function useGetSiteInformationBranchesInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformationBranches>>>, TError = ErrorType<unknown>>(
options: { query:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformationBranches>>,
TError,
Awaited<ReturnType<typeof getSiteInformationBranches>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): DefinedUseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformationBranchesInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformationBranches>>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformationBranches>>,
TError,
Awaited<ReturnType<typeof getSiteInformationBranches>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformationBranchesInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformationBranches>>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get site information branches
*/
export function useGetSiteInformationBranchesInfinite<TData = InfiniteData<Awaited<ReturnType<typeof getSiteInformationBranches>>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetSiteInformationBranchesInfiniteQueryOptions(options)
const query = useInfiniteQuery(queryOptions, queryClient) as UseInfiniteQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary Get site information branches
*/
export const prefetchGetSiteInformationBranchesInfiniteQuery = async <TData = Awaited<ReturnType<typeof getSiteInformationBranches>>, TError = ErrorType<unknown>>(
queryClient: QueryClient, options?: { query?:Partial<UseInfiniteQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
): Promise<QueryClient> => {
const queryOptions = getGetSiteInformationBranchesInfiniteQueryOptions(options)
await queryClient.prefetchInfiniteQuery(queryOptions);
return queryClient;
}
export const getGetSiteInformationBranchesQueryOptions = <TData = Awaited<ReturnType<typeof getSiteInformationBranches>>, TError = ErrorType<unknown>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetSiteInformationBranchesQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSiteInformationBranches>>> = ({ signal }) => getSiteInformationBranches({ signal, ...requestOptions });
return { queryKey, queryFn, retry: 3, retryDelay: 1000, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetSiteInformationBranchesQueryResult = NonNullable<Awaited<ReturnType<typeof getSiteInformationBranches>>>
export type GetSiteInformationBranchesQueryError = ErrorType<unknown>
export function useGetSiteInformationBranches<TData = Awaited<ReturnType<typeof getSiteInformationBranches>>, TError = ErrorType<unknown>>(
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformationBranches>>,
TError,
Awaited<ReturnType<typeof getSiteInformationBranches>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformationBranches<TData = Awaited<ReturnType<typeof getSiteInformationBranches>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getSiteInformationBranches>>,
TError,
Awaited<ReturnType<typeof getSiteInformationBranches>>
> , 'initialData'
>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetSiteInformationBranches<TData = Awaited<ReturnType<typeof getSiteInformationBranches>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Get site information branches
*/
export function useGetSiteInformationBranches<TData = Awaited<ReturnType<typeof getSiteInformationBranches>>, TError = ErrorType<unknown>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetSiteInformationBranchesQueryOptions(options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
query.queryKey = queryOptions.queryKey ;
return query;
}
/**
* @summary Get site information branches
*/
export const prefetchGetSiteInformationBranchesQuery = async <TData = Awaited<ReturnType<typeof getSiteInformationBranches>>, TError = ErrorType<unknown>>(
queryClient: QueryClient, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getSiteInformationBranches>>, TError, TData>>, request?: SecondParameter<typeof useCustomClient>}
): Promise<QueryClient> => {
const queryOptions = getGetSiteInformationBranchesQueryOptions(options)
await queryClient.prefetchQuery(queryOptions);
return queryClient;
}
/**
* @summary Create site information branch
*/
export type postSiteInformationBranchesResponse200 = {
data: void
status: 200
}
export type postSiteInformationBranchesResponseSuccess = (postSiteInformationBranchesResponse200) & {
headers: Headers;
};
;
export type postSiteInformationBranchesResponse = (postSiteInformationBranchesResponseSuccess)
export const getPostSiteInformationBranchesUrl = () => {
return `/siteInformation/branches`
}
export const postSiteInformationBranches = async (siteInformationBranchMutate: SiteInformationBranchMutate, options?: RequestInit): Promise<postSiteInformationBranchesResponse> => {
return useCustomClient<postSiteInformationBranchesResponse>(getPostSiteInformationBranchesUrl(),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(
siteInformationBranchMutate,)
}
);}
export const getPostSiteInformationBranchesMutationOptions = <TError = ErrorType<unknown>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postSiteInformationBranches>>, TError,{data: BodyType<SiteInformationBranchMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
): UseMutationOptions<Awaited<ReturnType<typeof postSiteInformationBranches>>, TError,{data: BodyType<SiteInformationBranchMutate>}, TContext> => {
const mutationKey = ['postSiteInformationBranches'];
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof postSiteInformationBranches>>, {data: BodyType<SiteInformationBranchMutate>}> = (props) => {
const {data} = props ?? {};
return postSiteInformationBranches(data,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type PostSiteInformationBranchesMutationResult = NonNullable<Awaited<ReturnType<typeof postSiteInformationBranches>>>
export type PostSiteInformationBranchesMutationBody = BodyType<SiteInformationBranchMutate>
export type PostSiteInformationBranchesMutationError = ErrorType<unknown>
/**
* @summary Create site information branch
*/
export const usePostSiteInformationBranches = <TError = ErrorType<unknown>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postSiteInformationBranches>>, TError,{data: BodyType<SiteInformationBranchMutate>}, TContext>, request?: SecondParameter<typeof useCustomClient>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof postSiteInformationBranches>>,
TError,
{data: BodyType<SiteInformationBranchMutate>},
TContext
> => {
const mutationOptions = getPostSiteInformationBranchesMutationOptions(options);
return useMutation(mutationOptions, queryClient);
}
\ No newline at end of file
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
export interface Banner {
id?: string;
banner_name?: string;
display_order?: number;
status?: string;
file_id?: string;
created_at?: string;
created_by?: string;
updated_at?: string;
updated_by?: string;
display_time?: number;
}
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
export interface BannerMutate {
banner_name?: string;
display_order?: number;
status?: string;
file_id?: string;
display_time?: number;
}
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { DeleteLogoId200AllOf } from './deleteLogoId200AllOf';
export type DeleteLogoId200 = ApiResponse & DeleteLogoId200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
export type DeleteLogoId200AllOf = {
responseData?: boolean;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { FiltersParameter } from './filtersParameter';
import type { SortFieldParameter } from './sortFieldParameter';
import type { SortOrderParameter } from './sortOrderParameter';
import type { PageParameter } from './pageParameter';
import type { PageSizeParameter } from './pageSizeParameter';
export type GetApiV10NewsletterSubscriptionParams = {
/**
* filter, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
filters?: FiltersParameter;
/**
* sortField, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortField?: SortFieldParameter;
/**
* sort order, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortOrder?: SortOrderParameter;
/**
* page, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
page?: PageParameter;
/**
* pageSize, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
pageSize?: PageSizeParameter;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { GetApiV10SiteInformation200AllOf } from './getApiV10SiteInformation200AllOf';
export type GetApiV10SiteInformation200 = ApiResponse & GetApiV10SiteInformation200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { SiteInformationData } from './siteInformationData';
export type GetApiV10SiteInformation200AllOf = {
responseData?: SiteInformationData;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { FiltersParameter } from './filtersParameter';
import type { SortFieldParameter } from './sortFieldParameter';
import type { SortOrderParameter } from './sortOrderParameter';
import type { PageParameter } from './pageParameter';
import type { PageSizeParameter } from './pageSizeParameter';
export type GetApiV10SiteInformationParams = {
/**
* filter, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
filters?: FiltersParameter;
/**
* sortField, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortField?: SortFieldParameter;
/**
* sort order, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortOrder?: SortOrderParameter;
/**
* page, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
page?: PageParameter;
/**
* pageSize, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
pageSize?: PageSizeParameter;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { GetApiV10VideoId200AllOf } from './getApiV10VideoId200AllOf';
export type GetApiV10VideoId200 = ApiResponse & GetApiV10VideoId200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { Video } from './video';
export type GetApiV10VideoId200AllOf = {
responseData?: Video;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { FiltersParameter } from './filtersParameter';
import type { SortFieldParameter } from './sortFieldParameter';
import type { SortOrderParameter } from './sortOrderParameter';
import type { PageParameter } from './pageParameter';
import type { PageSizeParameter } from './pageSizeParameter';
export type GetApiV10VideoParams = {
/**
* filter, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
filters?: FiltersParameter;
/**
* sortField, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortField?: SortFieldParameter;
/**
* sort order, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortOrder?: SortOrderParameter;
/**
* page, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
page?: PageParameter;
/**
* pageSize, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
pageSize?: PageSizeParameter;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { GetLogoId200AllOf } from './getLogoId200AllOf';
export type GetLogoId200 = ApiResponse & GetLogoId200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { Logo } from './logo';
export type GetLogoId200AllOf = {
responseData?: Logo;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { FiltersParameter } from './filtersParameter';
import type { SortFieldParameter } from './sortFieldParameter';
import type { SortOrderParameter } from './sortOrderParameter';
import type { PageParameter } from './pageParameter';
import type { PageSizeParameter } from './pageSizeParameter';
export type GetLogoParams = {
/**
* filter, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
filters?: FiltersParameter;
/**
* sortField, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortField?: SortFieldParameter;
/**
* sort order, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortOrder?: SortOrderParameter;
/**
* page, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
page?: PageParameter;
/**
* pageSize, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
pageSize?: PageSizeParameter;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { GetSiteInformation200AllOf } from './getSiteInformation200AllOf';
export type GetSiteInformation200 = ApiResponse & GetSiteInformation200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { SiteInformationData } from './siteInformationData';
export type GetSiteInformation200AllOf = {
responseData?: SiteInformationData;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { FiltersParameter } from './filtersParameter';
import type { SortFieldParameter } from './sortFieldParameter';
import type { SortOrderParameter } from './sortOrderParameter';
import type { PageParameter } from './pageParameter';
import type { PageSizeParameter } from './pageSizeParameter';
export type GetSiteInformationParams = {
/**
* filter, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
filters?: FiltersParameter;
/**
* sortField, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortField?: SortFieldParameter;
/**
* sort order, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
*/
sortOrder?: SortOrderParameter;
/**
* page, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
page?: PageParameter;
/**
* pageSize, visit https://www.npmjs.com/package/sequelize-api-paginate for syntax
* @minimum 1
*/
pageSize?: PageSizeParameter;
};
...@@ -16,6 +16,8 @@ export * from './badRequestResponseError'; ...@@ -16,6 +16,8 @@ export * from './badRequestResponseError';
export * from './badRequestResponseErrorMessage'; export * from './badRequestResponseErrorMessage';
export * from './badRequestResponseResponseData'; export * from './badRequestResponseResponseData';
export * from './badRequestResponseViolationItem'; export * from './badRequestResponseViolationItem';
export * from './banner';
export * from './bannerMutate';
export * from './business'; export * from './business';
export * from './businessCreate'; export * from './businessCreate';
export * from './businessDeleteResponse'; export * from './businessDeleteResponse';
...@@ -51,6 +53,8 @@ export * from './deleteContactId200AllOf'; ...@@ -51,6 +53,8 @@ export * from './deleteContactId200AllOf';
export * from './deleteEventsLinkParams'; export * from './deleteEventsLinkParams';
export * from './deleteEventsParams'; export * from './deleteEventsParams';
export * from './deleteFilesBody'; export * from './deleteFilesBody';
export * from './deleteLogoId200';
export * from './deleteLogoId200AllOf';
export * from './deleteMembershipFeeParams'; export * from './deleteMembershipFeeParams';
export * from './deleteNewsParams'; export * from './deleteNewsParams';
export * from './deleteNotificationsParams'; export * from './deleteNotificationsParams';
...@@ -93,7 +97,14 @@ export * from './getApiV10CategoryParams'; ...@@ -93,7 +97,14 @@ export * from './getApiV10CategoryParams';
export * from './getApiV10ContactId200'; export * from './getApiV10ContactId200';
export * from './getApiV10ContactId200AllOf'; export * from './getApiV10ContactId200AllOf';
export * from './getApiV10ContactParams'; export * from './getApiV10ContactParams';
export * from './getApiV10NewsletterSubscriptionParams';
export * from './getApiV10PageConfigParams'; export * from './getApiV10PageConfigParams';
export * from './getApiV10SiteInformation200';
export * from './getApiV10SiteInformation200AllOf';
export * from './getApiV10SiteInformationParams';
export * from './getApiV10VideoId200';
export * from './getApiV10VideoId200AllOf';
export * from './getApiV10VideoParams';
export * from './getApprovalParams'; export * from './getApprovalParams';
export * from './getCategoryId200'; export * from './getCategoryId200';
export * from './getCategoryId200AllOf'; export * from './getCategoryId200AllOf';
...@@ -109,6 +120,9 @@ export * from './getEventsMyEventsParams'; ...@@ -109,6 +120,9 @@ export * from './getEventsMyEventsParams';
export * from './getEventsParams'; export * from './getEventsParams';
export * from './getEventsSlugSlugParams'; export * from './getEventsSlugSlugParams';
export * from './getFooterParams'; export * from './getFooterParams';
export * from './getLogoId200';
export * from './getLogoId200AllOf';
export * from './getLogoParams';
export * from './getMembershipFeeParams'; export * from './getMembershipFeeParams';
export * from './getMembershipFeePrintParams'; export * from './getMembershipFeePrintParams';
export * from './getNewsAdminParams'; export * from './getNewsAdminParams';
...@@ -136,6 +150,9 @@ export * from './getProductsParams'; ...@@ -136,6 +150,9 @@ export * from './getProductsParams';
export * from './getScheduleGetMyScheduleParams'; export * from './getScheduleGetMyScheduleParams';
export * from './getScheduleGetScheduledTimeByEventEventIdParams'; export * from './getScheduleGetScheduledTimeByEventEventIdParams';
export * from './getScheduleManageMyScheduleParams'; export * from './getScheduleManageMyScheduleParams';
export * from './getSiteInformation200';
export * from './getSiteInformation200AllOf';
export * from './getSiteInformationParams';
export * from './getStatisticMemberByMonthParams'; export * from './getStatisticMemberByMonthParams';
export * from './getStatisticMembershipFeeByMonthParams'; export * from './getStatisticMembershipFeeByMonthParams';
export * from './getStatisticSiteAccessParams'; export * from './getStatisticSiteAccessParams';
...@@ -219,6 +236,10 @@ export * from './pageConfigTag'; ...@@ -219,6 +236,10 @@ export * from './pageConfigTag';
export * from './pageConfigTagMutate'; export * from './pageConfigTagMutate';
export * from './pageParameter'; export * from './pageParameter';
export * from './pageSizeParameter'; export * from './pageSizeParameter';
export * from './patchApiV10NewsletterSubscriptionId200';
export * from './patchApiV10NewsletterSubscriptionId200AllOf';
export * from './patchApiV10VideoId200';
export * from './patchApiV10VideoId200AllOf';
export * from './patchNewsletterSubscriptionId200'; export * from './patchNewsletterSubscriptionId200';
export * from './patchNewsletterSubscriptionId200AllOf'; export * from './patchNewsletterSubscriptionId200AllOf';
export * from './patchVideoId200'; export * from './patchVideoId200';
...@@ -239,7 +260,11 @@ export * from './postApiV10Category200'; ...@@ -239,7 +260,11 @@ export * from './postApiV10Category200';
export * from './postApiV10Category200AllOf'; export * from './postApiV10Category200AllOf';
export * from './postApiV10Contact200'; export * from './postApiV10Contact200';
export * from './postApiV10Contact200AllOf'; export * from './postApiV10Contact200AllOf';
export * from './postApiV10NewsletterSubscription200';
export * from './postApiV10NewsletterSubscription200AllOf';
export * from './postApiV10PageConfigBody'; export * from './postApiV10PageConfigBody';
export * from './postApiV10Video200';
export * from './postApiV10Video200AllOf';
export * from './postAuthForgotPasswordBody'; export * from './postAuthForgotPasswordBody';
export * from './postCategory'; export * from './postCategory';
export * from './postCategory200'; export * from './postCategory200';
...@@ -253,6 +278,8 @@ export * from './postContentStructure'; ...@@ -253,6 +278,8 @@ export * from './postContentStructure';
export * from './postEventsIdExportJoinedOrgsMode'; export * from './postEventsIdExportJoinedOrgsMode';
export * from './postEventsIdExportJoinedOrgsParams'; export * from './postEventsIdExportJoinedOrgsParams';
export * from './postFilesBody'; export * from './postFilesBody';
export * from './postLogo200';
export * from './postLogo200AllOf';
export * from './postMembershipFeeCreateAccountsAndFeesBody'; export * from './postMembershipFeeCreateAccountsAndFeesBody';
export * from './postMembershipFeeCreateAccountsAndFeesBodyOrganizationsItem'; export * from './postMembershipFeeCreateAccountsAndFeesBodyOrganizationsItem';
export * from './postMembershipFeeSendUpdateReminderBody'; export * from './postMembershipFeeSendUpdateReminderBody';
...@@ -283,6 +310,8 @@ export * from './putApiV10CategoryId200AllOf'; ...@@ -283,6 +310,8 @@ export * from './putApiV10CategoryId200AllOf';
export * from './putApiV10ContactId200'; export * from './putApiV10ContactId200';
export * from './putApiV10ContactId200AllOf'; export * from './putApiV10ContactId200AllOf';
export * from './putApiV10PageConfigIdBody'; export * from './putApiV10PageConfigIdBody';
export * from './putApiV10SiteInformation200';
export * from './putApiV10SiteInformation200AllOf';
export * from './putAuthAssignBusinessInterestBody'; export * from './putAuthAssignBusinessInterestBody';
export * from './putAuthUpdatePasswordBody'; export * from './putAuthUpdatePasswordBody';
export * from './putCategoryId200'; export * from './putCategoryId200';
...@@ -293,6 +322,8 @@ export * from './putContactId200AllOf'; ...@@ -293,6 +322,8 @@ export * from './putContactId200AllOf';
export * from './putEventsLinkParams'; export * from './putEventsLinkParams';
export * from './putEventsParams'; export * from './putEventsParams';
export * from './putFooterParams'; export * from './putFooterParams';
export * from './putLogoId200';
export * from './putLogoId200AllOf';
export * from './putMembershipFeeParams'; export * from './putMembershipFeeParams';
export * from './putNewsPageConfigCategoryIdBody'; export * from './putNewsPageConfigCategoryIdBody';
export * from './putNotificationsMarkAsReadParams'; export * from './putNotificationsMarkAsReadParams';
...@@ -305,6 +336,8 @@ export * from './putOrganizationsParams'; ...@@ -305,6 +336,8 @@ export * from './putOrganizationsParams';
export * from './putPageConfigIdBody'; export * from './putPageConfigIdBody';
export * from './putPermisionFunctionParams'; export * from './putPermisionFunctionParams';
export * from './putProductsParams'; export * from './putProductsParams';
export * from './putSiteInformation200';
export * from './putSiteInformation200AllOf';
export * from './putUserDepartmentParams'; export * from './putUserDepartmentParams';
export * from './putUserHistoryParams'; export * from './putUserHistoryParams';
export * from './refreshToken'; export * from './refreshToken';
...@@ -329,14 +362,20 @@ export * from './rolePermissionMutate'; ...@@ -329,14 +362,20 @@ export * from './rolePermissionMutate';
export * from './roleUpdate'; export * from './roleUpdate';
export * from './schemaMigration'; export * from './schemaMigration';
export * from './schemaMigrationMutate'; export * from './schemaMigrationMutate';
export * from './sequelizemeta';
export * from './sequelizemetaMutate';
export * from './siteInformation'; export * from './siteInformation';
export * from './siteInformationBranch';
export * from './siteInformationBranchMutate';
export * from './siteInformationData'; export * from './siteInformationData';
export * from './siteInformationDataLogo';
export * from './siteInformationLinkSocials'; export * from './siteInformationLinkSocials';
export * from './siteInformationMutate'; export * from './siteInformationMutate';
export * from './siteInformationMutateLinkSocials'; export * from './siteInformationMutateLinkSocials';
export * from './siteInformationResponse'; export * from './siteInformationResponse';
export * from './siteInformationResponseAllOf'; export * from './siteInformationResponseAllOf';
export * from './siteInformationSocialLink'; export * from './siteInformationSocialLink';
export * from './siteInformationSocialMutate';
export * from './siteInformationUpdateBody'; export * from './siteInformationUpdateBody';
export * from './sortFieldParameter'; export * from './sortFieldParameter';
export * from './sortOrderParameter'; export * from './sortOrderParameter';
......
...@@ -5,15 +5,14 @@ ...@@ -5,15 +5,14 @@
* Generated API documentation * Generated API documentation
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
import type { LogoFile } from './logoFile';
export interface Logo { export interface Logo {
id: string; id: string;
/** @maxLength 255 */ /** @maxLength 255 */
logo_name: string; logo_name: string;
/** @nullable */ /** @nullable */
description?: string | null; logo_url?: string | null;
file_id: LogoFile; file_id: string;
created_at: string; created_at: string;
/** @nullable */ /** @nullable */
created_by?: string | null; created_by?: string | null;
......
...@@ -10,6 +10,6 @@ export interface LogoCreate { ...@@ -10,6 +10,6 @@ export interface LogoCreate {
/** @maxLength 255 */ /** @maxLength 255 */
logo_name: string; logo_name: string;
/** @nullable */ /** @nullable */
description?: string | null; logo_url?: string | null;
file_id: string; file_id: string;
} }
...@@ -10,6 +10,6 @@ export interface LogoUpdate { ...@@ -10,6 +10,6 @@ export interface LogoUpdate {
/** @maxLength 255 */ /** @maxLength 255 */
logo_name?: string; logo_name?: string;
/** @nullable */ /** @nullable */
description?: string | null; logo_url?: string | null;
file_id?: string; file_id?: string;
} }
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { PatchApiV10NewsletterSubscriptionId200AllOf } from './patchApiV10NewsletterSubscriptionId200AllOf';
export type PatchApiV10NewsletterSubscriptionId200 = ApiResponse & PatchApiV10NewsletterSubscriptionId200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { NewsletterSubscription } from './newsletterSubscription';
export type PatchApiV10NewsletterSubscriptionId200AllOf = {
responseData?: NewsletterSubscription;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { PatchApiV10VideoId200AllOf } from './patchApiV10VideoId200AllOf';
export type PatchApiV10VideoId200 = ApiResponse & PatchApiV10VideoId200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { Video } from './video';
export type PatchApiV10VideoId200AllOf = {
responseData?: Video;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { PostApiV10NewsletterSubscription200AllOf } from './postApiV10NewsletterSubscription200AllOf';
export type PostApiV10NewsletterSubscription200 = ApiResponse & PostApiV10NewsletterSubscription200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { NewsletterSubscription } from './newsletterSubscription';
export type PostApiV10NewsletterSubscription200AllOf = {
responseData?: NewsletterSubscription;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { PostApiV10Video200AllOf } from './postApiV10Video200AllOf';
export type PostApiV10Video200 = ApiResponse & PostApiV10Video200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { Video } from './video';
export type PostApiV10Video200AllOf = {
responseData?: Video;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { PostLogo200AllOf } from './postLogo200AllOf';
export type PostLogo200 = ApiResponse & PostLogo200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { Logo } from './logo';
export type PostLogo200AllOf = {
responseData?: Logo;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { PutApiV10SiteInformation200AllOf } from './putApiV10SiteInformation200AllOf';
export type PutApiV10SiteInformation200 = ApiResponse & PutApiV10SiteInformation200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
import type { SiteInformationData } from './siteInformationData';
export type PutApiV10SiteInformation200AllOf = {
responseData?: SiteInformationData;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { PutLogoId200AllOf } from './putLogoId200AllOf';
export type PutLogoId200 = ApiResponse & PutLogoId200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { Logo } from './logo';
export type PutLogoId200AllOf = {
responseData?: Logo;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { ApiResponse } from './apiResponse';
import type { PutSiteInformation200AllOf } from './putSiteInformation200AllOf';
export type PutSiteInformation200 = ApiResponse & PutSiteInformation200AllOf;
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { SiteInformationData } from './siteInformationData';
export type PutSiteInformation200AllOf = {
responseData?: SiteInformationData;
};
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
export interface Sequelizemeta {
name?: string;
}
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* VietProDev CMS Backend API
* Generated API documentation
* OpenAPI spec version: 1.0.0
*/
export interface SequelizemetaMutate {
name?: string;
}
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
export interface SiteInformationBranch {
id?: string;
/** @nullable */
branch_name?: string | null;
/** @nullable */
hotline?: string | null;
/** @nullable */
telephone?: string | null;
/** @nullable */
email?: string | null;
/** @nullable */
address?: string | null;
/** @nullable */
fax?: string | null;
/** @nullable */
googlemap_link?: string | null;
sort_order?: number;
is_active?: boolean;
created_at?: string;
/** @nullable */
created_by?: string | null;
updated_at?: string;
/** @nullable */
updated_by?: string | null;
}
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
export interface SiteInformationBranchMutate {
/** @nullable */
branch_name?: string | null;
/** @nullable */
hotline?: string | null;
/** @nullable */
email?: string | null;
/** @nullable */
address?: string | null;
/** @nullable */
fax?: string | null;
/** @nullable */
googlemap_link?: string | null;
sort_order?: number;
is_active?: boolean;
}
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* VietProDev CMS Backend API * Backend Template
* Generated API documentation * Coded by Meu TEAM
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
import type { SiteInformationDataLogo } from './siteInformationDataLogo';
import type { SiteInformationSocialLink } from './siteInformationSocialLink'; import type { SiteInformationSocialLink } from './siteInformationSocialLink';
import type { SiteInformationBranch } from './siteInformationBranch';
export interface SiteInformationData { export interface SiteInformationData {
id?: string; id?: string;
code?: string; code?: string;
/** @nullable */ /** @nullable */
website_name?: string | null;
/** @nullable */
website_link?: string | null;
/** @nullable */
logo?: SiteInformationDataLogo;
/** @nullable */
telephone?: string | null; telephone?: string | null;
/** @nullable */ /** @nullable */
email?: string | null; email?: string | null;
...@@ -19,6 +27,8 @@ export interface SiteInformationData { ...@@ -19,6 +27,8 @@ export interface SiteInformationData {
/** @nullable */ /** @nullable */
working_hours?: string | null; working_hours?: string | null;
link_socials?: SiteInformationSocialLink[]; link_socials?: SiteInformationSocialLink[];
branches?: SiteInformationBranch[];
socials?: SiteInformationSocialLink[];
created_at?: string; created_at?: string;
/** @nullable */ /** @nullable */
created_by?: string | null; created_by?: string | null;
......
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
import type { Logo } from './logo';
/**
* @nullable
*/
export type SiteInformationDataLogo = Logo | null;
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* VietProDev CMS Backend API * Backend Template
* Generated API documentation * Coded by Meu TEAM
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
import type { ApiResponse } from './apiResponse'; import type { ApiResponse } from './apiResponse';
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* VietProDev CMS Backend API * Backend Template
* Generated API documentation * Coded by Meu TEAM
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
import type { SiteInformationData } from './siteInformationData'; import type { SiteInformationData } from './siteInformationData';
......
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* VietProDev CMS Backend API * Backend Template
* Generated API documentation * Coded by Meu TEAM
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
export interface SiteInformationSocialLink { export interface SiteInformationSocialLink {
id: string;
/** Social platform key (lowercase recommended) */ /** Social platform key (lowercase recommended) */
platform: string; platform: string;
/** Display label for the social platform */ /** Display label for the social platform */
label: string; label: string;
/** Public URL to the social page */ /**
url: string; * Public URL to the social page
* @nullable
*/
url?: string | null;
/** Icon key used by FE to render correct icon */ /** Icon key used by FE to render correct icon */
icon_key: string; icon_key: string;
/** Whether this social link is active */ /** Whether this social link is active */
is_active: boolean; is_active: boolean;
/** Display order */
sort_order: number;
} }
/**
* Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually.
* Backend Template
* Coded by Meu TEAM
* OpenAPI spec version: 1.0.0
*/
export interface SiteInformationSocialMutate {
/** @nullable */
url?: string | null;
sort_order?: number;
is_active?: boolean;
}
/** /**
* Generated by orval v8.0.0-rc.0 🍺 * Generated by orval v8.0.0-rc.0 🍺
* Do not edit manually. * Do not edit manually.
* VietProDev CMS Backend API * Backend Template
* Generated API documentation * Coded by Meu TEAM
* OpenAPI spec version: 1.0.0 * OpenAPI spec version: 1.0.0
*/ */
import type { SiteInformationSocialLink } from './siteInformationSocialLink'; import type { SiteInformationSocialLink } from './siteInformationSocialLink';
...@@ -11,6 +11,10 @@ export interface SiteInformationUpdateBody { ...@@ -11,6 +11,10 @@ export interface SiteInformationUpdateBody {
/** @nullable */ /** @nullable */
telephone?: string | null; telephone?: string | null;
/** @nullable */ /** @nullable */
website_name?: string | null;
/** @nullable */
website_link?: string | null;
/** @nullable */
email?: string | null; email?: string | null;
/** @nullable */ /** @nullable */
address?: string | null; address?: string | null;
......
...@@ -35,6 +35,22 @@ import { Checkbox } from "@/components/ui/checkbox"; ...@@ -35,6 +35,22 @@ import { Checkbox } from "@/components/ui/checkbox";
import { Switch } from "@/components/ui/switch"; import { Switch } from "@/components/ui/switch";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Textarea } from "@/components/ui/textarea"; import { Textarea } from "@/components/ui/textarea";
import {
deleteSiteInformationBranchesId,
getSiteInformation,
patchSiteInformationBranchesId,
patchSiteInformationSocialsId,
postSiteInformationBranches,
putSiteInformation,
} from "@/api/endpoints/site-information";
import { deleteLogoId, postLogo, putLogoId } from "@/api/endpoints/logo";
import type {
SiteInformationBranch,
SiteInformationBranchMutate,
SiteInformationData,
SiteInformationSocialLink,
SiteInformationSocialMutate,
} from "@/api/models";
import type { AdminMediaItem } from "@/mockdata/admin-news"; import type { AdminMediaItem } from "@/mockdata/admin-news";
import { import {
type BaseConfigBannerItem, type BaseConfigBannerItem,
...@@ -48,6 +64,7 @@ import { ...@@ -48,6 +64,7 @@ import {
persistBaseConfig, persistBaseConfig,
readBaseConfig, readBaseConfig,
sortBaseConfigBanners, sortBaseConfigBanners,
sortBaseConfigBranches,
sortBaseConfigSocials, sortBaseConfigSocials,
} from "@/mockdata/base-config"; } from "@/mockdata/base-config";
...@@ -55,6 +72,17 @@ const fieldClassName = ...@@ -55,6 +72,17 @@ const fieldClassName =
"rounded-xl border-[#063e8e]/15 bg-white text-gray-700 placeholder:text-gray-700 focus-visible:ring-[#063e8e]/30"; "rounded-xl border-[#063e8e]/15 bg-white text-gray-700 placeholder:text-gray-700 focus-visible:ring-[#063e8e]/30";
type ConfigItemMode = "logo" | "banner"; type ConfigItemMode = "logo" | "banner";
type ApiEnvelope<T> = {
responseData?: T;
data?: {
responseData?: T;
};
};
type LogoMediaItem = AdminMediaItem & {
logoId?: string;
};
type ConfigItemForm = { type ConfigItemForm = {
name: string; name: string;
imageId: string; imageId: string;
...@@ -77,6 +105,110 @@ function resolveMediaItem(mediaMap: Map<string, AdminMediaItem>, imageId: string ...@@ -77,6 +105,110 @@ function resolveMediaItem(mediaMap: Map<string, AdminMediaItem>, imageId: string
return mediaMap.get(imageId) ?? null; return mediaMap.get(imageId) ?? null;
} }
function getEnvelopeData<T>(payload: unknown): T | undefined {
const root = payload as ApiEnvelope<T>;
return root.responseData ?? root.data?.responseData;
}
function mapApiBranchToConfig(branch: SiteInformationBranch): BaseConfigBranchItem {
return {
id: branch.id ?? createBaseConfigItemId("branch"),
branchName: branch.branch_name ?? "",
address: branch.address ?? "",
hotline: branch.hotline ?? branch.telephone ?? "",
email: branch.email ?? "",
fax: branch.fax ?? "",
mapsEmbedUrl: branch.googlemap_link ?? "",
sortOrder: branch.sort_order ?? 1,
isVisible: branch.is_active ?? true,
};
}
function mapConfigBranchToApi(
branch: BaseConfigBranchItem,
index: number,
): SiteInformationBranchMutate {
return {
branch_name: branch.branchName.trim() || null,
address: branch.address.trim() || null,
hotline: branch.hotline.trim() || null,
email: branch.email.trim() || null,
fax: branch.fax.trim() || null,
googlemap_link: branch.mapsEmbedUrl.trim() || null,
sort_order: Number.isFinite(branch.sortOrder) ? branch.sortOrder : index + 1,
is_active: branch.isVisible,
};
}
function mapApiSocialToConfig(social: SiteInformationSocialLink): BaseConfigSocialItem {
return {
id: social.id,
label: social.label,
url: social.url ?? "",
isVisible: social.is_active,
sortOrder: social.sort_order,
};
}
function mapConfigSocialToApi(social: BaseConfigSocialItem): SiteInformationSocialMutate {
return {
url: social.url.trim() || null,
sort_order: social.sortOrder,
is_active: social.isVisible,
};
}
function mapSiteLogoToConfig(siteInformation: SiteInformationData): {
logo: BaseConfigLogoItem | null;
media: LogoMediaItem | null;
} | null {
const logo = siteInformation.logo;
if (!logo) return null;
const media: LogoMediaItem = {
id: logo.file_id,
logoId: logo.id,
name: logo.logo_name,
alt: logo.logo_name,
url: logo.logo_url || "/img-error.png",
mime: "image/*",
size: 0,
created_at: logo.created_at,
updated_at: logo.updated_at,
source: "upload",
};
return {
logo: {
id: logo.id,
name: logo.logo_name,
imageId: logo.file_id,
isActive: true,
},
media,
};
}
function applySiteInformationToConfig(
baseConfig: BaseConfigData,
siteInformation: SiteInformationData,
): BaseConfigData {
const logoConfig = mapSiteLogoToConfig(siteInformation);
return {
...baseConfig,
logo: logoConfig?.logo ?? baseConfig.logo,
websiteName: siteInformation.website_name ?? baseConfig.websiteName,
websiteLink: siteInformation.website_link ?? baseConfig.websiteLink,
branches: Array.isArray(siteInformation.branches)
? siteInformation.branches.map(mapApiBranchToConfig)
: baseConfig.branches,
socials: Array.isArray(siteInformation.socials)
? siteInformation.socials.map(mapApiSocialToConfig)
: baseConfig.socials,
};
}
function ConfigItemPreview({ function ConfigItemPreview({
title, title,
item, item,
...@@ -309,6 +441,7 @@ export default function AdminBaseConfigPage() { ...@@ -309,6 +441,7 @@ export default function AdminBaseConfigPage() {
const [mediaItems, setMediaItems] = React.useState<AdminMediaItem[]>([]); const [mediaItems, setMediaItems] = React.useState<AdminMediaItem[]>([]);
const [currentBannerIndex, setCurrentBannerIndex] = React.useState(0); const [currentBannerIndex, setCurrentBannerIndex] = React.useState(0);
const [currentBranchIndex, setCurrentBranchIndex] = React.useState(0); const [currentBranchIndex, setCurrentBranchIndex] = React.useState(0);
const [currentBranchId, setCurrentBranchId] = React.useState<string | null>(null);
const [activeTab, setActiveTab] = React.useState("branding"); const [activeTab, setActiveTab] = React.useState("branding");
const [itemDialogOpen, setItemDialogOpen] = React.useState(false); const [itemDialogOpen, setItemDialogOpen] = React.useState(false);
const [itemDialogMode, setItemDialogMode] = React.useState<ConfigItemMode>("logo"); const [itemDialogMode, setItemDialogMode] = React.useState<ConfigItemMode>("logo");
...@@ -316,7 +449,9 @@ export default function AdminBaseConfigPage() { ...@@ -316,7 +449,9 @@ export default function AdminBaseConfigPage() {
const [itemForm, setItemForm] = React.useState<ConfigItemForm>(emptyItemForm()); const [itemForm, setItemForm] = React.useState<ConfigItemForm>(emptyItemForm());
const [imagePickerOpen, setImagePickerOpen] = React.useState(false); const [imagePickerOpen, setImagePickerOpen] = React.useState(false);
const [savingItem, setSavingItem] = React.useState(false); const [savingItem, setSavingItem] = React.useState(false);
const [savingWebsiteInfo, setSavingWebsiteInfo] = React.useState(false);
const [savingContact, setSavingContact] = React.useState(false); const [savingContact, setSavingContact] = React.useState(false);
const [savingSocials, setSavingSocials] = React.useState(false);
const [deleteTarget, setDeleteTarget] = React.useState<{ const [deleteTarget, setDeleteTarget] = React.useState<{
mode: ConfigItemMode; mode: ConfigItemMode;
id: string; id: string;
...@@ -324,7 +459,43 @@ export default function AdminBaseConfigPage() { ...@@ -324,7 +459,43 @@ export default function AdminBaseConfigPage() {
} | null>(null); } | null>(null);
React.useEffect(() => { React.useEffect(() => {
setConfig(readBaseConfig()); let mounted = true;
const baseConfig = readBaseConfig();
setConfig(baseConfig);
const loadSiteInformation = async () => {
try {
const response = await getSiteInformation();
const siteInformation = getEnvelopeData<SiteInformationData>(response);
if (!mounted || !siteInformation) return;
const logoConfig = mapSiteLogoToConfig(siteInformation);
if (logoConfig?.media) {
const logoMedia = logoConfig.media;
setMediaItems((previous) => {
const nextMap = new Map(previous.map((entry) => [entry.id, entry]));
nextMap.set(logoMedia.id, logoMedia);
return Array.from(nextMap.values());
});
}
setConfig((previous) =>
applySiteInformationToConfig(previous ?? baseConfig, siteInformation),
);
} catch (error) {
console.error(error);
if (mounted) {
toast.error("Không thể tải thông tin liên hệ website");
}
}
};
void loadSiteInformation();
return () => {
mounted = false;
};
}, []); }, []);
const mediaMap = React.useMemo( const mediaMap = React.useMemo(
...@@ -339,10 +510,17 @@ export default function AdminBaseConfigPage() { ...@@ -339,10 +510,17 @@ export default function AdminBaseConfigPage() {
() => (config ? sortBaseConfigSocials(config.socials) : []), () => (config ? sortBaseConfigSocials(config.socials) : []),
[config], [config],
); );
const sortedBranches = React.useMemo(
() => (config ? sortBaseConfigBranches(config.branches) : []),
[config],
);
const currentLogo = config?.logo ?? null; const currentLogo = config?.logo ?? null;
const currentBanner = sortedBanners[currentBannerIndex] ?? null; const currentBanner = sortedBanners[currentBannerIndex] ?? null;
const currentBranch = config?.branches[currentBranchIndex] ?? null; const currentBranch =
(currentBranchId ? sortedBranches.find((branch) => branch.id === currentBranchId) : null) ??
sortedBranches[currentBranchIndex] ??
null;
const currentLogoMedia = currentLogo ? resolveMediaItem(mediaMap, currentLogo.imageId) : null; const currentLogoMedia = currentLogo ? resolveMediaItem(mediaMap, currentLogo.imageId) : null;
const currentBannerMedia = currentBanner const currentBannerMedia = currentBanner
? resolveMediaItem(mediaMap, currentBanner.imageId) ? resolveMediaItem(mediaMap, currentBanner.imageId)
...@@ -377,7 +555,7 @@ export default function AdminBaseConfigPage() { ...@@ -377,7 +555,7 @@ export default function AdminBaseConfigPage() {
setItemDialogOpen(true); setItemDialogOpen(true);
}; };
const handleSubmitItem = () => { const handleSubmitItem = async () => {
if (!config) return; if (!config) return;
const trimmedName = itemForm.name.trim(); const trimmedName = itemForm.name.trim();
...@@ -393,17 +571,47 @@ export default function AdminBaseConfigPage() { ...@@ -393,17 +571,47 @@ export default function AdminBaseConfigPage() {
setSavingItem(true); setSavingItem(true);
if (itemDialogMode === "logo") {
const selectedMedia = resolveMediaItem(mediaMap, itemForm.imageId);
const currentLogoId = editingItemId || currentLogo?.id || null;
try {
const response = currentLogoId
? await putLogoId(currentLogoId, {
logo_name: trimmedName,
logo_url: selectedMedia?.url ?? null,
file_id: itemForm.imageId,
})
: await postLogo({
logo_name: trimmedName,
logo_url: selectedMedia?.url ?? null,
file_id: itemForm.imageId,
});
const savedLogo = getEnvelopeData<NonNullable<SiteInformationData["logo"]>>(response);
const nextConfig = cloneBaseConfigData(config);
nextConfig.logo = {
id: savedLogo?.id ?? currentLogoId ?? createBaseConfigItemId("logo"),
name: savedLogo?.logo_name ?? trimmedName,
imageId: savedLogo?.file_id ?? itemForm.imageId,
isActive: true,
};
saveConfig(nextConfig);
setSavingItem(false);
setItemDialogOpen(false);
toast.success("Đã lưu cấu hình logo");
} catch (error) {
console.error(error);
setSavingItem(false);
toast.error("Không thể lưu cấu hình logo");
}
return;
}
const nextConfig = cloneBaseConfigData(config); const nextConfig = cloneBaseConfigData(config);
if (itemDialogMode === "logo") { if (editingItemId) {
nextConfig.logo = {
id: editingItemId || currentLogo?.id || createBaseConfigItemId("logo"),
name: trimmedName,
imageId: itemForm.imageId,
isActive: true,
};
} else {
if (editingItemId) {
nextConfig.banners = nextConfig.banners.map((item) => nextConfig.banners = nextConfig.banners.map((item) =>
item.id === editingItemId item.id === editingItemId
? { ? {
...@@ -416,7 +624,7 @@ export default function AdminBaseConfigPage() { ...@@ -416,7 +624,7 @@ export default function AdminBaseConfigPage() {
} }
: item, : item,
); );
} else { } else {
nextConfig.banners.push({ nextConfig.banners.push({
id: createBaseConfigItemId("banner"), id: createBaseConfigItemId("banner"),
name: trimmedName, name: trimmedName,
...@@ -426,26 +634,33 @@ export default function AdminBaseConfigPage() { ...@@ -426,26 +634,33 @@ export default function AdminBaseConfigPage() {
sortOrder: itemForm.sortOrder, sortOrder: itemForm.sortOrder,
}); });
setCurrentBannerIndex(Math.max(nextConfig.banners.length - 1, 0)); setCurrentBannerIndex(Math.max(nextConfig.banners.length - 1, 0));
}
} }
saveConfig(nextConfig); saveConfig(nextConfig);
setSavingItem(false); setSavingItem(false);
setItemDialogOpen(false); setItemDialogOpen(false);
toast.success( toast.success(
itemDialogMode === "logo" false
? "Đã lưu cấu hình logo" ? "Đã lưu cấu hình logo"
: "Đã lưu cấu hình banner", : "Đã lưu cấu hình banner",
); );
}; };
const handleDeleteItem = () => { const handleDeleteItem = async () => {
if (!config || !deleteTarget) return; if (!config || !deleteTarget) return;
const nextConfig = cloneBaseConfigData(config); const nextConfig = cloneBaseConfigData(config);
if (deleteTarget.mode === "logo") { if (deleteTarget.mode === "logo") {
nextConfig.logo = null; try {
await deleteLogoId(deleteTarget.id);
nextConfig.logo = null;
} catch (error) {
console.error(error);
toast.error("Không thể xóa cấu hình logo");
setDeleteTarget(null);
return;
}
} else { } else {
nextConfig.banners = nextConfig.banners.filter((item) => item.id !== deleteTarget.id); nextConfig.banners = nextConfig.banners.filter((item) => item.id !== deleteTarget.id);
setCurrentBannerIndex((previous) => setCurrentBannerIndex((previous) =>
...@@ -468,8 +683,8 @@ export default function AdminBaseConfigPage() { ...@@ -468,8 +683,8 @@ export default function AdminBaseConfigPage() {
previous previous
? { ? {
...previous, ...previous,
branches: previous.branches.map((branch, index) => branches: previous.branches.map((branch) =>
index === currentBranchIndex ? { ...branch, [key]: value } : branch, branch.id === currentBranch.id ? { ...branch, [key]: value } : branch,
), ),
} }
: previous, : previous,
...@@ -512,14 +727,120 @@ export default function AdminBaseConfigPage() { ...@@ -512,14 +727,120 @@ export default function AdminBaseConfigPage() {
toast.success("Đã lưu danh sách chi nhánh liên hệ"); toast.success("Đã lưu danh sách chi nhánh liên hệ");
}; };
const handleAddBranchApi = async () => {
if (!config) return;
setSavingContact(true);
try {
const response = await postSiteInformationBranches({
branch_name: `Chi nhánh ${config.branches.length + 1}`,
sort_order: config.branches.length + 1,
is_active: true,
});
const createdBranch = getEnvelopeData<SiteInformationBranch>(response);
const nextBranch = createdBranch
? mapApiBranchToConfig(createdBranch)
: {
id: createBaseConfigItemId("branch"),
branchName: `Chi nhánh ${config.branches.length + 1}`,
address: "",
hotline: "",
email: "",
fax: "",
mapsEmbedUrl: "",
sortOrder: config.branches.length + 1,
isVisible: true,
};
const nextConfig = cloneBaseConfigData(config);
nextConfig.branches.push(nextBranch);
setConfig(nextConfig);
setCurrentBranchIndex(nextConfig.branches.length - 1);
setCurrentBranchId(nextBranch.id);
toast.success("Đã thêm chi nhánh mới");
} catch (error) {
console.error(error);
toast.error("Không thể thêm chi nhánh");
} finally {
setSavingContact(false);
}
};
const handleDeleteBranchApi = async (branchId: string) => {
if (!config) return;
setSavingContact(true);
try {
await deleteSiteInformationBranchesId(branchId);
const nextConfig = cloneBaseConfigData(config);
nextConfig.branches = nextConfig.branches.filter((branch) => branch.id !== branchId);
setConfig(nextConfig);
setCurrentBranchIndex((previous) =>
Math.max(0, Math.min(previous, Math.max(nextConfig.branches.length - 1, 0))),
);
setCurrentBranchId(null);
toast.success("Đã xóa chi nhánh");
} catch (error) {
console.error(error);
toast.error("Không thể xóa chi nhánh");
} finally {
setSavingContact(false);
}
};
const handleSaveBranchesApi = async () => {
if (!config) return;
setSavingContact(true);
try {
await Promise.all(
sortBaseConfigBranches(config.branches).map((branch, index) =>
patchSiteInformationBranchesId(branch.id, mapConfigBranchToApi(branch, index)),
),
);
setConfig(config);
toast.success("Đã lưu danh sách chi nhánh liên hệ");
} catch (error) {
console.error(error);
toast.error("Không thể lưu danh sách chi nhánh");
} finally {
setSavingContact(false);
}
};
const handleWebsiteInfoChange = (key: "websiteName" | "websiteLink", value: string) => { const handleWebsiteInfoChange = (key: "websiteName" | "websiteLink", value: string) => {
setConfig((previous) => (previous ? { ...previous, [key]: value } : previous)); setConfig((previous) => (previous ? { ...previous, [key]: value } : previous));
}; };
const handleSaveWebsiteInfo = () => { const handleSaveWebsiteInfo = async () => {
if (!config) return; if (!config) return;
saveConfig(config); setSavingWebsiteInfo(true);
toast.success("Đã lưu thông tin website");
try {
const response = await putSiteInformation({
website_name: config.websiteName.trim() || null,
website_link: config.websiteLink.trim() || null,
});
const siteInformation = getEnvelopeData<SiteInformationData>(response);
if (siteInformation) {
setConfig((previous) =>
applySiteInformationToConfig(previous ?? config, siteInformation),
);
} else {
setConfig(config);
}
toast.success("Đã lưu thông tin website");
} catch (error) {
console.error(error);
toast.error("Không thể lưu thông tin website");
} finally {
setSavingWebsiteInfo(false);
}
}; };
const handleSocialChange = <K extends keyof BaseConfigSocialItem>( const handleSocialChange = <K extends keyof BaseConfigSocialItem>(
...@@ -545,6 +866,26 @@ export default function AdminBaseConfigPage() { ...@@ -545,6 +866,26 @@ export default function AdminBaseConfigPage() {
toast.success("Đã lưu cấu hình mạng xã hội"); toast.success("Đã lưu cấu hình mạng xã hội");
}; };
const handleSaveSocialsApi = async () => {
if (!config) return;
setSavingSocials(true);
try {
await Promise.all(
config.socials.map((social) =>
patchSiteInformationSocialsId(social.id, mapConfigSocialToApi(social)),
),
);
setConfig(config);
toast.success("Đã lưu cấu hình mạng xã hội");
} catch (error) {
console.error(error);
toast.error("Không thể lưu cấu hình mạng xã hội");
} finally {
setSavingSocials(false);
}
};
if (!config) { if (!config) {
return ( return (
<div className="rounded-3xl border border-[#063e8e]/10 bg-white p-10 text-center text-gray-500"> <div className="rounded-3xl border border-[#063e8e]/10 bg-white p-10 text-center text-gray-500">
...@@ -698,10 +1039,11 @@ export default function AdminBaseConfigPage() { ...@@ -698,10 +1039,11 @@ export default function AdminBaseConfigPage() {
<Button <Button
type="button" type="button"
onClick={handleSaveWebsiteInfo} onClick={handleSaveWebsiteInfo}
disabled={savingWebsiteInfo}
className="w-full rounded-xl bg-[#163b73] text-white hover:bg-[#163b73]/90" className="w-full rounded-xl bg-[#163b73] text-white hover:bg-[#163b73]/90"
> >
<Save className="mr-2 h-4 w-4" /> <Save className="mr-2 h-4 w-4" />
Lưu thông tin website {savingWebsiteInfo ? "Đang lưu..." : "Lưu thông tin website"}
</Button> </Button>
</div> </div>
) : ( ) : (
...@@ -882,7 +1224,7 @@ export default function AdminBaseConfigPage() { ...@@ -882,7 +1224,7 @@ export default function AdminBaseConfigPage() {
<div className="flex flex-wrap gap-3"> <div className="flex flex-wrap gap-3">
<Button <Button
type="button" type="button"
onClick={handleAddBranch} onClick={handleAddBranchApi}
className="rounded-xl bg-[#063e8e] text-white hover:bg-[#063e8e]/90" className="rounded-xl bg-[#063e8e] text-white hover:bg-[#063e8e]/90"
> >
<Plus className="mr-2 h-4 w-4" /> <Plus className="mr-2 h-4 w-4" />
...@@ -890,7 +1232,7 @@ export default function AdminBaseConfigPage() { ...@@ -890,7 +1232,7 @@ export default function AdminBaseConfigPage() {
</Button> </Button>
<Button <Button
type="button" type="button"
onClick={handleSaveBranches} onClick={handleSaveBranchesApi}
disabled={savingContact} disabled={savingContact}
className="rounded-xl bg-[#163b73] text-white hover:bg-[#163b73]/90" className="rounded-xl bg-[#163b73] text-white hover:bg-[#163b73]/90"
> >
...@@ -907,13 +1249,16 @@ export default function AdminBaseConfigPage() { ...@@ -907,13 +1249,16 @@ export default function AdminBaseConfigPage() {
Danh sách chi nhánh Danh sách chi nhánh
</div> </div>
<div className="space-y-3"> <div className="space-y-3">
{config.branches.map((branch, index) => ( {sortedBranches.map((branch, index) => (
<BranchCard <BranchCard
key={branch.id} key={branch.id}
branch={branch} branch={branch}
current={index === currentBranchIndex} current={currentBranch?.id === branch.id}
onSelect={() => setCurrentBranchIndex(index)} onSelect={() => {
onDelete={() => handleDeleteBranch(branch.id)} setCurrentBranchIndex(index);
setCurrentBranchId(branch.id);
}}
onDelete={() => handleDeleteBranchApi(branch.id)}
/> />
))} ))}
</div> </div>
...@@ -977,6 +1322,33 @@ export default function AdminBaseConfigPage() { ...@@ -977,6 +1322,33 @@ export default function AdminBaseConfigPage() {
/> />
</div> </div>
</div> </div>
<div className="grid gap-5 md:grid-cols-2">
<div className="space-y-2">
<Label className="text-gray-700">Thứ tự hiển thị</Label>
<Input
type="number"
min={1}
value={currentBranch.sortOrder}
onChange={(event) =>
handleBranchChange("sortOrder", Number(event.target.value || 1))
}
className={fieldClassName}
/>
</div>
<div className="flex items-center justify-between rounded-2xl border border-[#063e8e]/10 bg-white px-4 py-3">
<div>
<div className="text-sm font-medium text-[#163b73]">Trạng thái hiển thị</div>
<div className="text-xs text-gray-500">
{currentBranch.isVisible ? "Đang hiển thị" : "Đang ẩn"}
</div>
</div>
<Switch
checked={currentBranch.isVisible}
onCheckedChange={(value) => handleBranchChange("isVisible", value)}
/>
</div>
</div>
</> </>
) : ( ) : (
<div className="rounded-3xl border border-dashed border-[#063e8e]/15 bg-white px-5 py-10 text-center text-sm text-gray-500"> <div className="rounded-3xl border border-dashed border-[#063e8e]/15 bg-white px-5 py-10 text-center text-sm text-gray-500">
...@@ -1001,7 +1373,8 @@ export default function AdminBaseConfigPage() { ...@@ -1001,7 +1373,8 @@ export default function AdminBaseConfigPage() {
<Button <Button
type="button" type="button"
onClick={handleSaveSocials} onClick={handleSaveSocialsApi}
disabled={savingSocials}
className="rounded-xl bg-[#163b73] text-white hover:bg-[#163b73]/90" className="rounded-xl bg-[#163b73] text-white hover:bg-[#163b73]/90"
> >
<Save className="mr-2 h-4 w-4" /> <Save className="mr-2 h-4 w-4" />
......
...@@ -29,6 +29,8 @@ export interface BaseConfigBranchItem { ...@@ -29,6 +29,8 @@ export interface BaseConfigBranchItem {
email: string; email: string;
fax: string; fax: string;
mapsEmbedUrl: string; mapsEmbedUrl: string;
sortOrder: number;
isVisible: boolean;
} }
export interface BaseConfigSocialItem { export interface BaseConfigSocialItem {
...@@ -56,6 +58,8 @@ export const EMPTY_BASE_CONFIG_BRANCH: BaseConfigBranchItem = { ...@@ -56,6 +58,8 @@ export const EMPTY_BASE_CONFIG_BRANCH: BaseConfigBranchItem = {
email: "", email: "",
fax: "", fax: "",
mapsEmbedUrl: "", mapsEmbedUrl: "",
sortOrder: 1,
isVisible: true,
}; };
export const BASE_CONFIG_SOCIAL_SEED: BaseConfigSocialItem[] = [ export const BASE_CONFIG_SOCIAL_SEED: BaseConfigSocialItem[] = [
...@@ -147,6 +151,8 @@ const BASE_CONFIG_SEED: BaseConfigData = { ...@@ -147,6 +151,8 @@ const BASE_CONFIG_SEED: BaseConfigData = {
email: "info@vccinews.vn", email: "info@vccinews.vn",
fax: "028 3932 5789", fax: "028 3932 5789",
mapsEmbedUrl: "https://maps.google.com/?q=171+Vo+Thi+Sau+Quan+3+TPHCM", mapsEmbedUrl: "https://maps.google.com/?q=171+Vo+Thi+Sau+Quan+3+TPHCM",
sortOrder: 1,
isVisible: true,
}, },
{ {
id: "base-branch-002", id: "base-branch-002",
...@@ -156,6 +162,8 @@ const BASE_CONFIG_SEED: BaseConfigData = { ...@@ -156,6 +162,8 @@ const BASE_CONFIG_SEED: BaseConfigData = {
email: "hanoi@vccinews.vn", email: "hanoi@vccinews.vn",
fax: "024 3574 2020", fax: "024 3574 2020",
mapsEmbedUrl: "https://maps.google.com/?q=9+Dao+Duy+Anh+Dong+Da+Ha+Noi", mapsEmbedUrl: "https://maps.google.com/?q=9+Dao+Duy+Anh+Dong+Da+Ha+Noi",
sortOrder: 2,
isVisible: true,
}, },
], ],
}; };
...@@ -201,6 +209,8 @@ export function readBaseConfig(): BaseConfigData { ...@@ -201,6 +209,8 @@ export function readBaseConfig(): BaseConfigData {
email: parsed.contactInfo.email || "", email: parsed.contactInfo.email || "",
fax: parsed.contactInfo.fax || "", fax: parsed.contactInfo.fax || "",
mapsEmbedUrl: parsed.contactInfo.mapsEmbedUrl || "", mapsEmbedUrl: parsed.contactInfo.mapsEmbedUrl || "",
sortOrder: 1,
isVisible: true,
}, },
] ]
: BASE_CONFIG_SEED.branches; : BASE_CONFIG_SEED.branches;
...@@ -253,13 +263,21 @@ export function readBaseConfig(): BaseConfigData { ...@@ -253,13 +263,21 @@ export function readBaseConfig(): BaseConfigData {
}) })
: BASE_CONFIG_SOCIAL_SEED.map((item) => ({ ...item })), : BASE_CONFIG_SOCIAL_SEED.map((item) => ({ ...item })),
branches: Array.isArray(parsed.branches) branches: Array.isArray(parsed.branches)
? parsed.branches.map((item) => ({ ? parsed.branches.map((item, index) => ({
...EMPTY_BASE_CONFIG_BRANCH, ...EMPTY_BASE_CONFIG_BRANCH,
...item, ...item,
fax: fax:
typeof (item as BaseConfigBranchItem & { fax?: string }).fax === "string" typeof (item as BaseConfigBranchItem & { fax?: string }).fax === "string"
? (item as BaseConfigBranchItem & { fax?: string }).fax ?? "" ? (item as BaseConfigBranchItem & { fax?: string }).fax ?? ""
: "", : "",
sortOrder:
typeof (item as BaseConfigBranchItem & { sortOrder?: number }).sortOrder === "number"
? (item as BaseConfigBranchItem & { sortOrder?: number }).sortOrder ?? index + 1
: index + 1,
isVisible:
typeof (item as BaseConfigBranchItem & { isVisible?: boolean }).isVisible === "boolean"
? (item as BaseConfigBranchItem & { isVisible?: boolean }).isVisible
: true,
})) }))
: fallbackBranchFromLegacyContact, : fallbackBranchFromLegacyContact,
}; };
...@@ -291,3 +309,10 @@ export function sortBaseConfigSocials(items: BaseConfigSocialItem[]) { ...@@ -291,3 +309,10 @@ export function sortBaseConfigSocials(items: BaseConfigSocialItem[]) {
return first.label.localeCompare(second.label, "vi"); return first.label.localeCompare(second.label, "vi");
}); });
} }
export function sortBaseConfigBranches(items: BaseConfigBranchItem[]) {
return [...items].sort((first, second) => {
if (first.sortOrder !== second.sortOrder) return first.sortOrder - second.sortOrder;
return first.branchName.localeCompare(second.branchName, "vi");
});
}
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