[feat] negodata/front: 협상대화 카드내용 렌더 + 견적상세 헤더·테이블 UI 정리
- 협상대화: 사용 카드 번호/멘트(Slate 서식본)/와일드 조건·메모 표시, SlateRenderer
밑줄·헥스색·{변수} 치환 보정, 말풍선 우측정렬·발신자 아바타 제거
- 견적상세 헤더: DB 컬럼명 라벨 제거, 견적정보/(진행상태+세팅)/상품(이미지) 2열 재배치,
협상카드 탭에 사용 카드 수 표시
- DataTable 행 패딩 축소, 협력사명 아바타 제거, 카드관리 본인 카드 안내문
- orval 재생성(QuotationCardData 신규 필드)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
df68609c49
commit
7186446068
114 files changed
+4731
-5537
No files matched your search
@@ -4,7 +4,10 @@
|
||||
* Negodata Api Server
|
||||
* OpenAPI spec version: 0.1.0
|
||||
*/
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
useMutation,
|
||||
useQuery
|
||||
} from '@tanstack/react-query';
|
||||
import type {
|
||||
DataTag,
|
||||
DefinedInitialDataOptions,
|
||||
@@ -17,8 +20,8 @@ import type {
|
||||
UseMutationOptions,
|
||||
UseMutationResult,
|
||||
UseQueryOptions,
|
||||
UseQueryResult,
|
||||
} from "@tanstack/react-query";
|
||||
UseQueryResult
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
import type {
|
||||
HTTPValidationError,
|
||||
@@ -27,525 +30,388 @@ import type {
|
||||
ReqUpdateCard,
|
||||
ResCard,
|
||||
ResCardList,
|
||||
ResDeleteCard,
|
||||
} from ".././model";
|
||||
ResDeleteCard
|
||||
} from '.././model';
|
||||
|
||||
import { customFetch } from '../../mutator/custom-fetch';
|
||||
|
||||
|
||||
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
||||
|
||||
|
||||
import { customFetch } from "../../mutator/custom-fetch";
|
||||
|
||||
/**
|
||||
* @summary 협상카드 목록
|
||||
*/
|
||||
export const listCards = (params?: ListCardsParams, signal?: AbortSignal) => {
|
||||
return customFetch<ResCardList>({
|
||||
url: `/v1/card/list`,
|
||||
method: "GET",
|
||||
params,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getListCardsQueryKey = (params?: ListCardsParams) => {
|
||||
return [`/v1/card/list`, ...(params ? [params] : [])] as const;
|
||||
};
|
||||
|
||||
export const getListCardsQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof listCards>>,
|
||||
TError = void | HTTPValidationError,
|
||||
>(
|
||||
params?: ListCardsParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData>
|
||||
>;
|
||||
},
|
||||
export const listCards = (
|
||||
params?: ListCardsParams,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
|
||||
return customFetch<ResCardList>(
|
||||
{url: `/v1/card/list`, method: 'GET',
|
||||
params, signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getListCardsQueryKey(params);
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof listCards>>> = ({
|
||||
signal,
|
||||
}) => listCards(params, signal);
|
||||
|
||||
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listCards>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
};
|
||||
export const getListCardsQueryKey = (params?: ListCardsParams,) => {
|
||||
return [
|
||||
`/v1/card/list`, ...(params ? [params]: [])
|
||||
] as const;
|
||||
}
|
||||
|
||||
export type ListCardsQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listCards>>
|
||||
>;
|
||||
export type ListCardsQueryError = void | HTTPValidationError;
|
||||
|
||||
export const getListCardsQueryOptions = <TData = Awaited<ReturnType<typeof listCards>>, TError = void | HTTPValidationError>(params?: ListCardsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
) => {
|
||||
|
||||
export function useListCards<
|
||||
TData = Awaited<ReturnType<typeof listCards>>,
|
||||
TError = void | HTTPValidationError,
|
||||
>(
|
||||
params: undefined | ListCardsParams,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData>
|
||||
> &
|
||||
Pick<
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getListCardsQueryKey(params);
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof listCards>>> = ({ signal }) => listCards(params, requestOptions, signal);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type ListCardsQueryResult = NonNullable<Awaited<ReturnType<typeof listCards>>>
|
||||
export type ListCardsQueryError = void | HTTPValidationError
|
||||
|
||||
|
||||
export function useListCards<TData = Awaited<ReturnType<typeof listCards>>, TError = void | HTTPValidationError>(
|
||||
params: undefined | ListCardsParams, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof listCards>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof listCards>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useListCards<
|
||||
TData = Awaited<ReturnType<typeof listCards>>,
|
||||
TError = void | HTTPValidationError,
|
||||
>(
|
||||
params?: ListCardsParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData>
|
||||
> &
|
||||
Pick<
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useListCards<TData = Awaited<ReturnType<typeof listCards>>, TError = void | HTTPValidationError>(
|
||||
params?: ListCardsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof listCards>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof listCards>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useListCards<
|
||||
TData = Awaited<ReturnType<typeof listCards>>,
|
||||
TError = void | HTTPValidationError,
|
||||
>(
|
||||
params?: ListCardsParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData>
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useListCards<TData = Awaited<ReturnType<typeof listCards>>, TError = void | HTTPValidationError>(
|
||||
params?: ListCardsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary 협상카드 목록
|
||||
*/
|
||||
|
||||
export function useListCards<
|
||||
TData = Awaited<ReturnType<typeof listCards>>,
|
||||
TError = void | HTTPValidationError,
|
||||
>(
|
||||
params?: ListCardsParams,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData>
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions = getListCardsQueryOptions(params, options);
|
||||
export function useListCards<TData = Awaited<ReturnType<typeof listCards>>, TError = void | HTTPValidationError>(
|
||||
params?: ListCardsParams, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof listCards>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
const queryOptions = getListCardsQueryOptions(params,options)
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey ;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @summary 협상카드 등록
|
||||
*/
|
||||
export const createCard = (
|
||||
reqCreateCard: ReqCreateCard,
|
||||
signal?: AbortSignal,
|
||||
reqCreateCard: ReqCreateCard,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
return customFetch<ResCard>({
|
||||
url: `/v1/card/create`,
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
data: reqCreateCard,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
return customFetch<ResCard>(
|
||||
{url: `/v1/card/create`, method: 'POST',
|
||||
headers: {'Content-Type': 'application/json', },
|
||||
data: reqCreateCard, signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
export const getCreateCardMutationOptions = <
|
||||
TError = void | HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createCard>>,
|
||||
TError,
|
||||
{ data: ReqCreateCard },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createCard>>,
|
||||
TError,
|
||||
{ data: ReqCreateCard },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ["createCard"];
|
||||
const { mutation: mutationOptions } = options
|
||||
? options.mutation &&
|
||||
"mutationKey" in options.mutation &&
|
||||
options.mutation.mutationKey
|
||||
? options
|
||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||
: { mutation: { mutationKey } };
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof createCard>>,
|
||||
{ data: ReqCreateCard }
|
||||
> = (props) => {
|
||||
const { data } = props ?? {};
|
||||
export const getCreateCardMutationOptions = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createCard>>, TError,{data: ReqCreateCard}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof createCard>>, TError,{data: ReqCreateCard}, TContext> => {
|
||||
|
||||
return createCard(data);
|
||||
};
|
||||
const mutationKey = ['createCard'];
|
||||
const {mutation: mutationOptions, request: requestOptions} = options ?
|
||||
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
||||
options
|
||||
: {...options, mutation: {...options.mutation, mutationKey}}
|
||||
: {mutation: { mutationKey, }, request: undefined};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
|
||||
export type CreateCardMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof createCard>>
|
||||
>;
|
||||
export type CreateCardMutationBody = ReqCreateCard;
|
||||
export type CreateCardMutationError = void | HTTPValidationError;
|
||||
|
||||
/**
|
||||
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createCard>>, {data: ReqCreateCard}> = (props) => {
|
||||
const {data} = props ?? {};
|
||||
|
||||
return createCard(data,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type CreateCardMutationResult = NonNullable<Awaited<ReturnType<typeof createCard>>>
|
||||
export type CreateCardMutationBody = ReqCreateCard
|
||||
export type CreateCardMutationError = void | HTTPValidationError
|
||||
|
||||
/**
|
||||
* @summary 협상카드 등록
|
||||
*/
|
||||
export const useCreateCard = <
|
||||
TError = void | HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof createCard>>,
|
||||
TError,
|
||||
{ data: ReqCreateCard },
|
||||
TContext
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createCard>>,
|
||||
TError,
|
||||
{ data: ReqCreateCard },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getCreateCardMutationOptions(options);
|
||||
export const useCreateCard = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createCard>>, TError,{data: ReqCreateCard}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof createCard>>,
|
||||
TError,
|
||||
{data: ReqCreateCard},
|
||||
TContext
|
||||
> => {
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
};
|
||||
/**
|
||||
const mutationOptions = getCreateCardMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
}
|
||||
/**
|
||||
* @summary 협상카드 조회
|
||||
*/
|
||||
export const getCard = (cardId: string, signal?: AbortSignal) => {
|
||||
return customFetch<ResCard>({
|
||||
url: `/v1/card/${cardId}`,
|
||||
method: "GET",
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetCardQueryKey = (cardId?: string) => {
|
||||
return [`/v1/card/${cardId}`] as const;
|
||||
};
|
||||
|
||||
export const getGetCardQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof getCard>>,
|
||||
TError = void | HTTPValidationError,
|
||||
>(
|
||||
cardId: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData>
|
||||
>;
|
||||
},
|
||||
export const getCard = (
|
||||
cardId: string,
|
||||
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
|
||||
return customFetch<ResCard>(
|
||||
{url: `/v1/card/${cardId}`, method: 'GET', signal
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getGetCardQueryKey(cardId);
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getCard>>> = ({
|
||||
signal,
|
||||
}) => getCard(cardId, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: !!cardId,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
};
|
||||
export const getGetCardQueryKey = (cardId?: string,) => {
|
||||
return [
|
||||
`/v1/card/${cardId}`
|
||||
] as const;
|
||||
}
|
||||
|
||||
export type GetCardQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof getCard>>
|
||||
>;
|
||||
export type GetCardQueryError = void | HTTPValidationError;
|
||||
|
||||
export const getGetCardQueryOptions = <TData = Awaited<ReturnType<typeof getCard>>, TError = void | HTTPValidationError>(cardId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
) => {
|
||||
|
||||
export function useGetCard<
|
||||
TData = Awaited<ReturnType<typeof getCard>>,
|
||||
TError = void | HTTPValidationError,
|
||||
>(
|
||||
cardId: string,
|
||||
options: {
|
||||
query: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData>
|
||||
> &
|
||||
Pick<
|
||||
const {query: queryOptions, request: requestOptions} = options ?? {};
|
||||
|
||||
const queryKey = queryOptions?.queryKey ?? getGetCardQueryKey(cardId);
|
||||
|
||||
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getCard>>> = ({ signal }) => getCard(cardId, requestOptions, signal);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return { queryKey, queryFn, enabled: !!(cardId), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
}
|
||||
|
||||
export type GetCardQueryResult = NonNullable<Awaited<ReturnType<typeof getCard>>>
|
||||
export type GetCardQueryError = void | HTTPValidationError
|
||||
|
||||
|
||||
export function useGetCard<TData = Awaited<ReturnType<typeof getCard>>, TError = void | HTTPValidationError>(
|
||||
cardId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData>> & Pick<
|
||||
DefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getCard>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getCard>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): DefinedUseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useGetCard<
|
||||
TData = Awaited<ReturnType<typeof getCard>>,
|
||||
TError = void | HTTPValidationError,
|
||||
>(
|
||||
cardId: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData>
|
||||
> &
|
||||
Pick<
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetCard<TData = Awaited<ReturnType<typeof getCard>>, TError = void | HTTPValidationError>(
|
||||
cardId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData>> & Pick<
|
||||
UndefinedInitialDataOptions<
|
||||
Awaited<ReturnType<typeof getCard>>,
|
||||
TError,
|
||||
Awaited<ReturnType<typeof getCard>>
|
||||
>,
|
||||
"initialData"
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
export function useGetCard<
|
||||
TData = Awaited<ReturnType<typeof getCard>>,
|
||||
TError = void | HTTPValidationError,
|
||||
>(
|
||||
cardId: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData>
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
};
|
||||
> , 'initialData'
|
||||
>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
export function useGetCard<TData = Awaited<ReturnType<typeof getCard>>, TError = void | HTTPValidationError>(
|
||||
cardId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
|
||||
/**
|
||||
* @summary 협상카드 조회
|
||||
*/
|
||||
|
||||
export function useGetCard<
|
||||
TData = Awaited<ReturnType<typeof getCard>>,
|
||||
TError = void | HTTPValidationError,
|
||||
>(
|
||||
cardId: string,
|
||||
options?: {
|
||||
query?: Partial<
|
||||
UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData>
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseQueryResult<TData, TError> & {
|
||||
queryKey: DataTag<QueryKey, TData, TError>;
|
||||
} {
|
||||
const queryOptions = getGetCardQueryOptions(cardId, options);
|
||||
export function useGetCard<TData = Awaited<ReturnType<typeof getCard>>, TError = void | HTTPValidationError>(
|
||||
cardId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getCard>>, TError, TData>>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient
|
||||
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
||||
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<
|
||||
TData,
|
||||
TError
|
||||
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
const queryOptions = getGetCardQueryOptions(cardId,options)
|
||||
|
||||
query.queryKey = queryOptions.queryKey;
|
||||
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
||||
|
||||
query.queryKey = queryOptions.queryKey ;
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary 협상카드 수정
|
||||
*/
|
||||
export const updateCard = (cardId: string, reqUpdateCard: ReqUpdateCard) => {
|
||||
return customFetch<ResCard>({
|
||||
url: `/v1/card/update/${cardId}`,
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
data: reqUpdateCard,
|
||||
});
|
||||
};
|
||||
|
||||
export const getUpdateCardMutationOptions = <
|
||||
TError = void | HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateCard>>,
|
||||
TError,
|
||||
{ cardId: string; data: ReqUpdateCard },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateCard>>,
|
||||
TError,
|
||||
{ cardId: string; data: ReqUpdateCard },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ["updateCard"];
|
||||
const { mutation: mutationOptions } = options
|
||||
? options.mutation &&
|
||||
"mutationKey" in options.mutation &&
|
||||
options.mutation.mutationKey
|
||||
? options
|
||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||
: { mutation: { mutationKey } };
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof updateCard>>,
|
||||
{ cardId: string; data: ReqUpdateCard }
|
||||
> = (props) => {
|
||||
const { cardId, data } = props ?? {};
|
||||
|
||||
return updateCard(cardId, data);
|
||||
};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
export type UpdateCardMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof updateCard>>
|
||||
>;
|
||||
export type UpdateCardMutationBody = ReqUpdateCard;
|
||||
export type UpdateCardMutationError = void | HTTPValidationError;
|
||||
|
||||
/**
|
||||
* @summary 협상카드 수정
|
||||
*/
|
||||
export const useUpdateCard = <
|
||||
TError = void | HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof updateCard>>,
|
||||
TError,
|
||||
{ cardId: string; data: ReqUpdateCard },
|
||||
TContext
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<ReturnType<typeof updateCard>>,
|
||||
TError,
|
||||
{ cardId: string; data: ReqUpdateCard },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getUpdateCardMutationOptions(options);
|
||||
export const updateCard = (
|
||||
cardId: string,
|
||||
reqUpdateCard: ReqUpdateCard,
|
||||
options?: SecondParameter<typeof customFetch>,) => {
|
||||
|
||||
|
||||
return customFetch<ResCard>(
|
||||
{url: `/v1/card/update/${cardId}`, method: 'PATCH',
|
||||
headers: {'Content-Type': 'application/json', },
|
||||
data: reqUpdateCard
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
};
|
||||
/**
|
||||
|
||||
export const getUpdateCardMutationOptions = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateCard>>, TError,{cardId: string;data: ReqUpdateCard}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof updateCard>>, TError,{cardId: string;data: ReqUpdateCard}, TContext> => {
|
||||
|
||||
const mutationKey = ['updateCard'];
|
||||
const {mutation: mutationOptions, request: requestOptions} = options ?
|
||||
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
||||
options
|
||||
: {...options, mutation: {...options.mutation, mutationKey}}
|
||||
: {mutation: { mutationKey, }, request: undefined};
|
||||
|
||||
|
||||
|
||||
|
||||
const mutationFn: MutationFunction<Awaited<ReturnType<typeof updateCard>>, {cardId: string;data: ReqUpdateCard}> = (props) => {
|
||||
const {cardId,data} = props ?? {};
|
||||
|
||||
return updateCard(cardId,data,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type UpdateCardMutationResult = NonNullable<Awaited<ReturnType<typeof updateCard>>>
|
||||
export type UpdateCardMutationBody = ReqUpdateCard
|
||||
export type UpdateCardMutationError = void | HTTPValidationError
|
||||
|
||||
/**
|
||||
* @summary 협상카드 수정
|
||||
*/
|
||||
export const useUpdateCard = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof updateCard>>, TError,{cardId: string;data: ReqUpdateCard}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof updateCard>>,
|
||||
TError,
|
||||
{cardId: string;data: ReqUpdateCard},
|
||||
TContext
|
||||
> => {
|
||||
|
||||
const mutationOptions = getUpdateCardMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
}
|
||||
/**
|
||||
* @summary 협상카드 삭제
|
||||
*/
|
||||
export const deleteCard = (cardId: string) => {
|
||||
return customFetch<ResDeleteCard>({
|
||||
url: `/v1/card/delete/${cardId}`,
|
||||
method: "DELETE",
|
||||
});
|
||||
};
|
||||
export const deleteCard = (
|
||||
cardId: string,
|
||||
options?: SecondParameter<typeof customFetch>,) => {
|
||||
|
||||
|
||||
return customFetch<ResDeleteCard>(
|
||||
{url: `/v1/card/delete/${cardId}`, method: 'DELETE'
|
||||
},
|
||||
options);
|
||||
}
|
||||
|
||||
|
||||
export const getDeleteCardMutationOptions = <
|
||||
TError = void | HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof deleteCard>>,
|
||||
TError,
|
||||
{ cardId: string },
|
||||
TContext
|
||||
>;
|
||||
}): UseMutationOptions<
|
||||
Awaited<ReturnType<typeof deleteCard>>,
|
||||
TError,
|
||||
{ cardId: string },
|
||||
TContext
|
||||
> => {
|
||||
const mutationKey = ["deleteCard"];
|
||||
const { mutation: mutationOptions } = options
|
||||
? options.mutation &&
|
||||
"mutationKey" in options.mutation &&
|
||||
options.mutation.mutationKey
|
||||
? options
|
||||
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
||||
: { mutation: { mutationKey } };
|
||||
|
||||
const mutationFn: MutationFunction<
|
||||
Awaited<ReturnType<typeof deleteCard>>,
|
||||
{ cardId: string }
|
||||
> = (props) => {
|
||||
const { cardId } = props ?? {};
|
||||
export const getDeleteCardMutationOptions = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteCard>>, TError,{cardId: string}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
): UseMutationOptions<Awaited<ReturnType<typeof deleteCard>>, TError,{cardId: string}, TContext> => {
|
||||
|
||||
return deleteCard(cardId);
|
||||
};
|
||||
const mutationKey = ['deleteCard'];
|
||||
const {mutation: mutationOptions, request: requestOptions} = options ?
|
||||
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
||||
options
|
||||
: {...options, mutation: {...options.mutation, mutationKey}}
|
||||
: {mutation: { mutationKey, }, request: undefined};
|
||||
|
||||
return { mutationFn, ...mutationOptions };
|
||||
};
|
||||
|
||||
|
||||
export type DeleteCardMutationResult = NonNullable<
|
||||
Awaited<ReturnType<typeof deleteCard>>
|
||||
>;
|
||||
|
||||
export type DeleteCardMutationError = void | HTTPValidationError;
|
||||
const mutationFn: MutationFunction<Awaited<ReturnType<typeof deleteCard>>, {cardId: string}> = (props) => {
|
||||
const {cardId} = props ?? {};
|
||||
|
||||
/**
|
||||
return deleteCard(cardId,requestOptions)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return { mutationFn, ...mutationOptions }}
|
||||
|
||||
export type DeleteCardMutationResult = NonNullable<Awaited<ReturnType<typeof deleteCard>>>
|
||||
|
||||
export type DeleteCardMutationError = void | HTTPValidationError
|
||||
|
||||
/**
|
||||
* @summary 협상카드 삭제
|
||||
*/
|
||||
export const useDeleteCard = <
|
||||
TError = void | HTTPValidationError,
|
||||
TContext = unknown,
|
||||
>(
|
||||
options?: {
|
||||
mutation?: UseMutationOptions<
|
||||
Awaited<ReturnType<typeof deleteCard>>,
|
||||
TError,
|
||||
{ cardId: string },
|
||||
TContext
|
||||
>;
|
||||
},
|
||||
queryClient?: QueryClient,
|
||||
): UseMutationResult<
|
||||
Awaited<ReturnType<typeof deleteCard>>,
|
||||
TError,
|
||||
{ cardId: string },
|
||||
TContext
|
||||
> => {
|
||||
const mutationOptions = getDeleteCardMutationOptions(options);
|
||||
export const useDeleteCard = <TError = void | HTTPValidationError,
|
||||
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof deleteCard>>, TError,{cardId: string}, TContext>, request?: SecondParameter<typeof customFetch>}
|
||||
, queryClient?: QueryClient): UseMutationResult<
|
||||
Awaited<ReturnType<typeof deleteCard>>,
|
||||
TError,
|
||||
{cardId: string},
|
||||
TContext
|
||||
> => {
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
};
|
||||
const mutationOptions = getDeleteCardMutationOptions(options);
|
||||
|
||||
return useMutation(mutationOptions, queryClient);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user