feat: adding services kit to deal

This commit is contained in:
2025-09-16 18:13:35 +04:00
parent 553e76d610
commit d927da46df
5 changed files with 305 additions and 133 deletions

View File

@ -9,6 +9,7 @@ import {
import type { AxiosError } from "axios";
import { client as _heyApiClient } from "../client.gen";
import {
addKitToDeal,
addKitToDealProduct,
createBoard,
createDeal,
@ -54,9 +55,12 @@ import {
type Options,
} from "../sdk.gen";
import type {
AddKitToDealData,
AddKitToDealError,
AddKitToDealProductData,
AddKitToDealProductError,
AddKitToDealProductResponse,
AddKitToDealResponse,
CreateBoardData,
CreateBoardError,
CreateBoardResponse2,
@ -932,57 +936,6 @@ export const updateDealProductMutation = (
return mutationOptions;
};
export const addKitToDealProductQueryKey = (
options: Options<AddKitToDealProductData>
) => createQueryKey("addKitToDealProduct", options);
/**
* Add Kit To Deal Product
*/
export const addKitToDealProductOptions = (
options: Options<AddKitToDealProductData>
) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await addKitToDealProduct({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: addKitToDealProductQueryKey(options),
});
};
/**
* Add Kit To Deal Product
*/
export const addKitToDealProductMutation = (
options?: Partial<Options<AddKitToDealProductData>>
): UseMutationOptions<
AddKitToDealProductResponse,
AxiosError<AddKitToDealProductError>,
Options<AddKitToDealProductData>
> => {
const mutationOptions: UseMutationOptions<
AddKitToDealProductResponse,
AxiosError<AddKitToDealProductError>,
Options<AddKitToDealProductData>
> = {
mutationFn: async localOptions => {
const { data } = await addKitToDealProduct({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const createDealProductServiceQueryKey = (
options: Options<CreateDealProductServiceData>
) => createQueryKey("createDealProductService", options);
@ -1139,6 +1092,57 @@ export const duplicateProductServicesMutation = (
return mutationOptions;
};
export const addKitToDealProductQueryKey = (
options: Options<AddKitToDealProductData>
) => createQueryKey("addKitToDealProduct", options);
/**
* Add Kit To Deal Product
*/
export const addKitToDealProductOptions = (
options: Options<AddKitToDealProductData>
) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await addKitToDealProduct({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: addKitToDealProductQueryKey(options),
});
};
/**
* Add Kit To Deal Product
*/
export const addKitToDealProductMutation = (
options?: Partial<Options<AddKitToDealProductData>>
): UseMutationOptions<
AddKitToDealProductResponse,
AxiosError<AddKitToDealProductError>,
Options<AddKitToDealProductData>
> => {
const mutationOptions: UseMutationOptions<
AddKitToDealProductResponse,
AxiosError<AddKitToDealProductError>,
Options<AddKitToDealProductData>
> = {
mutationFn: async localOptions => {
const { data } = await addKitToDealProduct({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getDealServicesQueryKey = (
options: Options<GetDealServicesData>
) => createQueryKey("getDealServices", options);
@ -1268,6 +1272,54 @@ export const updateDealServiceMutation = (
return mutationOptions;
};
export const addKitToDealQueryKey = (options: Options<AddKitToDealData>) =>
createQueryKey("addKitToDeal", options);
/**
* Add Kit To Deal Product
*/
export const addKitToDealOptions = (options: Options<AddKitToDealData>) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await addKitToDeal({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: addKitToDealQueryKey(options),
});
};
/**
* Add Kit To Deal Product
*/
export const addKitToDealMutation = (
options?: Partial<Options<AddKitToDealData>>
): UseMutationOptions<
AddKitToDealResponse,
AxiosError<AddKitToDealError>,
Options<AddKitToDealData>
> => {
const mutationOptions: UseMutationOptions<
AddKitToDealResponse,
AxiosError<AddKitToDealError>,
Options<AddKitToDealData>
> = {
mutationFn: async localOptions => {
const { data } = await addKitToDeal({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getProductsQueryKey = (options?: Options<GetProductsData>) =>
createQueryKey("getProducts", options);