refactor: moved ProjectEditorDrawer into common drawers directory

This commit is contained in:
2025-10-18 13:06:37 +04:00
parent 159d6948c7
commit 9023b07c65
17 changed files with 786 additions and 12 deletions

View File

@ -26,6 +26,7 @@ import {
createServiceCategory,
createServicesKit,
createStatus,
createTag,
deleteBarcodeTemplate,
deleteBoard,
deleteClient,
@ -41,6 +42,7 @@ import {
deleteServiceCategory,
deleteServicesKit,
deleteStatus,
deleteTag,
duplicateProductServices,
getBarcodeTemplateAttributes,
getBarcodeTemplates,
@ -52,6 +54,7 @@ import {
getDealProducts,
getDeals,
getDealServices,
getDealTagColors,
getMarketplaces,
getProductBarcodePdf,
getProducts,
@ -61,6 +64,7 @@ import {
getServicesKits,
getStatuses,
getStatusHistory,
switchDealTag,
updateBarcodeTemplate,
updateBoard,
updateClient,
@ -77,6 +81,7 @@ import {
updateServiceCategory,
updateServicesKit,
updateStatus,
updateTag,
type Options,
} from "../sdk.gen";
import type {
@ -131,6 +136,9 @@ import type {
CreateStatusData,
CreateStatusError,
CreateStatusResponse2,
CreateTagData,
CreateTagError,
CreateTagResponse,
DeleteBarcodeTemplateData,
DeleteBarcodeTemplateError,
DeleteBarcodeTemplateResponse2,
@ -176,6 +184,9 @@ import type {
DeleteStatusData,
DeleteStatusError,
DeleteStatusResponse2,
DeleteTagData,
DeleteTagError,
DeleteTagResponse,
DuplicateProductServicesData,
DuplicateProductServicesError,
DuplicateProductServicesResponse,
@ -191,6 +202,7 @@ import type {
GetDealsError,
GetDealServicesData,
GetDealsResponse2,
GetDealTagColorsData,
GetMarketplacesData,
GetProductBarcodePdfData,
GetProductBarcodePdfError,
@ -204,6 +216,9 @@ import type {
GetServicesKitsData,
GetStatusesData,
GetStatusHistoryData,
SwitchDealTagData,
SwitchDealTagError,
SwitchDealTagResponse2,
UpdateBarcodeTemplateData,
UpdateBarcodeTemplateError,
UpdateBarcodeTemplateResponse2,
@ -252,6 +267,9 @@ import type {
UpdateStatusData,
UpdateStatusError,
UpdateStatusResponse2,
UpdateTagData,
UpdateTagError,
UpdateTagResponse,
} from "../types.gen";
export type QueryKey<TOptions extends Options> = [
@ -777,6 +795,180 @@ export const updateDealsInGroupMutation = (
return mutationOptions;
};
/**
* Update Tag
*/
export const updateTagMutation = (
options?: Partial<Options<UpdateTagData>>
): UseMutationOptions<
UpdateTagResponse,
AxiosError<UpdateTagError>,
Options<UpdateTagData>
> => {
const mutationOptions: UseMutationOptions<
UpdateTagResponse,
AxiosError<UpdateTagError>,
Options<UpdateTagData>
> = {
mutationFn: async localOptions => {
const { data } = await updateTag({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const createTagQueryKey = (options: Options<CreateTagData>) =>
createQueryKey("createTag", options);
/**
* Create Tag
*/
export const createTagOptions = (options: Options<CreateTagData>) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await createTag({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: createTagQueryKey(options),
});
};
/**
* Create Tag
*/
export const createTagMutation = (
options?: Partial<Options<CreateTagData>>
): UseMutationOptions<
CreateTagResponse,
AxiosError<CreateTagError>,
Options<CreateTagData>
> => {
const mutationOptions: UseMutationOptions<
CreateTagResponse,
AxiosError<CreateTagError>,
Options<CreateTagData>
> = {
mutationFn: async localOptions => {
const { data } = await createTag({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
/**
* Delete Tag
*/
export const deleteTagMutation = (
options?: Partial<Options<DeleteTagData>>
): UseMutationOptions<
DeleteTagResponse,
AxiosError<DeleteTagError>,
Options<DeleteTagData>
> => {
const mutationOptions: UseMutationOptions<
DeleteTagResponse,
AxiosError<DeleteTagError>,
Options<DeleteTagData>
> = {
mutationFn: async localOptions => {
const { data } = await deleteTag({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const switchDealTagQueryKey = (options: Options<SwitchDealTagData>) =>
createQueryKey("switchDealTag", options);
/**
* Switch Deal Tag
*/
export const switchDealTagOptions = (options: Options<SwitchDealTagData>) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await switchDealTag({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: switchDealTagQueryKey(options),
});
};
/**
* Switch Deal Tag
*/
export const switchDealTagMutation = (
options?: Partial<Options<SwitchDealTagData>>
): UseMutationOptions<
SwitchDealTagResponse2,
AxiosError<SwitchDealTagError>,
Options<SwitchDealTagData>
> => {
const mutationOptions: UseMutationOptions<
SwitchDealTagResponse2,
AxiosError<SwitchDealTagError>,
Options<SwitchDealTagData>
> = {
mutationFn: async localOptions => {
const { data } = await switchDealTag({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getDealTagColorsQueryKey = (
options?: Options<GetDealTagColorsData>
) => createQueryKey("getDealTagColors", options);
/**
* Get Deal Tag Colors
*/
export const getDealTagColorsOptions = (
options?: Options<GetDealTagColorsData>
) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await getDealTagColors({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: getDealTagColorsQueryKey(options),
});
};
export const getBuiltInModulesQueryKey = (
options?: Options<GetBuiltInModulesData>
) => createQueryKey("getBuiltInModules", options);