feat: deal barcodes printing, refactored ff module

This commit is contained in:
2025-11-01 14:15:11 +04:00
parent 4370684c58
commit 69bf7848e1
15 changed files with 458 additions and 228 deletions

View File

@ -61,6 +61,7 @@ import {
getBaseMarketplaces,
getBoards,
getClients,
getDealBarcodesPdf,
getDealModuleAttributes,
getDealProducts,
getDeals,
@ -240,6 +241,9 @@ import type {
GetBaseMarketplacesData,
GetBoardsData,
GetClientsData,
GetDealBarcodesPdfData,
GetDealBarcodesPdfError,
GetDealBarcodesPdfResponse2,
GetDealModuleAttributesData,
GetDealProductsData,
GetDealsData,
@ -2902,6 +2906,57 @@ export const getProductBarcodePdfMutation = (
return mutationOptions;
};
export const getDealBarcodesPdfQueryKey = (
options: Options<GetDealBarcodesPdfData>
) => createQueryKey("getDealBarcodesPdf", options);
/**
* Get Deal Barcodes Pdf
*/
export const getDealBarcodesPdfOptions = (
options: Options<GetDealBarcodesPdfData>
) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await getDealBarcodesPdf({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: getDealBarcodesPdfQueryKey(options),
});
};
/**
* Get Deal Barcodes Pdf
*/
export const getDealBarcodesPdfMutation = (
options?: Partial<Options<GetDealBarcodesPdfData>>
): UseMutationOptions<
GetDealBarcodesPdfResponse2,
AxiosError<GetDealBarcodesPdfError>,
Options<GetDealBarcodesPdfData>
> => {
const mutationOptions: UseMutationOptions<
GetDealBarcodesPdfResponse2,
AxiosError<GetDealBarcodesPdfError>,
Options<GetDealBarcodesPdfData>
> = {
mutationFn: async localOptions => {
const { data } = await getDealBarcodesPdf({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const uploadProductBarcodeImageQueryKey = (
options: Options<UploadProductBarcodeImageData>
) => createQueryKey("uploadProductBarcodeImage", options);