feat: barcodes printing
This commit is contained in:
@ -47,6 +47,7 @@ import {
|
||||
getDealProducts,
|
||||
getDeals,
|
||||
getDealServices,
|
||||
getProductBarcodePdf,
|
||||
getProducts,
|
||||
getProjects,
|
||||
getServiceCategories,
|
||||
@ -168,6 +169,9 @@ import type {
|
||||
GetDealsError,
|
||||
GetDealServicesData,
|
||||
GetDealsResponse2,
|
||||
GetProductBarcodePdfData,
|
||||
GetProductBarcodePdfError,
|
||||
GetProductBarcodePdfResponse2,
|
||||
GetProductsData,
|
||||
GetProductsError,
|
||||
GetProductsResponse2,
|
||||
@ -1867,6 +1871,57 @@ export const updateProductMutation = (
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getProductBarcodePdfQueryKey = (
|
||||
options: Options<GetProductBarcodePdfData>
|
||||
) => createQueryKey("getProductBarcodePdf", options);
|
||||
|
||||
/**
|
||||
* Get Product Barcode Pdf
|
||||
*/
|
||||
export const getProductBarcodePdfOptions = (
|
||||
options: Options<GetProductBarcodePdfData>
|
||||
) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await getProductBarcodePdf({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getProductBarcodePdfQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Product Barcode Pdf
|
||||
*/
|
||||
export const getProductBarcodePdfMutation = (
|
||||
options?: Partial<Options<GetProductBarcodePdfData>>
|
||||
): UseMutationOptions<
|
||||
GetProductBarcodePdfResponse2,
|
||||
AxiosError<GetProductBarcodePdfError>,
|
||||
Options<GetProductBarcodePdfData>
|
||||
> => {
|
||||
const mutationOptions: UseMutationOptions<
|
||||
GetProductBarcodePdfResponse2,
|
||||
AxiosError<GetProductBarcodePdfError>,
|
||||
Options<GetProductBarcodePdfData>
|
||||
> = {
|
||||
mutationFn: async localOptions => {
|
||||
const { data } = await getProductBarcodePdf({
|
||||
...options,
|
||||
...localOptions,
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getServicesQueryKey = (options?: Options<GetServicesData>) =>
|
||||
createQueryKey("getServices", options);
|
||||
|
||||
|
||||
@ -113,6 +113,9 @@ import type {
|
||||
GetDealServicesErrors,
|
||||
GetDealServicesResponses,
|
||||
GetDealsResponses,
|
||||
GetProductBarcodePdfData,
|
||||
GetProductBarcodePdfErrors,
|
||||
GetProductBarcodePdfResponses,
|
||||
GetProductsData,
|
||||
GetProductsErrors,
|
||||
GetProductsResponses,
|
||||
@ -247,6 +250,8 @@ import {
|
||||
zGetDealServicesData,
|
||||
zGetDealServicesResponse2,
|
||||
zGetDealsResponse2,
|
||||
zGetProductBarcodePdfData,
|
||||
zGetProductBarcodePdfResponse2,
|
||||
zGetProductsData,
|
||||
zGetProductsResponse2,
|
||||
zGetProjectsData,
|
||||
@ -1458,6 +1463,33 @@ export const updateProduct = <ThrowOnError extends boolean = false>(
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Product Barcode Pdf
|
||||
*/
|
||||
export const getProductBarcodePdf = <ThrowOnError extends boolean = false>(
|
||||
options: Options<GetProductBarcodePdfData, ThrowOnError>
|
||||
) => {
|
||||
return (options.client ?? _heyApiClient).post<
|
||||
GetProductBarcodePdfResponses,
|
||||
GetProductBarcodePdfErrors,
|
||||
ThrowOnError
|
||||
>({
|
||||
requestValidator: async data => {
|
||||
return await zGetProductBarcodePdfData.parseAsync(data);
|
||||
},
|
||||
responseType: "json",
|
||||
responseValidator: async data => {
|
||||
return await zGetProductBarcodePdfResponse2.parseAsync(data);
|
||||
},
|
||||
url: "/modules/fulfillment-base/product/barcode/get-pdf",
|
||||
...options,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...options.headers,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Services
|
||||
*/
|
||||
|
||||
@ -1102,6 +1102,42 @@ export type GetDealsResponse = {
|
||||
paginationInfo: PaginationInfoSchema;
|
||||
};
|
||||
|
||||
/**
|
||||
* GetProductBarcodePdfRequest
|
||||
*/
|
||||
export type GetProductBarcodePdfRequest = {
|
||||
/**
|
||||
* Quantity
|
||||
*/
|
||||
quantity: number;
|
||||
/**
|
||||
* Productid
|
||||
*/
|
||||
productId: number;
|
||||
/**
|
||||
* Barcode
|
||||
*/
|
||||
barcode: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* GetProductBarcodePdfResponse
|
||||
*/
|
||||
export type GetProductBarcodePdfResponse = {
|
||||
/**
|
||||
* Base64String
|
||||
*/
|
||||
base64String: string;
|
||||
/**
|
||||
* Filename
|
||||
*/
|
||||
filename: string;
|
||||
/**
|
||||
* Mimetype
|
||||
*/
|
||||
mimeType: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* GetProductsResponse
|
||||
*/
|
||||
@ -3379,6 +3415,33 @@ export type UpdateProductResponses = {
|
||||
export type UpdateProductResponse2 =
|
||||
UpdateProductResponses[keyof UpdateProductResponses];
|
||||
|
||||
export type GetProductBarcodePdfData = {
|
||||
body: GetProductBarcodePdfRequest;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: "/modules/fulfillment-base/product/barcode/get-pdf";
|
||||
};
|
||||
|
||||
export type GetProductBarcodePdfErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type GetProductBarcodePdfError =
|
||||
GetProductBarcodePdfErrors[keyof GetProductBarcodePdfErrors];
|
||||
|
||||
export type GetProductBarcodePdfResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: GetProductBarcodePdfResponse;
|
||||
};
|
||||
|
||||
export type GetProductBarcodePdfResponse2 =
|
||||
GetProductBarcodePdfResponses[keyof GetProductBarcodePdfResponses];
|
||||
|
||||
export type GetServicesData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
|
||||
@ -767,6 +767,24 @@ export const zGetDealsResponse = z.object({
|
||||
paginationInfo: zPaginationInfoSchema,
|
||||
});
|
||||
|
||||
/**
|
||||
* GetProductBarcodePdfRequest
|
||||
*/
|
||||
export const zGetProductBarcodePdfRequest = z.object({
|
||||
quantity: z.int(),
|
||||
productId: z.int(),
|
||||
barcode: z.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* GetProductBarcodePdfResponse
|
||||
*/
|
||||
export const zGetProductBarcodePdfResponse = z.object({
|
||||
base64String: z.string(),
|
||||
filename: z.string(),
|
||||
mimeType: z.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* GetProductsResponse
|
||||
*/
|
||||
@ -1778,6 +1796,17 @@ export const zUpdateProductData = z.object({
|
||||
*/
|
||||
export const zUpdateProductResponse2 = zUpdateProductResponse;
|
||||
|
||||
export const zGetProductBarcodePdfData = z.object({
|
||||
body: zGetProductBarcodePdfRequest,
|
||||
path: z.optional(z.never()),
|
||||
query: z.optional(z.never()),
|
||||
});
|
||||
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
export const zGetProductBarcodePdfResponse2 = zGetProductBarcodePdfResponse;
|
||||
|
||||
export const zGetServicesData = z.object({
|
||||
body: z.optional(z.never()),
|
||||
path: z.optional(z.never()),
|
||||
|
||||
Reference in New Issue
Block a user