- orval 실제 타입(ItemData/SupplierData/QuotationData/QuotationSettingData) 사용, 응답 봉투 과중첩(.data.data) 제거 → 목록 정상 렌더 - 배송형태(delivery_type) 자유텍스트 → 서버 /v1/enums 코드 select 로 전환 - orval 클라이언트 재생성 (enums 훅, companyData 등) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
409 lines
10 KiB
TypeScript
409 lines
10 KiB
TypeScript
/**
|
|
* Generated by orval v7.21.0 🍺
|
|
* Do not edit manually.
|
|
* Negodata Api Server
|
|
* OpenAPI spec version: 0.1.0
|
|
*/
|
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
import type {
|
|
DataTag,
|
|
DefinedInitialDataOptions,
|
|
DefinedUseQueryResult,
|
|
MutationFunction,
|
|
QueryClient,
|
|
QueryFunction,
|
|
QueryKey,
|
|
UndefinedInitialDataOptions,
|
|
UseMutationOptions,
|
|
UseMutationResult,
|
|
UseQueryOptions,
|
|
UseQueryResult,
|
|
} from "@tanstack/react-query";
|
|
|
|
import type {
|
|
HTTPValidationError,
|
|
ReqCreateQuotationSetting,
|
|
ReqUpdateQuotationSetting,
|
|
ResDeleteQuotationSetting,
|
|
ResQuotationSetting,
|
|
ResQuotationSettingList,
|
|
} from ".././model";
|
|
|
|
import { customFetch } from "../../mutator/custom-fetch";
|
|
|
|
/**
|
|
* @summary 견적 설정 목록
|
|
*/
|
|
export const listSettings = (signal?: AbortSignal) => {
|
|
return customFetch<ResQuotationSettingList>({
|
|
url: `/v1/quotation-setting/list`,
|
|
method: "GET",
|
|
signal,
|
|
});
|
|
};
|
|
|
|
export const getListSettingsQueryKey = () => {
|
|
return [`/v1/quotation-setting/list`] as const;
|
|
};
|
|
|
|
export const getListSettingsQueryOptions = <
|
|
TData = Awaited<ReturnType<typeof listSettings>>,
|
|
TError = void,
|
|
>(options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
|
>;
|
|
}) => {
|
|
const { query: queryOptions } = options ?? {};
|
|
|
|
const queryKey = queryOptions?.queryKey ?? getListSettingsQueryKey();
|
|
|
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof listSettings>>> = ({
|
|
signal,
|
|
}) => listSettings(signal);
|
|
|
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
|
Awaited<ReturnType<typeof listSettings>>,
|
|
TError,
|
|
TData
|
|
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
};
|
|
|
|
export type ListSettingsQueryResult = NonNullable<
|
|
Awaited<ReturnType<typeof listSettings>>
|
|
>;
|
|
export type ListSettingsQueryError = void;
|
|
|
|
export function useListSettings<
|
|
TData = Awaited<ReturnType<typeof listSettings>>,
|
|
TError = void,
|
|
>(
|
|
options: {
|
|
query: Partial<
|
|
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
|
> &
|
|
Pick<
|
|
DefinedInitialDataOptions<
|
|
Awaited<ReturnType<typeof listSettings>>,
|
|
TError,
|
|
Awaited<ReturnType<typeof listSettings>>
|
|
>,
|
|
"initialData"
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): DefinedUseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
};
|
|
export function useListSettings<
|
|
TData = Awaited<ReturnType<typeof listSettings>>,
|
|
TError = void,
|
|
>(
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
|
> &
|
|
Pick<
|
|
UndefinedInitialDataOptions<
|
|
Awaited<ReturnType<typeof listSettings>>,
|
|
TError,
|
|
Awaited<ReturnType<typeof listSettings>>
|
|
>,
|
|
"initialData"
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
};
|
|
export function useListSettings<
|
|
TData = Awaited<ReturnType<typeof listSettings>>,
|
|
TError = void,
|
|
>(
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
};
|
|
/**
|
|
* @summary 견적 설정 목록
|
|
*/
|
|
|
|
export function useListSettings<
|
|
TData = Awaited<ReturnType<typeof listSettings>>,
|
|
TError = void,
|
|
>(
|
|
options?: {
|
|
query?: Partial<
|
|
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseQueryResult<TData, TError> & {
|
|
queryKey: DataTag<QueryKey, TData, TError>;
|
|
} {
|
|
const queryOptions = getListSettingsQueryOptions(options);
|
|
|
|
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
|
TData,
|
|
TError
|
|
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
|
|
query.queryKey = queryOptions.queryKey;
|
|
|
|
return query;
|
|
}
|
|
|
|
/**
|
|
* @summary 견적 설정 등록
|
|
*/
|
|
export const createSetting = (
|
|
reqCreateQuotationSetting: ReqCreateQuotationSetting,
|
|
signal?: AbortSignal,
|
|
) => {
|
|
return customFetch<ResQuotationSetting>({
|
|
url: `/v1/quotation-setting/create`,
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
data: reqCreateQuotationSetting,
|
|
signal,
|
|
});
|
|
};
|
|
|
|
export const getCreateSettingMutationOptions = <
|
|
TError = void | HTTPValidationError,
|
|
TContext = unknown,
|
|
>(options?: {
|
|
mutation?: UseMutationOptions<
|
|
Awaited<ReturnType<typeof createSetting>>,
|
|
TError,
|
|
{ data: ReqCreateQuotationSetting },
|
|
TContext
|
|
>;
|
|
}): UseMutationOptions<
|
|
Awaited<ReturnType<typeof createSetting>>,
|
|
TError,
|
|
{ data: ReqCreateQuotationSetting },
|
|
TContext
|
|
> => {
|
|
const mutationKey = ["createSetting"];
|
|
const { mutation: mutationOptions } = options
|
|
? options.mutation &&
|
|
"mutationKey" in options.mutation &&
|
|
options.mutation.mutationKey
|
|
? options
|
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
: { mutation: { mutationKey } };
|
|
|
|
const mutationFn: MutationFunction<
|
|
Awaited<ReturnType<typeof createSetting>>,
|
|
{ data: ReqCreateQuotationSetting }
|
|
> = (props) => {
|
|
const { data } = props ?? {};
|
|
|
|
return createSetting(data);
|
|
};
|
|
|
|
return { mutationFn, ...mutationOptions };
|
|
};
|
|
|
|
export type CreateSettingMutationResult = NonNullable<
|
|
Awaited<ReturnType<typeof createSetting>>
|
|
>;
|
|
export type CreateSettingMutationBody = ReqCreateQuotationSetting;
|
|
export type CreateSettingMutationError = void | HTTPValidationError;
|
|
|
|
/**
|
|
* @summary 견적 설정 등록
|
|
*/
|
|
export const useCreateSetting = <
|
|
TError = void | HTTPValidationError,
|
|
TContext = unknown,
|
|
>(
|
|
options?: {
|
|
mutation?: UseMutationOptions<
|
|
Awaited<ReturnType<typeof createSetting>>,
|
|
TError,
|
|
{ data: ReqCreateQuotationSetting },
|
|
TContext
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseMutationResult<
|
|
Awaited<ReturnType<typeof createSetting>>,
|
|
TError,
|
|
{ data: ReqCreateQuotationSetting },
|
|
TContext
|
|
> => {
|
|
const mutationOptions = getCreateSettingMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
};
|
|
/**
|
|
* @summary 견적 설정 수정
|
|
*/
|
|
export const updateSetting = (
|
|
qtSettingId: string,
|
|
reqUpdateQuotationSetting: ReqUpdateQuotationSetting,
|
|
) => {
|
|
return customFetch<ResQuotationSetting>({
|
|
url: `/v1/quotation-setting/update/${qtSettingId}`,
|
|
method: "PATCH",
|
|
headers: { "Content-Type": "application/json" },
|
|
data: reqUpdateQuotationSetting,
|
|
});
|
|
};
|
|
|
|
export const getUpdateSettingMutationOptions = <
|
|
TError = void | HTTPValidationError,
|
|
TContext = unknown,
|
|
>(options?: {
|
|
mutation?: UseMutationOptions<
|
|
Awaited<ReturnType<typeof updateSetting>>,
|
|
TError,
|
|
{ qtSettingId: string; data: ReqUpdateQuotationSetting },
|
|
TContext
|
|
>;
|
|
}): UseMutationOptions<
|
|
Awaited<ReturnType<typeof updateSetting>>,
|
|
TError,
|
|
{ qtSettingId: string; data: ReqUpdateQuotationSetting },
|
|
TContext
|
|
> => {
|
|
const mutationKey = ["updateSetting"];
|
|
const { mutation: mutationOptions } = options
|
|
? options.mutation &&
|
|
"mutationKey" in options.mutation &&
|
|
options.mutation.mutationKey
|
|
? options
|
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
: { mutation: { mutationKey } };
|
|
|
|
const mutationFn: MutationFunction<
|
|
Awaited<ReturnType<typeof updateSetting>>,
|
|
{ qtSettingId: string; data: ReqUpdateQuotationSetting }
|
|
> = (props) => {
|
|
const { qtSettingId, data } = props ?? {};
|
|
|
|
return updateSetting(qtSettingId, data);
|
|
};
|
|
|
|
return { mutationFn, ...mutationOptions };
|
|
};
|
|
|
|
export type UpdateSettingMutationResult = NonNullable<
|
|
Awaited<ReturnType<typeof updateSetting>>
|
|
>;
|
|
export type UpdateSettingMutationBody = ReqUpdateQuotationSetting;
|
|
export type UpdateSettingMutationError = void | HTTPValidationError;
|
|
|
|
/**
|
|
* @summary 견적 설정 수정
|
|
*/
|
|
export const useUpdateSetting = <
|
|
TError = void | HTTPValidationError,
|
|
TContext = unknown,
|
|
>(
|
|
options?: {
|
|
mutation?: UseMutationOptions<
|
|
Awaited<ReturnType<typeof updateSetting>>,
|
|
TError,
|
|
{ qtSettingId: string; data: ReqUpdateQuotationSetting },
|
|
TContext
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseMutationResult<
|
|
Awaited<ReturnType<typeof updateSetting>>,
|
|
TError,
|
|
{ qtSettingId: string; data: ReqUpdateQuotationSetting },
|
|
TContext
|
|
> => {
|
|
const mutationOptions = getUpdateSettingMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
};
|
|
/**
|
|
* @summary 견적 설정 삭제
|
|
*/
|
|
export const deleteSetting = (qtSettingId: string) => {
|
|
return customFetch<ResDeleteQuotationSetting>({
|
|
url: `/v1/quotation-setting/delete/${qtSettingId}`,
|
|
method: "DELETE",
|
|
});
|
|
};
|
|
|
|
export const getDeleteSettingMutationOptions = <
|
|
TError = void | HTTPValidationError,
|
|
TContext = unknown,
|
|
>(options?: {
|
|
mutation?: UseMutationOptions<
|
|
Awaited<ReturnType<typeof deleteSetting>>,
|
|
TError,
|
|
{ qtSettingId: string },
|
|
TContext
|
|
>;
|
|
}): UseMutationOptions<
|
|
Awaited<ReturnType<typeof deleteSetting>>,
|
|
TError,
|
|
{ qtSettingId: string },
|
|
TContext
|
|
> => {
|
|
const mutationKey = ["deleteSetting"];
|
|
const { mutation: mutationOptions } = options
|
|
? options.mutation &&
|
|
"mutationKey" in options.mutation &&
|
|
options.mutation.mutationKey
|
|
? options
|
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
: { mutation: { mutationKey } };
|
|
|
|
const mutationFn: MutationFunction<
|
|
Awaited<ReturnType<typeof deleteSetting>>,
|
|
{ qtSettingId: string }
|
|
> = (props) => {
|
|
const { qtSettingId } = props ?? {};
|
|
|
|
return deleteSetting(qtSettingId);
|
|
};
|
|
|
|
return { mutationFn, ...mutationOptions };
|
|
};
|
|
|
|
export type DeleteSettingMutationResult = NonNullable<
|
|
Awaited<ReturnType<typeof deleteSetting>>
|
|
>;
|
|
|
|
export type DeleteSettingMutationError = void | HTTPValidationError;
|
|
|
|
/**
|
|
* @summary 견적 설정 삭제
|
|
*/
|
|
export const useDeleteSetting = <
|
|
TError = void | HTTPValidationError,
|
|
TContext = unknown,
|
|
>(
|
|
options?: {
|
|
mutation?: UseMutationOptions<
|
|
Awaited<ReturnType<typeof deleteSetting>>,
|
|
TError,
|
|
{ qtSettingId: string },
|
|
TContext
|
|
>;
|
|
},
|
|
queryClient?: QueryClient,
|
|
): UseMutationResult<
|
|
Awaited<ReturnType<typeof deleteSetting>>,
|
|
TError,
|
|
{ qtSettingId: string },
|
|
TContext
|
|
> => {
|
|
const mutationOptions = getDeleteSettingMutationOptions(options);
|
|
|
|
return useMutation(mutationOptions, queryClient);
|
|
};
|