[fix] negodata/front: 상품·협력사·견적 목록 연동 + 배송형태 서버 enum 코드 전송
- 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>
This commit is contained in:
parent
1f778ab975
commit
2470183e0f
@ -32,27 +32,18 @@ import type {
|
|||||||
|
|
||||||
import { customFetch } from "../../mutator/custom-fetch";
|
import { customFetch } from "../../mutator/custom-fetch";
|
||||||
|
|
||||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* id/pw 로 로그인하고 JWT 토큰을 발급한다.
|
* id/pw 로 로그인하고 JWT 토큰을 발급한다.
|
||||||
* @summary 로그인
|
* @summary 로그인
|
||||||
*/
|
*/
|
||||||
export const login = (
|
export const login = (reqLogin: ReqLogin, signal?: AbortSignal) => {
|
||||||
reqLogin: ReqLogin,
|
return customFetch<ResLogin>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/auth/login`,
|
||||||
signal?: AbortSignal,
|
method: "POST",
|
||||||
) => {
|
headers: { "Content-Type": "application/json" },
|
||||||
return customFetch<ResLogin>(
|
data: reqLogin,
|
||||||
{
|
signal,
|
||||||
url: `/v1/auth/login`,
|
});
|
||||||
method: "POST",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
data: reqLogin,
|
|
||||||
signal,
|
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getLoginMutationOptions = <
|
export const getLoginMutationOptions = <
|
||||||
@ -65,7 +56,6 @@ export const getLoginMutationOptions = <
|
|||||||
{ data: ReqLogin },
|
{ data: ReqLogin },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof login>>,
|
Awaited<ReturnType<typeof login>>,
|
||||||
TError,
|
TError,
|
||||||
@ -73,13 +63,13 @@ export const getLoginMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["login"];
|
const mutationKey = ["login"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof login>>,
|
Awaited<ReturnType<typeof login>>,
|
||||||
@ -87,7 +77,7 @@ export const getLoginMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
return login(data, requestOptions);
|
return login(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -113,7 +103,6 @@ export const useLogin = <
|
|||||||
{ data: ReqLogin },
|
{ data: ReqLogin },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -127,24 +116,20 @@ export const useLogin = <
|
|||||||
return useMutation(mutationOptions, queryClient);
|
return useMutation(mutationOptions, queryClient);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* company_id 하위로 유저를 생성한다(시드/관리자용).
|
* 새 계정을 생성한다.
|
||||||
* @summary 계정 생성
|
* @summary 계정 생성
|
||||||
*/
|
*/
|
||||||
export const createAccount = (
|
export const createAccount = (
|
||||||
reqCreateAccount: ReqCreateAccount,
|
reqCreateAccount: ReqCreateAccount,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return customFetch<ResCreateAccount>(
|
return customFetch<ResCreateAccount>({
|
||||||
{
|
url: `/v1/auth/create`,
|
||||||
url: `/v1/auth/create`,
|
method: "POST",
|
||||||
method: "POST",
|
headers: { "Content-Type": "application/json" },
|
||||||
headers: { "Content-Type": "application/json" },
|
data: reqCreateAccount,
|
||||||
data: reqCreateAccount,
|
signal,
|
||||||
signal,
|
});
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateAccountMutationOptions = <
|
export const getCreateAccountMutationOptions = <
|
||||||
@ -157,7 +142,6 @@ export const getCreateAccountMutationOptions = <
|
|||||||
{ data: ReqCreateAccount },
|
{ data: ReqCreateAccount },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createAccount>>,
|
Awaited<ReturnType<typeof createAccount>>,
|
||||||
TError,
|
TError,
|
||||||
@ -165,13 +149,13 @@ export const getCreateAccountMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["createAccount"];
|
const mutationKey = ["createAccount"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createAccount>>,
|
Awaited<ReturnType<typeof createAccount>>,
|
||||||
@ -179,7 +163,7 @@ export const getCreateAccountMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
return createAccount(data, requestOptions);
|
return createAccount(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -205,7 +189,6 @@ export const useCreateAccount = <
|
|||||||
{ data: ReqCreateAccount },
|
{ data: ReqCreateAccount },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -222,14 +205,12 @@ export const useCreateAccount = <
|
|||||||
* refresh 토큰으로 access 토큰을 재발급한다.
|
* refresh 토큰으로 access 토큰을 재발급한다.
|
||||||
* @summary 액세스 토큰 갱신
|
* @summary 액세스 토큰 갱신
|
||||||
*/
|
*/
|
||||||
export const refreshToken = (
|
export const refreshToken = (signal?: AbortSignal) => {
|
||||||
options?: SecondParameter<typeof customFetch>,
|
return customFetch<ResRefreshToken>({
|
||||||
signal?: AbortSignal,
|
url: `/v1/auth/refresh_token`,
|
||||||
) => {
|
method: "POST",
|
||||||
return customFetch<ResRefreshToken>(
|
signal,
|
||||||
{ url: `/v1/auth/refresh_token`, method: "POST", signal },
|
});
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getRefreshTokenMutationOptions = <
|
export const getRefreshTokenMutationOptions = <
|
||||||
@ -242,7 +223,6 @@ export const getRefreshTokenMutationOptions = <
|
|||||||
void,
|
void,
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof refreshToken>>,
|
Awaited<ReturnType<typeof refreshToken>>,
|
||||||
TError,
|
TError,
|
||||||
@ -250,19 +230,19 @@ export const getRefreshTokenMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["refreshToken"];
|
const mutationKey = ["refreshToken"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof refreshToken>>,
|
Awaited<ReturnType<typeof refreshToken>>,
|
||||||
void
|
void
|
||||||
> = () => {
|
> = () => {
|
||||||
return refreshToken(requestOptions);
|
return refreshToken();
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -285,7 +265,6 @@ export const useRefreshToken = <TError = void, TContext = unknown>(
|
|||||||
void,
|
void,
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -299,17 +278,11 @@ export const useRefreshToken = <TError = void, TContext = unknown>(
|
|||||||
return useMutation(mutationOptions, queryClient);
|
return useMutation(mutationOptions, queryClient);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* 유효한 access 토큰이 있어야 호출 가능. 토큰의 유저+소속사 정보를 반환한다.
|
* 유효한 access 토큰이 있어야 호출 가능. 토큰의 유저+회사 정보를 반환한다.
|
||||||
* @summary 내 정보
|
* @summary 내 정보
|
||||||
*/
|
*/
|
||||||
export const me = (
|
export const me = (signal?: AbortSignal) => {
|
||||||
options?: SecondParameter<typeof customFetch>,
|
return customFetch<ResMe>({ url: `/v1/auth/me`, method: "GET", signal });
|
||||||
signal?: AbortSignal,
|
|
||||||
) => {
|
|
||||||
return customFetch<ResMe>(
|
|
||||||
{ url: `/v1/auth/me`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMeQueryKey = () => {
|
export const getMeQueryKey = () => {
|
||||||
@ -323,14 +296,13 @@ export const getMeQueryOptions = <
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof me>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof me>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}) => {
|
}) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getMeQueryKey();
|
const queryKey = queryOptions?.queryKey ?? getMeQueryKey();
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof me>>> = ({ signal }) =>
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof me>>> = ({ signal }) =>
|
||||||
me(requestOptions, signal);
|
me(signal);
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof me>>,
|
Awaited<ReturnType<typeof me>>,
|
||||||
@ -355,7 +327,6 @@ export function useMe<TData = Awaited<ReturnType<typeof me>>, TError = void>(
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -374,7 +345,6 @@ export function useMe<TData = Awaited<ReturnType<typeof me>>, TError = void>(
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -385,7 +355,6 @@ export function useMe<TData = Awaited<ReturnType<typeof me>>, TError = void>(
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof me>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof me>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -400,7 +369,6 @@ export function useMe<TData = Awaited<ReturnType<typeof me>>, TError = void>(
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof me>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof me>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
|
|||||||
@ -19,19 +19,11 @@ import type {
|
|||||||
|
|
||||||
import { customFetch } from "../../mutator/custom-fetch";
|
import { customFetch } from "../../mutator/custom-fetch";
|
||||||
|
|
||||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Healthz
|
* @summary Healthz
|
||||||
*/
|
*/
|
||||||
export const healthzHealthzGet = (
|
export const healthzHealthzGet = (signal?: AbortSignal) => {
|
||||||
options?: SecondParameter<typeof customFetch>,
|
return customFetch<unknown>({ url: `/healthz`, method: "GET", signal });
|
||||||
signal?: AbortSignal,
|
|
||||||
) => {
|
|
||||||
return customFetch<unknown>(
|
|
||||||
{ url: `/healthz`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getHealthzHealthzGetQueryKey = () => {
|
export const getHealthzHealthzGetQueryKey = () => {
|
||||||
@ -49,15 +41,14 @@ export const getHealthzHealthzGetQueryOptions = <
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}) => {
|
}) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getHealthzHealthzGetQueryKey();
|
const queryKey = queryOptions?.queryKey ?? getHealthzHealthzGetQueryKey();
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
const queryFn: QueryFunction<
|
||||||
Awaited<ReturnType<typeof healthzHealthzGet>>
|
Awaited<ReturnType<typeof healthzHealthzGet>>
|
||||||
> = ({ signal }) => healthzHealthzGet(requestOptions, signal);
|
> = ({ signal }) => healthzHealthzGet(signal);
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof healthzHealthzGet>>,
|
Awaited<ReturnType<typeof healthzHealthzGet>>,
|
||||||
@ -91,7 +82,6 @@ export function useHealthzHealthzGet<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -117,7 +107,6 @@ export function useHealthzHealthzGet<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -135,7 +124,6 @@ export function useHealthzHealthzGet<
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -157,7 +145,6 @@ export function useHealthzHealthzGet<
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
|
|||||||
145
negodata/front/src/api/generated/enums/enums.ts
Normal file
145
negodata/front/src/api/generated/enums/enums.ts
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.21.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* Negodata Api Server
|
||||||
|
* OpenAPI spec version: 0.1.0
|
||||||
|
*/
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import type {
|
||||||
|
DataTag,
|
||||||
|
DefinedInitialDataOptions,
|
||||||
|
DefinedUseQueryResult,
|
||||||
|
QueryClient,
|
||||||
|
QueryFunction,
|
||||||
|
QueryKey,
|
||||||
|
UndefinedInitialDataOptions,
|
||||||
|
UseQueryOptions,
|
||||||
|
UseQueryResult,
|
||||||
|
} from "@tanstack/react-query";
|
||||||
|
|
||||||
|
import type { ResEnums } from ".././model";
|
||||||
|
|
||||||
|
import { customFetch } from "../../mutator/custom-fetch";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary 도메인 코드 enum 전체
|
||||||
|
*/
|
||||||
|
export const listEnums = (signal?: AbortSignal) => {
|
||||||
|
return customFetch<ResEnums>({ url: `/v1/enums`, method: "GET", signal });
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getListEnumsQueryKey = () => {
|
||||||
|
return [`/v1/enums`] as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getListEnumsQueryOptions = <
|
||||||
|
TData = Awaited<ReturnType<typeof listEnums>>,
|
||||||
|
TError = void,
|
||||||
|
>(options?: {
|
||||||
|
query?: Partial<
|
||||||
|
UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData>
|
||||||
|
>;
|
||||||
|
}) => {
|
||||||
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
|
const queryKey = queryOptions?.queryKey ?? getListEnumsQueryKey();
|
||||||
|
|
||||||
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof listEnums>>> = ({
|
||||||
|
signal,
|
||||||
|
}) => listEnums(signal);
|
||||||
|
|
||||||
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
|
Awaited<ReturnType<typeof listEnums>>,
|
||||||
|
TError,
|
||||||
|
TData
|
||||||
|
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ListEnumsQueryResult = NonNullable<
|
||||||
|
Awaited<ReturnType<typeof listEnums>>
|
||||||
|
>;
|
||||||
|
export type ListEnumsQueryError = void;
|
||||||
|
|
||||||
|
export function useListEnums<
|
||||||
|
TData = Awaited<ReturnType<typeof listEnums>>,
|
||||||
|
TError = void,
|
||||||
|
>(
|
||||||
|
options: {
|
||||||
|
query: Partial<
|
||||||
|
UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData>
|
||||||
|
> &
|
||||||
|
Pick<
|
||||||
|
DefinedInitialDataOptions<
|
||||||
|
Awaited<ReturnType<typeof listEnums>>,
|
||||||
|
TError,
|
||||||
|
Awaited<ReturnType<typeof listEnums>>
|
||||||
|
>,
|
||||||
|
"initialData"
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
queryClient?: QueryClient,
|
||||||
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
|
queryKey: DataTag<QueryKey, TData, TError>;
|
||||||
|
};
|
||||||
|
export function useListEnums<
|
||||||
|
TData = Awaited<ReturnType<typeof listEnums>>,
|
||||||
|
TError = void,
|
||||||
|
>(
|
||||||
|
options?: {
|
||||||
|
query?: Partial<
|
||||||
|
UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData>
|
||||||
|
> &
|
||||||
|
Pick<
|
||||||
|
UndefinedInitialDataOptions<
|
||||||
|
Awaited<ReturnType<typeof listEnums>>,
|
||||||
|
TError,
|
||||||
|
Awaited<ReturnType<typeof listEnums>>
|
||||||
|
>,
|
||||||
|
"initialData"
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
queryClient?: QueryClient,
|
||||||
|
): UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: DataTag<QueryKey, TData, TError>;
|
||||||
|
};
|
||||||
|
export function useListEnums<
|
||||||
|
TData = Awaited<ReturnType<typeof listEnums>>,
|
||||||
|
TError = void,
|
||||||
|
>(
|
||||||
|
options?: {
|
||||||
|
query?: Partial<
|
||||||
|
UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData>
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
queryClient?: QueryClient,
|
||||||
|
): UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: DataTag<QueryKey, TData, TError>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* @summary 도메인 코드 enum 전체
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function useListEnums<
|
||||||
|
TData = Awaited<ReturnType<typeof listEnums>>,
|
||||||
|
TError = void,
|
||||||
|
>(
|
||||||
|
options?: {
|
||||||
|
query?: Partial<
|
||||||
|
UseQueryOptions<Awaited<ReturnType<typeof listEnums>>, TError, TData>
|
||||||
|
>;
|
||||||
|
},
|
||||||
|
queryClient?: QueryClient,
|
||||||
|
): UseQueryResult<TData, TError> & {
|
||||||
|
queryKey: DataTag<QueryKey, TData, TError>;
|
||||||
|
} {
|
||||||
|
const queryOptions = getListEnumsQueryOptions(options);
|
||||||
|
|
||||||
|
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||||
|
TData,
|
||||||
|
TError
|
||||||
|
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||||
|
|
||||||
|
query.queryKey = queryOptions.queryKey;
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
@ -36,20 +36,16 @@ import type {
|
|||||||
|
|
||||||
import { customFetch } from "../../mutator/custom-fetch";
|
import { customFetch } from "../../mutator/custom-fetch";
|
||||||
|
|
||||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary 상품 목록
|
* @summary 상품 목록
|
||||||
*/
|
*/
|
||||||
export const listItems = (
|
export const listItems = (params?: ListItemsParams, signal?: AbortSignal) => {
|
||||||
params?: ListItemsParams,
|
return customFetch<ResItemList>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/item/list`,
|
||||||
signal?: AbortSignal,
|
method: "GET",
|
||||||
) => {
|
params,
|
||||||
return customFetch<ResItemList>(
|
signal,
|
||||||
{ url: `/v1/item/list`, method: "GET", params, signal },
|
});
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListItemsQueryKey = (params?: ListItemsParams) => {
|
export const getListItemsQueryKey = (params?: ListItemsParams) => {
|
||||||
@ -65,16 +61,15 @@ export const getListItemsQueryOptions = <
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listItems>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listItems>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getListItemsQueryKey(params);
|
const queryKey = queryOptions?.queryKey ?? getListItemsQueryKey(params);
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof listItems>>> = ({
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof listItems>>> = ({
|
||||||
signal,
|
signal,
|
||||||
}) => listItems(params, requestOptions, signal);
|
}) => listItems(params, signal);
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listItems>>,
|
Awaited<ReturnType<typeof listItems>>,
|
||||||
@ -105,7 +100,6 @@ export function useListItems<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -128,7 +122,6 @@ export function useListItems<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -143,7 +136,6 @@ export function useListItems<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listItems>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listItems>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -162,7 +154,6 @@ export function useListItems<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listItems>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listItems>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -185,19 +176,15 @@ export function useListItems<
|
|||||||
*/
|
*/
|
||||||
export const createItem = (
|
export const createItem = (
|
||||||
reqCreateItem: ReqCreateItem,
|
reqCreateItem: ReqCreateItem,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return customFetch<ResItem>(
|
return customFetch<ResItem>({
|
||||||
{
|
url: `/v1/item/create`,
|
||||||
url: `/v1/item/create`,
|
method: "POST",
|
||||||
method: "POST",
|
headers: { "Content-Type": "application/json" },
|
||||||
headers: { "Content-Type": "application/json" },
|
data: reqCreateItem,
|
||||||
data: reqCreateItem,
|
signal,
|
||||||
signal,
|
});
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateItemMutationOptions = <
|
export const getCreateItemMutationOptions = <
|
||||||
@ -210,7 +197,6 @@ export const getCreateItemMutationOptions = <
|
|||||||
{ data: ReqCreateItem },
|
{ data: ReqCreateItem },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createItem>>,
|
Awaited<ReturnType<typeof createItem>>,
|
||||||
TError,
|
TError,
|
||||||
@ -218,13 +204,13 @@ export const getCreateItemMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["createItem"];
|
const mutationKey = ["createItem"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createItem>>,
|
Awaited<ReturnType<typeof createItem>>,
|
||||||
@ -232,7 +218,7 @@ export const getCreateItemMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
return createItem(data, requestOptions);
|
return createItem(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -258,7 +244,6 @@ export const useCreateItem = <
|
|||||||
{ data: ReqCreateItem },
|
{ data: ReqCreateItem },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -276,22 +261,18 @@ export const useCreateItem = <
|
|||||||
*/
|
*/
|
||||||
export const uploadItemsExcel = (
|
export const uploadItemsExcel = (
|
||||||
bodyUploadItemsExcelV1ItemUploadExcelPost: BodyUploadItemsExcelV1ItemUploadExcelPost,
|
bodyUploadItemsExcelV1ItemUploadExcelPost: BodyUploadItemsExcelV1ItemUploadExcelPost,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append(`file`, bodyUploadItemsExcelV1ItemUploadExcelPost.file);
|
formData.append(`file`, bodyUploadItemsExcelV1ItemUploadExcelPost.file);
|
||||||
|
|
||||||
return customFetch<ResExcelUpload>(
|
return customFetch<ResExcelUpload>({
|
||||||
{
|
url: `/v1/item/upload-excel`,
|
||||||
url: `/v1/item/upload-excel`,
|
method: "POST",
|
||||||
method: "POST",
|
headers: { "Content-Type": "multipart/form-data" },
|
||||||
headers: { "Content-Type": "multipart/form-data" },
|
data: formData,
|
||||||
data: formData,
|
signal,
|
||||||
signal,
|
});
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getUploadItemsExcelMutationOptions = <
|
export const getUploadItemsExcelMutationOptions = <
|
||||||
@ -304,7 +285,6 @@ export const getUploadItemsExcelMutationOptions = <
|
|||||||
{ data: BodyUploadItemsExcelV1ItemUploadExcelPost },
|
{ data: BodyUploadItemsExcelV1ItemUploadExcelPost },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof uploadItemsExcel>>,
|
Awaited<ReturnType<typeof uploadItemsExcel>>,
|
||||||
TError,
|
TError,
|
||||||
@ -312,13 +292,13 @@ export const getUploadItemsExcelMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["uploadItemsExcel"];
|
const mutationKey = ["uploadItemsExcel"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof uploadItemsExcel>>,
|
Awaited<ReturnType<typeof uploadItemsExcel>>,
|
||||||
@ -326,7 +306,7 @@ export const getUploadItemsExcelMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
return uploadItemsExcel(data, requestOptions);
|
return uploadItemsExcel(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -353,7 +333,6 @@ export const useUploadItemsExcel = <
|
|||||||
{ data: BodyUploadItemsExcelV1ItemUploadExcelPost },
|
{ data: BodyUploadItemsExcelV1ItemUploadExcelPost },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -369,15 +348,12 @@ export const useUploadItemsExcel = <
|
|||||||
/**
|
/**
|
||||||
* @summary 상품 조회
|
* @summary 상품 조회
|
||||||
*/
|
*/
|
||||||
export const getItem = (
|
export const getItem = (itemId: string, signal?: AbortSignal) => {
|
||||||
itemId: string,
|
return customFetch<ResItem>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/item/${itemId}`,
|
||||||
signal?: AbortSignal,
|
method: "GET",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResItem>(
|
});
|
||||||
{ url: `/v1/item/${itemId}`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetItemQueryKey = (itemId?: string) => {
|
export const getGetItemQueryKey = (itemId?: string) => {
|
||||||
@ -393,16 +369,15 @@ export const getGetItemQueryOptions = <
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getItem>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getItem>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getGetItemQueryKey(itemId);
|
const queryKey = queryOptions?.queryKey ?? getGetItemQueryKey(itemId);
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getItem>>> = ({
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getItem>>> = ({
|
||||||
signal,
|
signal,
|
||||||
}) => getItem(itemId, requestOptions, signal);
|
}) => getItem(itemId, signal);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
queryKey,
|
queryKey,
|
||||||
@ -436,7 +411,6 @@ export function useGetItem<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -459,7 +433,6 @@ export function useGetItem<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -474,7 +447,6 @@ export function useGetItem<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getItem>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getItem>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -493,7 +465,6 @@ export function useGetItem<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getItem>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getItem>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -514,20 +485,13 @@ export function useGetItem<
|
|||||||
/**
|
/**
|
||||||
* @summary 상품 수정
|
* @summary 상품 수정
|
||||||
*/
|
*/
|
||||||
export const updateItem = (
|
export const updateItem = (itemId: string, reqUpdateItem: ReqUpdateItem) => {
|
||||||
itemId: string,
|
return customFetch<ResItem>({
|
||||||
reqUpdateItem: ReqUpdateItem,
|
url: `/v1/item/update/${itemId}`,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
method: "PATCH",
|
||||||
) => {
|
headers: { "Content-Type": "application/json" },
|
||||||
return customFetch<ResItem>(
|
data: reqUpdateItem,
|
||||||
{
|
});
|
||||||
url: `/v1/item/update/${itemId}`,
|
|
||||||
method: "PATCH",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
data: reqUpdateItem,
|
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateItemMutationOptions = <
|
export const getUpdateItemMutationOptions = <
|
||||||
@ -540,7 +504,6 @@ export const getUpdateItemMutationOptions = <
|
|||||||
{ itemId: string; data: ReqUpdateItem },
|
{ itemId: string; data: ReqUpdateItem },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof updateItem>>,
|
Awaited<ReturnType<typeof updateItem>>,
|
||||||
TError,
|
TError,
|
||||||
@ -548,13 +511,13 @@ export const getUpdateItemMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["updateItem"];
|
const mutationKey = ["updateItem"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof updateItem>>,
|
Awaited<ReturnType<typeof updateItem>>,
|
||||||
@ -562,7 +525,7 @@ export const getUpdateItemMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { itemId, data } = props ?? {};
|
const { itemId, data } = props ?? {};
|
||||||
|
|
||||||
return updateItem(itemId, data, requestOptions);
|
return updateItem(itemId, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -588,7 +551,6 @@ export const useUpdateItem = <
|
|||||||
{ itemId: string; data: ReqUpdateItem },
|
{ itemId: string; data: ReqUpdateItem },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -604,14 +566,11 @@ export const useUpdateItem = <
|
|||||||
/**
|
/**
|
||||||
* @summary 상품 삭제
|
* @summary 상품 삭제
|
||||||
*/
|
*/
|
||||||
export const deleteItem = (
|
export const deleteItem = (itemId: string) => {
|
||||||
itemId: string,
|
return customFetch<ResDeleteItem>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/item/delete/${itemId}`,
|
||||||
) => {
|
method: "DELETE",
|
||||||
return customFetch<ResDeleteItem>(
|
});
|
||||||
{ url: `/v1/item/delete/${itemId}`, method: "DELETE" },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteItemMutationOptions = <
|
export const getDeleteItemMutationOptions = <
|
||||||
@ -624,7 +583,6 @@ export const getDeleteItemMutationOptions = <
|
|||||||
{ itemId: string },
|
{ itemId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof deleteItem>>,
|
Awaited<ReturnType<typeof deleteItem>>,
|
||||||
TError,
|
TError,
|
||||||
@ -632,13 +590,13 @@ export const getDeleteItemMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["deleteItem"];
|
const mutationKey = ["deleteItem"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof deleteItem>>,
|
Awaited<ReturnType<typeof deleteItem>>,
|
||||||
@ -646,7 +604,7 @@ export const getDeleteItemMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { itemId } = props ?? {};
|
const { itemId } = props ?? {};
|
||||||
|
|
||||||
return deleteItem(itemId, requestOptions);
|
return deleteItem(itemId);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -672,7 +630,6 @@ export const useDeleteItem = <
|
|||||||
{ itemId: string },
|
{ itemId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -688,15 +645,12 @@ export const useDeleteItem = <
|
|||||||
/**
|
/**
|
||||||
* @summary 최저가 수집 요청(스텁)
|
* @summary 최저가 수집 요청(스텁)
|
||||||
*/
|
*/
|
||||||
export const triggerLowestPrice = (
|
export const triggerLowestPrice = (itemId: string, signal?: AbortSignal) => {
|
||||||
itemId: string,
|
return customFetch<ResLowestPriceTrigger>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/item/${itemId}/lowest-price`,
|
||||||
signal?: AbortSignal,
|
method: "POST",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResLowestPriceTrigger>(
|
});
|
||||||
{ url: `/v1/item/${itemId}/lowest-price`, method: "POST", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getTriggerLowestPriceMutationOptions = <
|
export const getTriggerLowestPriceMutationOptions = <
|
||||||
@ -709,7 +663,6 @@ export const getTriggerLowestPriceMutationOptions = <
|
|||||||
{ itemId: string },
|
{ itemId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof triggerLowestPrice>>,
|
Awaited<ReturnType<typeof triggerLowestPrice>>,
|
||||||
TError,
|
TError,
|
||||||
@ -717,13 +670,13 @@ export const getTriggerLowestPriceMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["triggerLowestPrice"];
|
const mutationKey = ["triggerLowestPrice"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof triggerLowestPrice>>,
|
Awaited<ReturnType<typeof triggerLowestPrice>>,
|
||||||
@ -731,7 +684,7 @@ export const getTriggerLowestPriceMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { itemId } = props ?? {};
|
const { itemId } = props ?? {};
|
||||||
|
|
||||||
return triggerLowestPrice(itemId, requestOptions);
|
return triggerLowestPrice(itemId);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -757,7 +710,6 @@ export const useTriggerLowestPrice = <
|
|||||||
{ itemId: string },
|
{ itemId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -773,15 +725,12 @@ export const useTriggerLowestPrice = <
|
|||||||
/**
|
/**
|
||||||
* @summary 최저가 수집 결과(스텁)
|
* @summary 최저가 수집 결과(스텁)
|
||||||
*/
|
*/
|
||||||
export const getLowestPrice = (
|
export const getLowestPrice = (itemId: string, signal?: AbortSignal) => {
|
||||||
itemId: string,
|
return customFetch<ResLowestPriceResult>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/item/${itemId}/lowest-price`,
|
||||||
signal?: AbortSignal,
|
method: "GET",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResLowestPriceResult>(
|
});
|
||||||
{ url: `/v1/item/${itemId}/lowest-price`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetLowestPriceQueryKey = (itemId?: string) => {
|
export const getGetLowestPriceQueryKey = (itemId?: string) => {
|
||||||
@ -797,16 +746,15 @@ export const getGetLowestPriceQueryOptions = <
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getLowestPrice>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getLowestPrice>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getGetLowestPriceQueryKey(itemId);
|
const queryKey = queryOptions?.queryKey ?? getGetLowestPriceQueryKey(itemId);
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getLowestPrice>>> = ({
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getLowestPrice>>> = ({
|
||||||
signal,
|
signal,
|
||||||
}) => getLowestPrice(itemId, requestOptions, signal);
|
}) => getLowestPrice(itemId, signal);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
queryKey,
|
queryKey,
|
||||||
@ -842,7 +790,6 @@ export function useGetLowestPrice<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -865,7 +812,6 @@ export function useGetLowestPrice<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -880,7 +826,6 @@ export function useGetLowestPrice<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getLowestPrice>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getLowestPrice>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -899,7 +844,6 @@ export function useGetLowestPrice<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getLowestPrice>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getLowestPrice>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
* OpenAPI spec version: 0.1.0
|
* OpenAPI spec version: 0.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export interface CompanyBrief {
|
export interface CompanyData {
|
||||||
company_id?: string;
|
company_id?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
}
|
}
|
||||||
12
negodata/front/src/api/generated/model/enumOption.ts
Normal file
12
negodata/front/src/api/generated/model/enumOption.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.21.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* Negodata Api Server
|
||||||
|
* OpenAPI spec version: 0.1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface EnumOption {
|
||||||
|
value: number;
|
||||||
|
name: string;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
@ -13,7 +13,8 @@ export * from "./chatMessageDataCardId";
|
|||||||
export * from "./chatMessageDataCardType";
|
export * from "./chatMessageDataCardType";
|
||||||
export * from "./chatMessageDataCardUsedYn";
|
export * from "./chatMessageDataCardUsedYn";
|
||||||
export * from "./chatMessageDataIndicatorValue";
|
export * from "./chatMessageDataIndicatorValue";
|
||||||
export * from "./companyBrief";
|
export * from "./companyData";
|
||||||
|
export * from "./enumOption";
|
||||||
export * from "./errorInfo";
|
export * from "./errorInfo";
|
||||||
export * from "./errorInfoCode";
|
export * from "./errorInfoCode";
|
||||||
export * from "./errorInfoDesc";
|
export * from "./errorInfoDesc";
|
||||||
@ -134,6 +135,9 @@ export * from "./resDeleteQuotationSetting";
|
|||||||
export * from "./resDeleteQuotationSettingMsg";
|
export * from "./resDeleteQuotationSettingMsg";
|
||||||
export * from "./resDeleteSupplier";
|
export * from "./resDeleteSupplier";
|
||||||
export * from "./resDeleteSupplierMsg";
|
export * from "./resDeleteSupplierMsg";
|
||||||
|
export * from "./resEnums";
|
||||||
|
export * from "./resEnumsEnums";
|
||||||
|
export * from "./resEnumsMsg";
|
||||||
export * from "./resExcelUpload";
|
export * from "./resExcelUpload";
|
||||||
export * from "./resExcelUploadMsg";
|
export * from "./resExcelUploadMsg";
|
||||||
export * from "./resExcelUploadReceivedFilename";
|
export * from "./resExcelUploadReceivedFilename";
|
||||||
|
|||||||
@ -5,4 +5,4 @@
|
|||||||
* OpenAPI spec version: 0.1.0
|
* OpenAPI spec version: 0.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type ItemDataDeliveryType = string | null;
|
export type ItemDataDeliveryType = number | null;
|
||||||
|
|||||||
@ -5,4 +5,4 @@
|
|||||||
* OpenAPI spec version: 0.1.0
|
* OpenAPI spec version: 0.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type ItemDataQuantityUnit = number | null;
|
export type ItemDataQuantityUnit = string | null;
|
||||||
|
|||||||
@ -5,4 +5,4 @@
|
|||||||
* OpenAPI spec version: 0.1.0
|
* OpenAPI spec version: 0.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type ReqCreateItemDeliveryType = string | null;
|
export type ReqCreateItemDeliveryType = number | null;
|
||||||
|
|||||||
@ -5,4 +5,4 @@
|
|||||||
* OpenAPI spec version: 0.1.0
|
* OpenAPI spec version: 0.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type ReqCreateItemQuantityUnit = number | null;
|
export type ReqCreateItemQuantityUnit = string | null;
|
||||||
|
|||||||
@ -5,4 +5,4 @@
|
|||||||
* OpenAPI spec version: 0.1.0
|
* OpenAPI spec version: 0.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type ReqUpdateItemDeliveryType = string | null;
|
export type ReqUpdateItemDeliveryType = number | null;
|
||||||
|
|||||||
@ -5,4 +5,4 @@
|
|||||||
* OpenAPI spec version: 0.1.0
|
* OpenAPI spec version: 0.1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type ReqUpdateItemQuantityUnit = number | null;
|
export type ReqUpdateItemQuantityUnit = string | null;
|
||||||
|
|||||||
15
negodata/front/src/api/generated/model/resEnums.ts
Normal file
15
negodata/front/src/api/generated/model/resEnums.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.21.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* Negodata Api Server
|
||||||
|
* OpenAPI spec version: 0.1.0
|
||||||
|
*/
|
||||||
|
import type { ErrorInfo } from "./errorInfo";
|
||||||
|
import type { ResEnumsMsg } from "./resEnumsMsg";
|
||||||
|
import type { ResEnumsEnums } from "./resEnumsEnums";
|
||||||
|
|
||||||
|
export interface ResEnums {
|
||||||
|
result?: ErrorInfo;
|
||||||
|
msg?: ResEnumsMsg;
|
||||||
|
enums?: ResEnumsEnums;
|
||||||
|
}
|
||||||
9
negodata/front/src/api/generated/model/resEnumsEnums.ts
Normal file
9
negodata/front/src/api/generated/model/resEnumsEnums.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.21.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* Negodata Api Server
|
||||||
|
* OpenAPI spec version: 0.1.0
|
||||||
|
*/
|
||||||
|
import type { EnumOption } from "./enumOption";
|
||||||
|
|
||||||
|
export type ResEnumsEnums = { [key: string]: EnumOption[] };
|
||||||
8
negodata/front/src/api/generated/model/resEnumsMsg.ts
Normal file
8
negodata/front/src/api/generated/model/resEnumsMsg.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.21.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* Negodata Api Server
|
||||||
|
* OpenAPI spec version: 0.1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type ResEnumsMsg = string | null;
|
||||||
@ -4,6 +4,6 @@
|
|||||||
* Negodata Api Server
|
* Negodata Api Server
|
||||||
* OpenAPI spec version: 0.1.0
|
* OpenAPI spec version: 0.1.0
|
||||||
*/
|
*/
|
||||||
import type { CompanyBrief } from "./companyBrief";
|
import type { CompanyData } from "./companyData";
|
||||||
|
|
||||||
export type ResMeCompany = CompanyBrief | null;
|
export type ResMeCompany = CompanyData | null;
|
||||||
|
|||||||
@ -31,19 +31,15 @@ import type {
|
|||||||
|
|
||||||
import { customFetch } from "../../mutator/custom-fetch";
|
import { customFetch } from "../../mutator/custom-fetch";
|
||||||
|
|
||||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary 견적 설정 목록
|
* @summary 견적 설정 목록
|
||||||
*/
|
*/
|
||||||
export const listSettings = (
|
export const listSettings = (signal?: AbortSignal) => {
|
||||||
options?: SecondParameter<typeof customFetch>,
|
return customFetch<ResQuotationSettingList>({
|
||||||
signal?: AbortSignal,
|
url: `/v1/quotation-setting/list`,
|
||||||
) => {
|
method: "GET",
|
||||||
return customFetch<ResQuotationSettingList>(
|
signal,
|
||||||
{ url: `/v1/quotation-setting/list`, method: "GET", signal },
|
});
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListSettingsQueryKey = () => {
|
export const getListSettingsQueryKey = () => {
|
||||||
@ -57,15 +53,14 @@ export const getListSettingsQueryOptions = <
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}) => {
|
}) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getListSettingsQueryKey();
|
const queryKey = queryOptions?.queryKey ?? getListSettingsQueryKey();
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof listSettings>>> = ({
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof listSettings>>> = ({
|
||||||
signal,
|
signal,
|
||||||
}) => listSettings(requestOptions, signal);
|
}) => listSettings(signal);
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listSettings>>,
|
Awaited<ReturnType<typeof listSettings>>,
|
||||||
@ -95,7 +90,6 @@ export function useListSettings<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -117,7 +111,6 @@ export function useListSettings<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -131,7 +124,6 @@ export function useListSettings<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -149,7 +141,6 @@ export function useListSettings<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listSettings>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -172,19 +163,15 @@ export function useListSettings<
|
|||||||
*/
|
*/
|
||||||
export const createSetting = (
|
export const createSetting = (
|
||||||
reqCreateQuotationSetting: ReqCreateQuotationSetting,
|
reqCreateQuotationSetting: ReqCreateQuotationSetting,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return customFetch<ResQuotationSetting>(
|
return customFetch<ResQuotationSetting>({
|
||||||
{
|
url: `/v1/quotation-setting/create`,
|
||||||
url: `/v1/quotation-setting/create`,
|
method: "POST",
|
||||||
method: "POST",
|
headers: { "Content-Type": "application/json" },
|
||||||
headers: { "Content-Type": "application/json" },
|
data: reqCreateQuotationSetting,
|
||||||
data: reqCreateQuotationSetting,
|
signal,
|
||||||
signal,
|
});
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateSettingMutationOptions = <
|
export const getCreateSettingMutationOptions = <
|
||||||
@ -197,7 +184,6 @@ export const getCreateSettingMutationOptions = <
|
|||||||
{ data: ReqCreateQuotationSetting },
|
{ data: ReqCreateQuotationSetting },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createSetting>>,
|
Awaited<ReturnType<typeof createSetting>>,
|
||||||
TError,
|
TError,
|
||||||
@ -205,13 +191,13 @@ export const getCreateSettingMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["createSetting"];
|
const mutationKey = ["createSetting"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createSetting>>,
|
Awaited<ReturnType<typeof createSetting>>,
|
||||||
@ -219,7 +205,7 @@ export const getCreateSettingMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
return createSetting(data, requestOptions);
|
return createSetting(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -245,7 +231,6 @@ export const useCreateSetting = <
|
|||||||
{ data: ReqCreateQuotationSetting },
|
{ data: ReqCreateQuotationSetting },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -264,17 +249,13 @@ export const useCreateSetting = <
|
|||||||
export const updateSetting = (
|
export const updateSetting = (
|
||||||
qtSettingId: string,
|
qtSettingId: string,
|
||||||
reqUpdateQuotationSetting: ReqUpdateQuotationSetting,
|
reqUpdateQuotationSetting: ReqUpdateQuotationSetting,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
) => {
|
) => {
|
||||||
return customFetch<ResQuotationSetting>(
|
return customFetch<ResQuotationSetting>({
|
||||||
{
|
url: `/v1/quotation-setting/update/${qtSettingId}`,
|
||||||
url: `/v1/quotation-setting/update/${qtSettingId}`,
|
method: "PATCH",
|
||||||
method: "PATCH",
|
headers: { "Content-Type": "application/json" },
|
||||||
headers: { "Content-Type": "application/json" },
|
data: reqUpdateQuotationSetting,
|
||||||
data: reqUpdateQuotationSetting,
|
});
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateSettingMutationOptions = <
|
export const getUpdateSettingMutationOptions = <
|
||||||
@ -287,7 +268,6 @@ export const getUpdateSettingMutationOptions = <
|
|||||||
{ qtSettingId: string; data: ReqUpdateQuotationSetting },
|
{ qtSettingId: string; data: ReqUpdateQuotationSetting },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof updateSetting>>,
|
Awaited<ReturnType<typeof updateSetting>>,
|
||||||
TError,
|
TError,
|
||||||
@ -295,13 +275,13 @@ export const getUpdateSettingMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["updateSetting"];
|
const mutationKey = ["updateSetting"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof updateSetting>>,
|
Awaited<ReturnType<typeof updateSetting>>,
|
||||||
@ -309,7 +289,7 @@ export const getUpdateSettingMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { qtSettingId, data } = props ?? {};
|
const { qtSettingId, data } = props ?? {};
|
||||||
|
|
||||||
return updateSetting(qtSettingId, data, requestOptions);
|
return updateSetting(qtSettingId, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -335,7 +315,6 @@ export const useUpdateSetting = <
|
|||||||
{ qtSettingId: string; data: ReqUpdateQuotationSetting },
|
{ qtSettingId: string; data: ReqUpdateQuotationSetting },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -351,14 +330,11 @@ export const useUpdateSetting = <
|
|||||||
/**
|
/**
|
||||||
* @summary 견적 설정 삭제
|
* @summary 견적 설정 삭제
|
||||||
*/
|
*/
|
||||||
export const deleteSetting = (
|
export const deleteSetting = (qtSettingId: string) => {
|
||||||
qtSettingId: string,
|
return customFetch<ResDeleteQuotationSetting>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/quotation-setting/delete/${qtSettingId}`,
|
||||||
) => {
|
method: "DELETE",
|
||||||
return customFetch<ResDeleteQuotationSetting>(
|
});
|
||||||
{ url: `/v1/quotation-setting/delete/${qtSettingId}`, method: "DELETE" },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteSettingMutationOptions = <
|
export const getDeleteSettingMutationOptions = <
|
||||||
@ -371,7 +347,6 @@ export const getDeleteSettingMutationOptions = <
|
|||||||
{ qtSettingId: string },
|
{ qtSettingId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof deleteSetting>>,
|
Awaited<ReturnType<typeof deleteSetting>>,
|
||||||
TError,
|
TError,
|
||||||
@ -379,13 +354,13 @@ export const getDeleteSettingMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["deleteSetting"];
|
const mutationKey = ["deleteSetting"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof deleteSetting>>,
|
Awaited<ReturnType<typeof deleteSetting>>,
|
||||||
@ -393,7 +368,7 @@ export const getDeleteSettingMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { qtSettingId } = props ?? {};
|
const { qtSettingId } = props ?? {};
|
||||||
|
|
||||||
return deleteSetting(qtSettingId, requestOptions);
|
return deleteSetting(qtSettingId);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -419,7 +394,6 @@ export const useDeleteSetting = <
|
|||||||
{ qtSettingId: string },
|
{ qtSettingId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
|
|||||||
@ -37,20 +37,19 @@ import type {
|
|||||||
|
|
||||||
import { customFetch } from "../../mutator/custom-fetch";
|
import { customFetch } from "../../mutator/custom-fetch";
|
||||||
|
|
||||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary 견적 목록
|
* @summary 견적 목록
|
||||||
*/
|
*/
|
||||||
export const listQuotations = (
|
export const listQuotations = (
|
||||||
params?: ListQuotationsParams,
|
params?: ListQuotationsParams,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return customFetch<ResQuotationList>(
|
return customFetch<ResQuotationList>({
|
||||||
{ url: `/v1/quotation/list`, method: "GET", params, signal },
|
url: `/v1/quotation/list`,
|
||||||
options,
|
method: "GET",
|
||||||
);
|
params,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListQuotationsQueryKey = (params?: ListQuotationsParams) => {
|
export const getListQuotationsQueryKey = (params?: ListQuotationsParams) => {
|
||||||
@ -66,16 +65,15 @@ export const getListQuotationsQueryOptions = <
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listQuotations>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listQuotations>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getListQuotationsQueryKey(params);
|
const queryKey = queryOptions?.queryKey ?? getListQuotationsQueryKey(params);
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof listQuotations>>> = ({
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof listQuotations>>> = ({
|
||||||
signal,
|
signal,
|
||||||
}) => listQuotations(params, requestOptions, signal);
|
}) => listQuotations(params, signal);
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listQuotations>>,
|
Awaited<ReturnType<typeof listQuotations>>,
|
||||||
@ -106,7 +104,6 @@ export function useListQuotations<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -129,7 +126,6 @@ export function useListQuotations<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -144,7 +140,6 @@ export function useListQuotations<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listQuotations>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listQuotations>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -163,7 +158,6 @@ export function useListQuotations<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listQuotations>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listQuotations>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -186,19 +180,15 @@ export function useListQuotations<
|
|||||||
*/
|
*/
|
||||||
export const createQuotation = (
|
export const createQuotation = (
|
||||||
reqCreateQuotation: ReqCreateQuotation,
|
reqCreateQuotation: ReqCreateQuotation,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return customFetch<ResCreateQuotation>(
|
return customFetch<ResCreateQuotation>({
|
||||||
{
|
url: `/v1/quotation/create`,
|
||||||
url: `/v1/quotation/create`,
|
method: "POST",
|
||||||
method: "POST",
|
headers: { "Content-Type": "application/json" },
|
||||||
headers: { "Content-Type": "application/json" },
|
data: reqCreateQuotation,
|
||||||
data: reqCreateQuotation,
|
signal,
|
||||||
signal,
|
});
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateQuotationMutationOptions = <
|
export const getCreateQuotationMutationOptions = <
|
||||||
@ -211,7 +201,6 @@ export const getCreateQuotationMutationOptions = <
|
|||||||
{ data: ReqCreateQuotation },
|
{ data: ReqCreateQuotation },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createQuotation>>,
|
Awaited<ReturnType<typeof createQuotation>>,
|
||||||
TError,
|
TError,
|
||||||
@ -219,13 +208,13 @@ export const getCreateQuotationMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["createQuotation"];
|
const mutationKey = ["createQuotation"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createQuotation>>,
|
Awaited<ReturnType<typeof createQuotation>>,
|
||||||
@ -233,7 +222,7 @@ export const getCreateQuotationMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
return createQuotation(data, requestOptions);
|
return createQuotation(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -259,7 +248,6 @@ export const useCreateQuotation = <
|
|||||||
{ data: ReqCreateQuotation },
|
{ data: ReqCreateQuotation },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -275,15 +263,12 @@ export const useCreateQuotation = <
|
|||||||
/**
|
/**
|
||||||
* @summary 견적 마감
|
* @summary 견적 마감
|
||||||
*/
|
*/
|
||||||
export const stopQuotation = (
|
export const stopQuotation = (qtId: string, signal?: AbortSignal) => {
|
||||||
qtId: string,
|
return customFetch<ResQuotation>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/quotation/stop/${qtId}`,
|
||||||
signal?: AbortSignal,
|
method: "POST",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResQuotation>(
|
});
|
||||||
{ url: `/v1/quotation/stop/${qtId}`, method: "POST", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getStopQuotationMutationOptions = <
|
export const getStopQuotationMutationOptions = <
|
||||||
@ -296,7 +281,6 @@ export const getStopQuotationMutationOptions = <
|
|||||||
{ qtId: string },
|
{ qtId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof stopQuotation>>,
|
Awaited<ReturnType<typeof stopQuotation>>,
|
||||||
TError,
|
TError,
|
||||||
@ -304,13 +288,13 @@ export const getStopQuotationMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["stopQuotation"];
|
const mutationKey = ["stopQuotation"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof stopQuotation>>,
|
Awaited<ReturnType<typeof stopQuotation>>,
|
||||||
@ -318,7 +302,7 @@ export const getStopQuotationMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { qtId } = props ?? {};
|
const { qtId } = props ?? {};
|
||||||
|
|
||||||
return stopQuotation(qtId, requestOptions);
|
return stopQuotation(qtId);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -344,7 +328,6 @@ export const useStopQuotation = <
|
|||||||
{ qtId: string },
|
{ qtId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -360,15 +343,12 @@ export const useStopQuotation = <
|
|||||||
/**
|
/**
|
||||||
* @summary 견적 상태 조회
|
* @summary 견적 상태 조회
|
||||||
*/
|
*/
|
||||||
export const getQuotationStatus = (
|
export const getQuotationStatus = (qtId: string, signal?: AbortSignal) => {
|
||||||
qtId: string,
|
return customFetch<ResQuotationStatus>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/quotation/${qtId}/status`,
|
||||||
signal?: AbortSignal,
|
method: "GET",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResQuotationStatus>(
|
});
|
||||||
{ url: `/v1/quotation/${qtId}/status`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetQuotationStatusQueryKey = (qtId?: string) => {
|
export const getGetQuotationStatusQueryKey = (qtId?: string) => {
|
||||||
@ -388,17 +368,16 @@ export const getGetQuotationStatusQueryOptions = <
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey =
|
const queryKey =
|
||||||
queryOptions?.queryKey ?? getGetQuotationStatusQueryKey(qtId);
|
queryOptions?.queryKey ?? getGetQuotationStatusQueryKey(qtId);
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
const queryFn: QueryFunction<
|
||||||
Awaited<ReturnType<typeof getQuotationStatus>>
|
Awaited<ReturnType<typeof getQuotationStatus>>
|
||||||
> = ({ signal }) => getQuotationStatus(qtId, requestOptions, signal);
|
> = ({ signal }) => getQuotationStatus(qtId, signal);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
queryKey,
|
queryKey,
|
||||||
@ -438,7 +417,6 @@ export function useGetQuotationStatus<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -465,7 +443,6 @@ export function useGetQuotationStatus<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -484,7 +461,6 @@ export function useGetQuotationStatus<
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -507,7 +483,6 @@ export function useGetQuotationStatus<
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -528,15 +503,12 @@ export function useGetQuotationStatus<
|
|||||||
/**
|
/**
|
||||||
* @summary 참여현황
|
* @summary 참여현황
|
||||||
*/
|
*/
|
||||||
export const getQuotationSessions = (
|
export const getQuotationSessions = (qtId: string, signal?: AbortSignal) => {
|
||||||
qtId: string,
|
return customFetch<ResQuotationSessions>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/quotation/${qtId}/sessions`,
|
||||||
signal?: AbortSignal,
|
method: "GET",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResQuotationSessions>(
|
});
|
||||||
{ url: `/v1/quotation/${qtId}/sessions`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetQuotationSessionsQueryKey = (qtId?: string) => {
|
export const getGetQuotationSessionsQueryKey = (qtId?: string) => {
|
||||||
@ -556,17 +528,16 @@ export const getGetQuotationSessionsQueryOptions = <
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey =
|
const queryKey =
|
||||||
queryOptions?.queryKey ?? getGetQuotationSessionsQueryKey(qtId);
|
queryOptions?.queryKey ?? getGetQuotationSessionsQueryKey(qtId);
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
const queryFn: QueryFunction<
|
||||||
Awaited<ReturnType<typeof getQuotationSessions>>
|
Awaited<ReturnType<typeof getQuotationSessions>>
|
||||||
> = ({ signal }) => getQuotationSessions(qtId, requestOptions, signal);
|
> = ({ signal }) => getQuotationSessions(qtId, signal);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
queryKey,
|
queryKey,
|
||||||
@ -606,7 +577,6 @@ export function useGetQuotationSessions<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -633,7 +603,6 @@ export function useGetQuotationSessions<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -652,7 +621,6 @@ export function useGetQuotationSessions<
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -675,7 +643,6 @@ export function useGetQuotationSessions<
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -696,15 +663,12 @@ export function useGetQuotationSessions<
|
|||||||
/**
|
/**
|
||||||
* @summary 채팅 상세
|
* @summary 채팅 상세
|
||||||
*/
|
*/
|
||||||
export const getSessionChat = (
|
export const getSessionChat = (sessionId: string, signal?: AbortSignal) => {
|
||||||
sessionId: string,
|
return customFetch<ResSessionChat>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/quotation/session/${sessionId}/chat`,
|
||||||
signal?: AbortSignal,
|
method: "GET",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResSessionChat>(
|
});
|
||||||
{ url: `/v1/quotation/session/${sessionId}/chat`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetSessionChatQueryKey = (sessionId?: string) => {
|
export const getGetSessionChatQueryKey = (sessionId?: string) => {
|
||||||
@ -720,17 +684,16 @@ export const getGetSessionChatQueryOptions = <
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getSessionChat>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getSessionChat>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey =
|
const queryKey =
|
||||||
queryOptions?.queryKey ?? getGetSessionChatQueryKey(sessionId);
|
queryOptions?.queryKey ?? getGetSessionChatQueryKey(sessionId);
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSessionChat>>> = ({
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSessionChat>>> = ({
|
||||||
signal,
|
signal,
|
||||||
}) => getSessionChat(sessionId, requestOptions, signal);
|
}) => getSessionChat(sessionId, signal);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
queryKey,
|
queryKey,
|
||||||
@ -766,7 +729,6 @@ export function useGetSessionChat<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -789,7 +751,6 @@ export function useGetSessionChat<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -804,7 +765,6 @@ export function useGetSessionChat<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getSessionChat>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getSessionChat>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -823,7 +783,6 @@ export function useGetSessionChat<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getSessionChat>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getSessionChat>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -844,15 +803,12 @@ export function useGetSessionChat<
|
|||||||
/**
|
/**
|
||||||
* @summary 낙찰 결과
|
* @summary 낙찰 결과
|
||||||
*/
|
*/
|
||||||
export const getQuotationResult = (
|
export const getQuotationResult = (qtId: string, signal?: AbortSignal) => {
|
||||||
qtId: string,
|
return customFetch<ResQuotationResult>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/quotation/${qtId}/result`,
|
||||||
signal?: AbortSignal,
|
method: "GET",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResQuotationResult>(
|
});
|
||||||
{ url: `/v1/quotation/${qtId}/result`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetQuotationResultQueryKey = (qtId?: string) => {
|
export const getGetQuotationResultQueryKey = (qtId?: string) => {
|
||||||
@ -872,17 +828,16 @@ export const getGetQuotationResultQueryOptions = <
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey =
|
const queryKey =
|
||||||
queryOptions?.queryKey ?? getGetQuotationResultQueryKey(qtId);
|
queryOptions?.queryKey ?? getGetQuotationResultQueryKey(qtId);
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
const queryFn: QueryFunction<
|
||||||
Awaited<ReturnType<typeof getQuotationResult>>
|
Awaited<ReturnType<typeof getQuotationResult>>
|
||||||
> = ({ signal }) => getQuotationResult(qtId, requestOptions, signal);
|
> = ({ signal }) => getQuotationResult(qtId, signal);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
queryKey,
|
queryKey,
|
||||||
@ -922,7 +877,6 @@ export function useGetQuotationResult<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -949,7 +903,6 @@ export function useGetQuotationResult<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -968,7 +921,6 @@ export function useGetQuotationResult<
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -991,7 +943,6 @@ export function useGetQuotationResult<
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -1012,15 +963,12 @@ export function useGetQuotationResult<
|
|||||||
/**
|
/**
|
||||||
* @summary 견적 사용 카드
|
* @summary 견적 사용 카드
|
||||||
*/
|
*/
|
||||||
export const getQuotationCards = (
|
export const getQuotationCards = (qtId: string, signal?: AbortSignal) => {
|
||||||
qtId: string,
|
return customFetch<ResQuotationCards>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/quotation/${qtId}/cards`,
|
||||||
signal?: AbortSignal,
|
method: "GET",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResQuotationCards>(
|
});
|
||||||
{ url: `/v1/quotation/${qtId}/cards`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetQuotationCardsQueryKey = (qtId?: string) => {
|
export const getGetQuotationCardsQueryKey = (qtId?: string) => {
|
||||||
@ -1040,16 +988,15 @@ export const getGetQuotationCardsQueryOptions = <
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getGetQuotationCardsQueryKey(qtId);
|
const queryKey = queryOptions?.queryKey ?? getGetQuotationCardsQueryKey(qtId);
|
||||||
|
|
||||||
const queryFn: QueryFunction<
|
const queryFn: QueryFunction<
|
||||||
Awaited<ReturnType<typeof getQuotationCards>>
|
Awaited<ReturnType<typeof getQuotationCards>>
|
||||||
> = ({ signal }) => getQuotationCards(qtId, requestOptions, signal);
|
> = ({ signal }) => getQuotationCards(qtId, signal);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
queryKey,
|
queryKey,
|
||||||
@ -1089,7 +1036,6 @@ export function useGetQuotationCards<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -1116,7 +1062,6 @@ export function useGetQuotationCards<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -1135,7 +1080,6 @@ export function useGetQuotationCards<
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -1158,7 +1102,6 @@ export function useGetQuotationCards<
|
|||||||
TData
|
TData
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -1179,14 +1122,11 @@ export function useGetQuotationCards<
|
|||||||
/**
|
/**
|
||||||
* @summary 견적 삭제
|
* @summary 견적 삭제
|
||||||
*/
|
*/
|
||||||
export const deleteQuotation = (
|
export const deleteQuotation = (qtId: string) => {
|
||||||
qtId: string,
|
return customFetch<ResDeleteQuotation>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/quotation/delete/${qtId}`,
|
||||||
) => {
|
method: "DELETE",
|
||||||
return customFetch<ResDeleteQuotation>(
|
});
|
||||||
{ url: `/v1/quotation/delete/${qtId}`, method: "DELETE" },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteQuotationMutationOptions = <
|
export const getDeleteQuotationMutationOptions = <
|
||||||
@ -1199,7 +1139,6 @@ export const getDeleteQuotationMutationOptions = <
|
|||||||
{ qtId: string },
|
{ qtId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof deleteQuotation>>,
|
Awaited<ReturnType<typeof deleteQuotation>>,
|
||||||
TError,
|
TError,
|
||||||
@ -1207,13 +1146,13 @@ export const getDeleteQuotationMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["deleteQuotation"];
|
const mutationKey = ["deleteQuotation"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof deleteQuotation>>,
|
Awaited<ReturnType<typeof deleteQuotation>>,
|
||||||
@ -1221,7 +1160,7 @@ export const getDeleteQuotationMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { qtId } = props ?? {};
|
const { qtId } = props ?? {};
|
||||||
|
|
||||||
return deleteQuotation(qtId, requestOptions);
|
return deleteQuotation(qtId);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -1247,7 +1186,6 @@ export const useDeleteQuotation = <
|
|||||||
{ qtId: string },
|
{ qtId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -1263,15 +1201,12 @@ export const useDeleteQuotation = <
|
|||||||
/**
|
/**
|
||||||
* @summary 견적 조회
|
* @summary 견적 조회
|
||||||
*/
|
*/
|
||||||
export const getQuotation = (
|
export const getQuotation = (qtId: string, signal?: AbortSignal) => {
|
||||||
qtId: string,
|
return customFetch<ResQuotation>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/quotation/${qtId}`,
|
||||||
signal?: AbortSignal,
|
method: "GET",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResQuotation>(
|
});
|
||||||
{ url: `/v1/quotation/${qtId}`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetQuotationQueryKey = (qtId?: string) => {
|
export const getGetQuotationQueryKey = (qtId?: string) => {
|
||||||
@ -1287,16 +1222,15 @@ export const getGetQuotationQueryOptions = <
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getQuotation>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getQuotation>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getGetQuotationQueryKey(qtId);
|
const queryKey = queryOptions?.queryKey ?? getGetQuotationQueryKey(qtId);
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getQuotation>>> = ({
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getQuotation>>> = ({
|
||||||
signal,
|
signal,
|
||||||
}) => getQuotation(qtId, requestOptions, signal);
|
}) => getQuotation(qtId, signal);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
queryKey,
|
queryKey,
|
||||||
@ -1332,7 +1266,6 @@ export function useGetQuotation<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -1355,7 +1288,6 @@ export function useGetQuotation<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -1370,7 +1302,6 @@ export function useGetQuotation<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getQuotation>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getQuotation>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -1389,7 +1320,6 @@ export function useGetQuotation<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getQuotation>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getQuotation>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
|
|||||||
@ -34,20 +34,19 @@ import type {
|
|||||||
|
|
||||||
import { customFetch } from "../../mutator/custom-fetch";
|
import { customFetch } from "../../mutator/custom-fetch";
|
||||||
|
|
||||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary 협력사 목록
|
* @summary 협력사 목록
|
||||||
*/
|
*/
|
||||||
export const listSuppliers = (
|
export const listSuppliers = (
|
||||||
params?: ListSuppliersParams,
|
params?: ListSuppliersParams,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return customFetch<ResSupplierList>(
|
return customFetch<ResSupplierList>({
|
||||||
{ url: `/v1/supplier/list`, method: "GET", params, signal },
|
url: `/v1/supplier/list`,
|
||||||
options,
|
method: "GET",
|
||||||
);
|
params,
|
||||||
|
signal,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getListSuppliersQueryKey = (params?: ListSuppliersParams) => {
|
export const getListSuppliersQueryKey = (params?: ListSuppliersParams) => {
|
||||||
@ -63,16 +62,15 @@ export const getListSuppliersQueryOptions = <
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listSuppliers>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listSuppliers>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getListSuppliersQueryKey(params);
|
const queryKey = queryOptions?.queryKey ?? getListSuppliersQueryKey(params);
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof listSuppliers>>> = ({
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof listSuppliers>>> = ({
|
||||||
signal,
|
signal,
|
||||||
}) => listSuppliers(params, requestOptions, signal);
|
}) => listSuppliers(params, signal);
|
||||||
|
|
||||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||||
Awaited<ReturnType<typeof listSuppliers>>,
|
Awaited<ReturnType<typeof listSuppliers>>,
|
||||||
@ -103,7 +101,6 @@ export function useListSuppliers<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -126,7 +123,6 @@ export function useListSuppliers<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -141,7 +137,6 @@ export function useListSuppliers<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listSuppliers>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listSuppliers>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -160,7 +155,6 @@ export function useListSuppliers<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof listSuppliers>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof listSuppliers>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -183,19 +177,15 @@ export function useListSuppliers<
|
|||||||
*/
|
*/
|
||||||
export const createSupplier = (
|
export const createSupplier = (
|
||||||
reqCreateSupplier: ReqCreateSupplier,
|
reqCreateSupplier: ReqCreateSupplier,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
return customFetch<ResSupplier>(
|
return customFetch<ResSupplier>({
|
||||||
{
|
url: `/v1/supplier/create`,
|
||||||
url: `/v1/supplier/create`,
|
method: "POST",
|
||||||
method: "POST",
|
headers: { "Content-Type": "application/json" },
|
||||||
headers: { "Content-Type": "application/json" },
|
data: reqCreateSupplier,
|
||||||
data: reqCreateSupplier,
|
signal,
|
||||||
signal,
|
});
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCreateSupplierMutationOptions = <
|
export const getCreateSupplierMutationOptions = <
|
||||||
@ -208,7 +198,6 @@ export const getCreateSupplierMutationOptions = <
|
|||||||
{ data: ReqCreateSupplier },
|
{ data: ReqCreateSupplier },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof createSupplier>>,
|
Awaited<ReturnType<typeof createSupplier>>,
|
||||||
TError,
|
TError,
|
||||||
@ -216,13 +205,13 @@ export const getCreateSupplierMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["createSupplier"];
|
const mutationKey = ["createSupplier"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof createSupplier>>,
|
Awaited<ReturnType<typeof createSupplier>>,
|
||||||
@ -230,7 +219,7 @@ export const getCreateSupplierMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
return createSupplier(data, requestOptions);
|
return createSupplier(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -256,7 +245,6 @@ export const useCreateSupplier = <
|
|||||||
{ data: ReqCreateSupplier },
|
{ data: ReqCreateSupplier },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -274,7 +262,6 @@ export const useCreateSupplier = <
|
|||||||
*/
|
*/
|
||||||
export const uploadSuppliersExcel = (
|
export const uploadSuppliersExcel = (
|
||||||
bodyUploadSuppliersExcelV1SupplierUploadExcelPost: BodyUploadSuppliersExcelV1SupplierUploadExcelPost,
|
bodyUploadSuppliersExcelV1SupplierUploadExcelPost: BodyUploadSuppliersExcelV1SupplierUploadExcelPost,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => {
|
) => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
@ -283,16 +270,13 @@ export const uploadSuppliersExcel = (
|
|||||||
bodyUploadSuppliersExcelV1SupplierUploadExcelPost.file,
|
bodyUploadSuppliersExcelV1SupplierUploadExcelPost.file,
|
||||||
);
|
);
|
||||||
|
|
||||||
return customFetch<ResExcelUpload>(
|
return customFetch<ResExcelUpload>({
|
||||||
{
|
url: `/v1/supplier/upload-excel`,
|
||||||
url: `/v1/supplier/upload-excel`,
|
method: "POST",
|
||||||
method: "POST",
|
headers: { "Content-Type": "multipart/form-data" },
|
||||||
headers: { "Content-Type": "multipart/form-data" },
|
data: formData,
|
||||||
data: formData,
|
signal,
|
||||||
signal,
|
});
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getUploadSuppliersExcelMutationOptions = <
|
export const getUploadSuppliersExcelMutationOptions = <
|
||||||
@ -305,7 +289,6 @@ export const getUploadSuppliersExcelMutationOptions = <
|
|||||||
{ data: BodyUploadSuppliersExcelV1SupplierUploadExcelPost },
|
{ data: BodyUploadSuppliersExcelV1SupplierUploadExcelPost },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof uploadSuppliersExcel>>,
|
Awaited<ReturnType<typeof uploadSuppliersExcel>>,
|
||||||
TError,
|
TError,
|
||||||
@ -313,13 +296,13 @@ export const getUploadSuppliersExcelMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["uploadSuppliersExcel"];
|
const mutationKey = ["uploadSuppliersExcel"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof uploadSuppliersExcel>>,
|
Awaited<ReturnType<typeof uploadSuppliersExcel>>,
|
||||||
@ -327,7 +310,7 @@ export const getUploadSuppliersExcelMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { data } = props ?? {};
|
const { data } = props ?? {};
|
||||||
|
|
||||||
return uploadSuppliersExcel(data, requestOptions);
|
return uploadSuppliersExcel(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -354,7 +337,6 @@ export const useUploadSuppliersExcel = <
|
|||||||
{ data: BodyUploadSuppliersExcelV1SupplierUploadExcelPost },
|
{ data: BodyUploadSuppliersExcelV1SupplierUploadExcelPost },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -370,15 +352,12 @@ export const useUploadSuppliersExcel = <
|
|||||||
/**
|
/**
|
||||||
* @summary 협력사 조회
|
* @summary 협력사 조회
|
||||||
*/
|
*/
|
||||||
export const getSupplier = (
|
export const getSupplier = (supplierId: string, signal?: AbortSignal) => {
|
||||||
supplierId: string,
|
return customFetch<ResSupplier>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/supplier/${supplierId}`,
|
||||||
signal?: AbortSignal,
|
method: "GET",
|
||||||
) => {
|
signal,
|
||||||
return customFetch<ResSupplier>(
|
});
|
||||||
{ url: `/v1/supplier/${supplierId}`, method: "GET", signal },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGetSupplierQueryKey = (supplierId?: string) => {
|
export const getGetSupplierQueryKey = (supplierId?: string) => {
|
||||||
@ -394,16 +373,15 @@ export const getGetSupplierQueryOptions = <
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getSupplier>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getSupplier>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
const { query: queryOptions, request: requestOptions } = options ?? {};
|
const { query: queryOptions } = options ?? {};
|
||||||
|
|
||||||
const queryKey = queryOptions?.queryKey ?? getGetSupplierQueryKey(supplierId);
|
const queryKey = queryOptions?.queryKey ?? getGetSupplierQueryKey(supplierId);
|
||||||
|
|
||||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSupplier>>> = ({
|
const queryFn: QueryFunction<Awaited<ReturnType<typeof getSupplier>>> = ({
|
||||||
signal,
|
signal,
|
||||||
}) => getSupplier(supplierId, requestOptions, signal);
|
}) => getSupplier(supplierId, signal);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
queryKey,
|
queryKey,
|
||||||
@ -439,7 +417,6 @@ export function useGetSupplier<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): DefinedUseQueryResult<TData, TError> & {
|
): DefinedUseQueryResult<TData, TError> & {
|
||||||
@ -462,7 +439,6 @@ export function useGetSupplier<
|
|||||||
>,
|
>,
|
||||||
"initialData"
|
"initialData"
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -477,7 +453,6 @@ export function useGetSupplier<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getSupplier>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getSupplier>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -496,7 +471,6 @@ export function useGetSupplier<
|
|||||||
query?: Partial<
|
query?: Partial<
|
||||||
UseQueryOptions<Awaited<ReturnType<typeof getSupplier>>, TError, TData>
|
UseQueryOptions<Awaited<ReturnType<typeof getSupplier>>, TError, TData>
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseQueryResult<TData, TError> & {
|
): UseQueryResult<TData, TError> & {
|
||||||
@ -520,17 +494,13 @@ export function useGetSupplier<
|
|||||||
export const updateSupplier = (
|
export const updateSupplier = (
|
||||||
supplierId: string,
|
supplierId: string,
|
||||||
reqUpdateSupplier: ReqUpdateSupplier,
|
reqUpdateSupplier: ReqUpdateSupplier,
|
||||||
options?: SecondParameter<typeof customFetch>,
|
|
||||||
) => {
|
) => {
|
||||||
return customFetch<ResSupplier>(
|
return customFetch<ResSupplier>({
|
||||||
{
|
url: `/v1/supplier/update/${supplierId}`,
|
||||||
url: `/v1/supplier/update/${supplierId}`,
|
method: "PATCH",
|
||||||
method: "PATCH",
|
headers: { "Content-Type": "application/json" },
|
||||||
headers: { "Content-Type": "application/json" },
|
data: reqUpdateSupplier,
|
||||||
data: reqUpdateSupplier,
|
});
|
||||||
},
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getUpdateSupplierMutationOptions = <
|
export const getUpdateSupplierMutationOptions = <
|
||||||
@ -543,7 +513,6 @@ export const getUpdateSupplierMutationOptions = <
|
|||||||
{ supplierId: string; data: ReqUpdateSupplier },
|
{ supplierId: string; data: ReqUpdateSupplier },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof updateSupplier>>,
|
Awaited<ReturnType<typeof updateSupplier>>,
|
||||||
TError,
|
TError,
|
||||||
@ -551,13 +520,13 @@ export const getUpdateSupplierMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["updateSupplier"];
|
const mutationKey = ["updateSupplier"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof updateSupplier>>,
|
Awaited<ReturnType<typeof updateSupplier>>,
|
||||||
@ -565,7 +534,7 @@ export const getUpdateSupplierMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { supplierId, data } = props ?? {};
|
const { supplierId, data } = props ?? {};
|
||||||
|
|
||||||
return updateSupplier(supplierId, data, requestOptions);
|
return updateSupplier(supplierId, data);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -591,7 +560,6 @@ export const useUpdateSupplier = <
|
|||||||
{ supplierId: string; data: ReqUpdateSupplier },
|
{ supplierId: string; data: ReqUpdateSupplier },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
@ -607,14 +575,11 @@ export const useUpdateSupplier = <
|
|||||||
/**
|
/**
|
||||||
* @summary 협력사 삭제
|
* @summary 협력사 삭제
|
||||||
*/
|
*/
|
||||||
export const deleteSupplier = (
|
export const deleteSupplier = (supplierId: string) => {
|
||||||
supplierId: string,
|
return customFetch<ResDeleteSupplier>({
|
||||||
options?: SecondParameter<typeof customFetch>,
|
url: `/v1/supplier/delete/${supplierId}`,
|
||||||
) => {
|
method: "DELETE",
|
||||||
return customFetch<ResDeleteSupplier>(
|
});
|
||||||
{ url: `/v1/supplier/delete/${supplierId}`, method: "DELETE" },
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDeleteSupplierMutationOptions = <
|
export const getDeleteSupplierMutationOptions = <
|
||||||
@ -627,7 +592,6 @@ export const getDeleteSupplierMutationOptions = <
|
|||||||
{ supplierId: string },
|
{ supplierId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
}): UseMutationOptions<
|
}): UseMutationOptions<
|
||||||
Awaited<ReturnType<typeof deleteSupplier>>,
|
Awaited<ReturnType<typeof deleteSupplier>>,
|
||||||
TError,
|
TError,
|
||||||
@ -635,13 +599,13 @@ export const getDeleteSupplierMutationOptions = <
|
|||||||
TContext
|
TContext
|
||||||
> => {
|
> => {
|
||||||
const mutationKey = ["deleteSupplier"];
|
const mutationKey = ["deleteSupplier"];
|
||||||
const { mutation: mutationOptions, request: requestOptions } = options
|
const { mutation: mutationOptions } = options
|
||||||
? options.mutation &&
|
? options.mutation &&
|
||||||
"mutationKey" in options.mutation &&
|
"mutationKey" in options.mutation &&
|
||||||
options.mutation.mutationKey
|
options.mutation.mutationKey
|
||||||
? options
|
? options
|
||||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||||
: { mutation: { mutationKey }, request: undefined };
|
: { mutation: { mutationKey } };
|
||||||
|
|
||||||
const mutationFn: MutationFunction<
|
const mutationFn: MutationFunction<
|
||||||
Awaited<ReturnType<typeof deleteSupplier>>,
|
Awaited<ReturnType<typeof deleteSupplier>>,
|
||||||
@ -649,7 +613,7 @@ export const getDeleteSupplierMutationOptions = <
|
|||||||
> = (props) => {
|
> = (props) => {
|
||||||
const { supplierId } = props ?? {};
|
const { supplierId } = props ?? {};
|
||||||
|
|
||||||
return deleteSupplier(supplierId, requestOptions);
|
return deleteSupplier(supplierId);
|
||||||
};
|
};
|
||||||
|
|
||||||
return { mutationFn, ...mutationOptions };
|
return { mutationFn, ...mutationOptions };
|
||||||
@ -675,7 +639,6 @@ export const useDeleteSupplier = <
|
|||||||
{ supplierId: string },
|
{ supplierId: string },
|
||||||
TContext
|
TContext
|
||||||
>;
|
>;
|
||||||
request?: SecondParameter<typeof customFetch>;
|
|
||||||
},
|
},
|
||||||
queryClient?: QueryClient,
|
queryClient?: QueryClient,
|
||||||
): UseMutationResult<
|
): UseMutationResult<
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { useMemo, useRef, useState } from 'react';
|
import { useMemo, useRef, useState } from 'react';
|
||||||
import { Upload, X, FileSpreadsheet, CheckCircle2, Download } from 'lucide-react';
|
import { Upload, X, FileSpreadsheet, CheckCircle2, Download } from 'lucide-react';
|
||||||
import type { SupplierCreate } from '@/api/generated/model/supplierCreate';
|
import type { ReqCreateSupplier as SupplierCreate } from '@/api/generated/model/reqCreateSupplier';
|
||||||
import { showToast } from '@/lib/notify';
|
import { showToast } from '@/lib/notify';
|
||||||
import { downloadExcel, parseCsv } from '@/lib/excel';
|
import { downloadExcel, parseCsv } from '@/lib/excel';
|
||||||
import { Typography } from '@/components/ui/typography';
|
import { Typography } from '@/components/ui/typography';
|
||||||
|
|||||||
@ -2,8 +2,8 @@ import { useForm } from 'react-hook-form';
|
|||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { Trash2 } from 'lucide-react';
|
import { Trash2 } from 'lucide-react';
|
||||||
import type { SupplierCreate } from '@/api/generated/model/supplierCreate';
|
import type { ReqCreateSupplier as SupplierCreate } from '@/api/generated/model/reqCreateSupplier';
|
||||||
import type { SupplierUpdate } from '@/api/generated/model/supplierUpdate';
|
import type { ReqUpdateSupplier as SupplierUpdate } from '@/api/generated/model/reqUpdateSupplier';
|
||||||
import { showToast } from '@/lib/notify';
|
import { showToast } from '@/lib/notify';
|
||||||
import { Typography } from '@/components/ui/typography';
|
import { Typography } from '@/components/ui/typography';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
|||||||
@ -6,9 +6,8 @@ import {
|
|||||||
deleteSupplier,
|
deleteSupplier,
|
||||||
getListSuppliersQueryKey,
|
getListSuppliersQueryKey,
|
||||||
} from '@/api/generated/supplier/supplier';
|
} from '@/api/generated/supplier/supplier';
|
||||||
import type { SupplierResponse } from '@/api/generated/model/supplierResponse';
|
import type { ReqCreateSupplier } from '@/api/generated/model/reqCreateSupplier';
|
||||||
import type { SupplierCreate } from '@/api/generated/model/supplierCreate';
|
import type { ReqUpdateSupplier } from '@/api/generated/model/reqUpdateSupplier';
|
||||||
import type { SupplierUpdate } from '@/api/generated/model/supplierUpdate';
|
|
||||||
import type { Partner } from '../types';
|
import type { Partner } from '../types';
|
||||||
|
|
||||||
const LIST_PARAMS = { size: 100 };
|
const LIST_PARAMS = { size: 100 };
|
||||||
@ -22,11 +21,11 @@ export function usePartners() {
|
|||||||
const refresh = () =>
|
const refresh = () =>
|
||||||
queryClient.invalidateQueries({ queryKey: getListSuppliersQueryKey(LIST_PARAMS) });
|
queryClient.invalidateQueries({ queryKey: getListSuppliersQueryKey(LIST_PARAMS) });
|
||||||
|
|
||||||
const createPartner = async (data: SupplierCreate) => {
|
const createPartner = async (data: ReqCreateSupplier) => {
|
||||||
await createSupplier(data);
|
await createSupplier(data);
|
||||||
await refresh();
|
await refresh();
|
||||||
};
|
};
|
||||||
const updatePartner = async (supplierId: string, data: SupplierUpdate) => {
|
const updatePartner = async (supplierId: string, data: ReqUpdateSupplier) => {
|
||||||
await updateSupplier(supplierId, data);
|
await updateSupplier(supplierId, data);
|
||||||
await refresh();
|
await refresh();
|
||||||
};
|
};
|
||||||
@ -35,17 +34,16 @@ export function usePartners() {
|
|||||||
await refresh();
|
await refresh();
|
||||||
};
|
};
|
||||||
// 엑셀 일괄 등록 — 검증된 행들을 순차 생성 후 한 번만 재조회.
|
// 엑셀 일괄 등록 — 검증된 행들을 순차 생성 후 한 번만 재조회.
|
||||||
const bulkCreate = async (rows: SupplierCreate[]) => {
|
const bulkCreate = async (rows: ReqCreateSupplier[]) => {
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
await createSupplier(row);
|
await createSupplier(row);
|
||||||
}
|
}
|
||||||
await refresh();
|
await refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 서버 SupplierResponse → UI Partner (그대로 + id 별칭만)
|
// 서버 SupplierData → UI Partner (그대로 + id 별칭만).
|
||||||
const suppliers =
|
// customFetch 가 본문을 그대로 주므로 suppliersQuery.data 가 곧 ResSupplierList → .suppliers.
|
||||||
(suppliersQuery.data as { data?: { data?: { suppliers?: SupplierResponse[] } } } | undefined)
|
const suppliers = suppliersQuery.data?.suppliers ?? [];
|
||||||
?.data?.data?.suppliers ?? [];
|
|
||||||
const partners: Partner[] = suppliers.map((sp) => ({ ...sp, id: sp.supplier_id }));
|
const partners: Partner[] = suppliers.map((sp) => ({ ...sp, id: sp.supplier_id }));
|
||||||
|
|
||||||
return { partners, createPartner, updatePartner, deletePartner, bulkCreate, refresh, suppliersQuery };
|
return { partners, createPartner, updatePartner, deletePartner, bulkCreate, refresh, suppliersQuery };
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import type { SupplierResponse } from '@/api/generated/model/supplierResponse';
|
import type { SupplierData } from '@/api/generated/model/supplierData';
|
||||||
|
|
||||||
// UI에서 쓰는 협력사 타입. 서버 SupplierResponse에 화면 전용 파생 필드만 얹는다.
|
// UI에서 쓰는 협력사 타입. 서버 SupplierData에 화면 전용 파생 필드만 얹는다.
|
||||||
// (level/rank/status 등 서버 미연동 가짜 필드는 두지 않는다 — 표시 가능한 건 priority뿐.)
|
// (level/rank/status 등 서버 미연동 가짜 필드는 두지 않는다 — 표시 가능한 건 priority뿐.)
|
||||||
export type Partner = SupplierResponse & {
|
export type Partner = SupplierData & {
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
id?: string;
|
id?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { useMemo, useRef, useState } from 'react';
|
import { useMemo, useRef, useState } from 'react';
|
||||||
import { Upload, X, FileSpreadsheet, CheckCircle2, Download } from 'lucide-react';
|
import { Upload, X, FileSpreadsheet, CheckCircle2, Download } from 'lucide-react';
|
||||||
import type { ItemCreate } from '@/api/generated/model/itemCreate';
|
import type { ReqCreateItem as ItemCreate } from '@/api/generated/model/reqCreateItem';
|
||||||
import { showToast } from '@/lib/notify';
|
import { showToast } from '@/lib/notify';
|
||||||
import { downloadExcel, parseCsv } from '@/lib/excel';
|
import { downloadExcel, parseCsv } from '@/lib/excel';
|
||||||
import { Typography } from '@/components/ui/typography';
|
import { Typography } from '@/components/ui/typography';
|
||||||
@ -62,7 +62,7 @@ function toItemCreate(row: RawRow): ItemCreate {
|
|||||||
manufacturer: '벌크 대리 수급처',
|
manufacturer: '벌크 대리 수급처',
|
||||||
made_in: '미지정',
|
made_in: '미지정',
|
||||||
quantity_unit: 'EA',
|
quantity_unit: 'EA',
|
||||||
delivery_type: '벌크 대중 물류',
|
delivery_type: 1, // 협력사배송 (delivery_type 코드)
|
||||||
moq: '10 EA',
|
moq: '10 EA',
|
||||||
lead_time: 14,
|
lead_time: 14,
|
||||||
vat_yn: true,
|
vat_yn: true,
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import { useForm, Controller } from 'react-hook-form';
|
import { useForm, Controller } from 'react-hook-form';
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import type { ItemCreate } from '@/api/generated/model/itemCreate';
|
import type { ReqCreateItem as ItemCreate } from '@/api/generated/model/reqCreateItem';
|
||||||
import type { ItemUpdate } from '@/api/generated/model/itemUpdate';
|
import type { ReqUpdateItem as ItemUpdate } from '@/api/generated/model/reqUpdateItem';
|
||||||
|
import { useListEnums } from '@/api/generated/enums/enums';
|
||||||
import { showToast } from '@/lib/notify';
|
import { showToast } from '@/lib/notify';
|
||||||
import ImageDropzone from '@/components/ImageDropzone';
|
import ImageDropzone from '@/components/ImageDropzone';
|
||||||
import { Typography } from '@/components/ui/typography';
|
import { Typography } from '@/components/ui/typography';
|
||||||
@ -23,7 +24,7 @@ const schema = z.object({
|
|||||||
manufacturer: z.string(),
|
manufacturer: z.string(),
|
||||||
origin: z.string(),
|
origin: z.string(),
|
||||||
unit: z.string(),
|
unit: z.string(),
|
||||||
shippingType: z.string(),
|
shippingType: z.number({ message: '배송 형태를 선택해 주십시오.' }), // delivery_type 코드
|
||||||
imageUrl: z.string(),
|
imageUrl: z.string(),
|
||||||
moq: z.string(),
|
moq: z.string(),
|
||||||
leadTime: z.number({ message: '숫자를 입력해 주십시오.' }).min(0),
|
leadTime: z.number({ message: '숫자를 입력해 주십시오.' }).min(0),
|
||||||
@ -58,7 +59,7 @@ function buildDefaults(mode: 'create' | 'edit', product: Product | null): FormVa
|
|||||||
manufacturer: product.manufacturer || '',
|
manufacturer: product.manufacturer || '',
|
||||||
origin: product.made_in || '',
|
origin: product.made_in || '',
|
||||||
unit: product.quantity_unit || 'EA',
|
unit: product.quantity_unit || 'EA',
|
||||||
shippingType: product.delivery_type || '벌크 물류 배송',
|
shippingType: product.delivery_type ?? 1,
|
||||||
imageUrl: product.image_url || '',
|
imageUrl: product.image_url || '',
|
||||||
moq: product.moq || '10 EA',
|
moq: product.moq || '10 EA',
|
||||||
leadTime: product.lead_time || 14,
|
leadTime: product.lead_time || 14,
|
||||||
@ -78,7 +79,7 @@ function buildDefaults(mode: 'create' | 'edit', product: Product | null): FormVa
|
|||||||
manufacturer: '',
|
manufacturer: '',
|
||||||
origin: '대한민국',
|
origin: '대한민국',
|
||||||
unit: 'EA',
|
unit: 'EA',
|
||||||
shippingType: '벌크 물류 배송',
|
shippingType: 1,
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
moq: '10 EA',
|
moq: '10 EA',
|
||||||
leadTime: 14,
|
leadTime: 14,
|
||||||
@ -112,6 +113,10 @@ export function ProductFormSheet({
|
|||||||
defaultValues: buildDefaults(mode, product),
|
defaultValues: buildDefaults(mode, product),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 배송 형태 코드(delivery_type) 선택지는 서버 enum 에서 가져온다.
|
||||||
|
const { data: enumsData } = useListEnums();
|
||||||
|
const deliveryTypes = enumsData?.enums?.delivery_type ?? [];
|
||||||
|
|
||||||
// minPrice는 화면 전용(서버 미전송). 검증된 값만 payload로.
|
// minPrice는 화면 전용(서버 미전송). 검증된 값만 payload로.
|
||||||
const onValid = async (v: FormValues) => {
|
const onValid = async (v: FormValues) => {
|
||||||
const common = {
|
const common = {
|
||||||
@ -307,14 +312,26 @@ export function ProductFormSheet({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Shipping Type */}
|
{/* Shipping Type — 서버 enum(delivery_type) 코드 전송 */}
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<Typography as="label" variant="label">배송 형태</Typography>
|
<Typography as="label" variant="label">배송 형태</Typography>
|
||||||
<Input
|
<Controller
|
||||||
type="text"
|
control={control}
|
||||||
{...register('shippingType')}
|
name="shippingType"
|
||||||
placeholder="예: 벌크 물류 배송, 특수 안전 수송..."
|
render={({ field }) => (
|
||||||
|
<select
|
||||||
|
id="form-product-delivery-type"
|
||||||
|
className={`${inputClass} cursor-pointer`}
|
||||||
|
value={field.value}
|
||||||
|
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||||
|
>
|
||||||
|
{deliveryTypes.map((d) => (
|
||||||
|
<option key={d.value} value={d.value}>{d.label}</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
|
{errors.shippingType && <p className="text-[10px] text-rose-500">{errors.shippingType.message}</p>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* DB Schema Booleans (vat_yn, delivery_fee_yn) using Switches */}
|
{/* DB Schema Booleans (vat_yn, delivery_fee_yn) using Switches */}
|
||||||
|
|||||||
@ -6,9 +6,8 @@ import {
|
|||||||
deleteItem,
|
deleteItem,
|
||||||
getListItemsQueryKey,
|
getListItemsQueryKey,
|
||||||
} from '@/api/generated/item/item';
|
} from '@/api/generated/item/item';
|
||||||
import type { ItemResponse } from '@/api/generated/model/itemResponse';
|
import type { ReqCreateItem } from '@/api/generated/model/reqCreateItem';
|
||||||
import type { ItemCreate } from '@/api/generated/model/itemCreate';
|
import type { ReqUpdateItem } from '@/api/generated/model/reqUpdateItem';
|
||||||
import type { ItemUpdate } from '@/api/generated/model/itemUpdate';
|
|
||||||
import { type Product, toMinPrice } from '../types';
|
import { type Product, toMinPrice } from '../types';
|
||||||
|
|
||||||
const LIST_PARAMS = { size: 100 };
|
const LIST_PARAMS = { size: 100 };
|
||||||
@ -22,11 +21,11 @@ export function useProducts() {
|
|||||||
const refresh = () =>
|
const refresh = () =>
|
||||||
queryClient.invalidateQueries({ queryKey: getListItemsQueryKey(LIST_PARAMS) });
|
queryClient.invalidateQueries({ queryKey: getListItemsQueryKey(LIST_PARAMS) });
|
||||||
|
|
||||||
const createProduct = async (data: ItemCreate) => {
|
const createProduct = async (data: ReqCreateItem) => {
|
||||||
await createItem(data);
|
await createItem(data);
|
||||||
await refresh();
|
await refresh();
|
||||||
};
|
};
|
||||||
const updateProduct = async (itemId: string, data: ItemUpdate) => {
|
const updateProduct = async (itemId: string, data: ReqUpdateItem) => {
|
||||||
await updateItem(itemId, data);
|
await updateItem(itemId, data);
|
||||||
await refresh();
|
await refresh();
|
||||||
};
|
};
|
||||||
@ -35,17 +34,16 @@ export function useProducts() {
|
|||||||
await refresh();
|
await refresh();
|
||||||
};
|
};
|
||||||
// 엑셀 일괄 등록 — 검증된 행들을 순차 생성 후 한 번만 재조회.
|
// 엑셀 일괄 등록 — 검증된 행들을 순차 생성 후 한 번만 재조회.
|
||||||
const bulkCreate = async (rows: ItemCreate[]) => {
|
const bulkCreate = async (rows: ReqCreateItem[]) => {
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
await createItem(row);
|
await createItem(row);
|
||||||
}
|
}
|
||||||
await refresh();
|
await refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 서버 ItemResponse → UI Product (화면 전용 파생 필드 부여)
|
// 서버 ItemData → UI Product (화면 전용 파생 필드 부여).
|
||||||
const items =
|
// customFetch 가 본문을 그대로 주므로 itemsQuery.data 가 곧 ResItemList → .items.
|
||||||
(itemsQuery.data as { data?: { data?: { items?: ItemResponse[] } } } | undefined)
|
const items = itemsQuery.data?.items ?? [];
|
||||||
?.data?.data?.items ?? [];
|
|
||||||
const products: Product[] = items.map((it) => ({
|
const products: Product[] = items.map((it) => ({
|
||||||
...it,
|
...it,
|
||||||
id: it.item_id,
|
id: it.item_id,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import type { ItemResponse } from '@/api/generated/model/itemResponse';
|
import type { ItemData } from '@/api/generated/model/itemData';
|
||||||
|
|
||||||
// UI에서 쓰는 상품 타입. 서버 ItemResponse에 화면 전용 파생 필드를 얹는다.
|
// UI에서 쓰는 상품 타입. 서버 ItemData에 화면 전용 파생 필드를 얹는다.
|
||||||
export type Product = ItemResponse & {
|
export type Product = ItemData & {
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
id?: string;
|
id?: string;
|
||||||
minPrice?: number;
|
minPrice?: number;
|
||||||
|
|||||||
@ -3,10 +3,10 @@ import { useListItems } from '@/api/generated/item/item';
|
|||||||
import { useListSuppliers } from '@/api/generated/supplier/supplier';
|
import { useListSuppliers } from '@/api/generated/supplier/supplier';
|
||||||
import { useListSettings } from '@/api/generated/quotation-setting/quotation-setting';
|
import { useListSettings } from '@/api/generated/quotation-setting/quotation-setting';
|
||||||
import { useListQuotations } from '@/api/generated/quotation/quotation';
|
import { useListQuotations } from '@/api/generated/quotation/quotation';
|
||||||
import type { ItemResponse } from '@/api/generated/model/itemResponse';
|
import type { ItemData } from '@/api/generated/model/itemData';
|
||||||
import type { SupplierResponse } from '@/api/generated/model/supplierResponse';
|
import type { SupplierData } from '@/api/generated/model/supplierData';
|
||||||
import type { QuotationSettingResponse } from '@/api/generated/model/quotationSettingResponse';
|
import type { QuotationSettingData } from '@/api/generated/model/quotationSettingData';
|
||||||
import type { QuotationResponse } from '@/api/generated/model/quotationResponse';
|
import type { QuotationData } from '@/api/generated/model/quotationData';
|
||||||
import { showToast } from '@/lib/notify';
|
import { showToast } from '@/lib/notify';
|
||||||
import type { Estimate, QuotationSetting, ChatSession, NegotiationCard, Product } from '@/types';
|
import type { Estimate, QuotationSetting, ChatSession, NegotiationCard, Product } from '@/types';
|
||||||
import { unwrap, mapItem, mapSupplier, mapSetting, mapQuotation } from '../types';
|
import { unwrap, mapItem, mapSupplier, mapSetting, mapQuotation } from '../types';
|
||||||
@ -36,18 +36,18 @@ export function useQuotations() {
|
|||||||
const settingsQuery = useListSettings();
|
const settingsQuery = useListSettings();
|
||||||
const quotationsQuery = useListQuotations(undefined);
|
const quotationsQuery = useListQuotations(undefined);
|
||||||
|
|
||||||
const products = (unwrap<{ items?: ItemResponse[] }>(itemsQuery.data)?.items ?? []).map(mapItem);
|
const products = (unwrap<{ items?: ItemData[] }>(itemsQuery.data)?.items ?? []).map(mapItem);
|
||||||
const partners = (unwrap<{ suppliers?: SupplierResponse[] }>(suppliersQuery.data)?.suppliers ?? []).map(mapSupplier);
|
const partners = (unwrap<{ suppliers?: SupplierData[] }>(suppliersQuery.data)?.suppliers ?? []).map(mapSupplier);
|
||||||
|
|
||||||
const [quotationSettings, setQuotationSettings] = useState<QuotationSetting[]>([]);
|
const [quotationSettings, setQuotationSettings] = useState<QuotationSetting[]>([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const s = unwrap<{ settings?: QuotationSettingResponse[] }>(settingsQuery.data)?.settings;
|
const s = unwrap<{ settings?: QuotationSettingData[] }>(settingsQuery.data)?.settings;
|
||||||
if (s) setQuotationSettings(s.map(mapSetting));
|
if (s) setQuotationSettings(s.map(mapSetting));
|
||||||
}, [settingsQuery.data]);
|
}, [settingsQuery.data]);
|
||||||
|
|
||||||
const [quotations, setQuotations] = useState<Estimate[]>([]);
|
const [quotations, setQuotations] = useState<Estimate[]>([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const qs = unwrap<{ quotations?: QuotationResponse[] }>(quotationsQuery.data)?.quotations;
|
const qs = unwrap<{ quotations?: QuotationData[] }>(quotationsQuery.data)?.quotations;
|
||||||
if (qs) setQuotations(qs.map(mapQuotation));
|
if (qs) setQuotations(qs.map(mapQuotation));
|
||||||
}, [quotationsQuery.data]);
|
}, [quotationsQuery.data]);
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import type { ItemResponse } from '@/api/generated/model/itemResponse';
|
import type { ItemData } from '@/api/generated/model/itemData';
|
||||||
import type { SupplierResponse } from '@/api/generated/model/supplierResponse';
|
import type { SupplierData } from '@/api/generated/model/supplierData';
|
||||||
import type { QuotationSettingResponse } from '@/api/generated/model/quotationSettingResponse';
|
import type { QuotationSettingData } from '@/api/generated/model/quotationSettingData';
|
||||||
import type { QuotationResponse } from '@/api/generated/model/quotationResponse';
|
import type { QuotationData } from '@/api/generated/model/quotationData';
|
||||||
import type {
|
import type {
|
||||||
Product,
|
Product,
|
||||||
Partner,
|
Partner,
|
||||||
@ -15,16 +15,16 @@ export type { Product, Partner, QuotationSetting, Estimate, ChatSession, Negotia
|
|||||||
|
|
||||||
// ── 서버 응답 → UI 모델 매퍼 ─────────────────────────────────────────────
|
// ── 서버 응답 → UI 모델 매퍼 ─────────────────────────────────────────────
|
||||||
|
|
||||||
// BaseRestApiResponse 봉투에서 내부 payload만 꺼낸다.
|
// customFetch 가 응답 본문을 그대로 반환하므로 query.data 가 곧 봉투(ResXxxList) — 추가 언랩 불필요.
|
||||||
export function unwrap<T>(env: unknown): T | undefined {
|
export function unwrap<T>(env: unknown): T | undefined {
|
||||||
return (env as { data?: { data?: T | null } } | undefined)?.data?.data ?? undefined;
|
return (env as T | undefined) ?? undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapItem(it: ItemResponse): Product {
|
export function mapItem(it: ItemData): Product {
|
||||||
return { ...it, id: it.item_id, minPrice: Math.round((it.price || 0) * 0.83), status: 'ACTIVE' };
|
return { ...it, id: it.item_id, minPrice: Math.round((it.price || 0) * 0.83), status: 'ACTIVE' } as Product;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapSupplier(sp: SupplierResponse): Partner {
|
export function mapSupplier(sp: SupplierData): Partner {
|
||||||
return {
|
return {
|
||||||
supplier_id: sp.supplier_id,
|
supplier_id: sp.supplier_id,
|
||||||
company_id: sp.company_id,
|
company_id: sp.company_id,
|
||||||
@ -33,8 +33,8 @@ export function mapSupplier(sp: SupplierResponse): Partner {
|
|||||||
manager_name: sp.manager_name ?? null,
|
manager_name: sp.manager_name ?? null,
|
||||||
manager_email: sp.manager_email ?? null,
|
manager_email: sp.manager_email ?? null,
|
||||||
priority: sp.priority ?? null,
|
priority: sp.priority ?? null,
|
||||||
created_at: sp.created_at,
|
created_at: sp.created_at ?? undefined,
|
||||||
updated_at: sp.updated_at,
|
updated_at: sp.updated_at ?? undefined,
|
||||||
id: sp.supplier_id,
|
id: sp.supplier_id,
|
||||||
managerName: sp.manager_name || '',
|
managerName: sp.manager_name || '',
|
||||||
managerEmail: sp.manager_email || '',
|
managerEmail: sp.manager_email || '',
|
||||||
@ -44,22 +44,22 @@ export function mapSupplier(sp: SupplierResponse): Partner {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapSetting(s: QuotationSettingResponse): QuotationSetting {
|
export function mapSetting(s: QuotationSettingData): QuotationSetting {
|
||||||
return {
|
return {
|
||||||
qt_setting_id: s.qt_setting_id,
|
qt_setting_id: s.qt_setting_id,
|
||||||
user_id: s.user_id || '',
|
user_id: s.user_id || '',
|
||||||
target_margin: String(s.target_margin_rate ?? ''),
|
target_margin: String(s.target_margin_rate ?? ''),
|
||||||
anchoring_value: String(s.anchoring_value ?? ''),
|
anchoring_value: String(s.anchoring_value ?? ''),
|
||||||
card_use_count: String(s.card_count ?? ''),
|
card_use_count: String(s.card_count ?? ''),
|
||||||
created_at: s.created_at,
|
created_at: s.created_at ?? '',
|
||||||
updated_at: s.updated_at,
|
updated_at: s.updated_at ?? '',
|
||||||
deleted: false,
|
deleted: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapQuotation(q: QuotationResponse): Estimate {
|
export function mapQuotation(q: QuotationData): Estimate {
|
||||||
return {
|
return {
|
||||||
...(q as Partial<Estimate>),
|
...(q as unknown as Partial<Estimate>),
|
||||||
id: q.qt_id,
|
id: q.qt_id,
|
||||||
title: q.name,
|
title: q.name,
|
||||||
dueDate: q.end_time,
|
dueDate: q.end_time,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user