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