refactor: renamed built_in_modules into modules

This commit is contained in:
2025-10-21 12:34:42 +04:00
parent 4d5723bc72
commit 57a7ab0871
12 changed files with 202 additions and 208 deletions

View File

@ -51,7 +51,6 @@ import {
getBarcodeTemplateSizes,
getBaseMarketplaces,
getBoards,
getBuiltInModules,
getClients,
getDealProducts,
getDeals,
@ -59,6 +58,7 @@ import {
getDealTagColors,
getDealTags,
getMarketplaces,
getModules,
getProductBarcodePdf,
getProducts,
getProjects,
@ -203,7 +203,6 @@ import type {
GetBarcodeTemplateSizesData,
GetBaseMarketplacesData,
GetBoardsData,
GetBuiltInModulesData,
GetClientsData,
GetDealProductsData,
GetDealsData,
@ -214,6 +213,7 @@ import type {
GetDealTagColorsResponse,
GetDealTagsData,
GetMarketplacesData,
GetModulesData,
GetProductBarcodePdfData,
GetProductBarcodePdfError,
GetProductBarcodePdfResponse2,
@ -1033,19 +1033,16 @@ export const getDealTagColorsMutation = (
return mutationOptions;
};
export const getBuiltInModulesQueryKey = (
options?: Options<GetBuiltInModulesData>
) => createQueryKey("getBuiltInModules", options);
export const getModulesQueryKey = (options?: Options<GetModulesData>) =>
createQueryKey("getModules", options);
/**
* Get Built In Modules
* Get Modules
*/
export const getBuiltInModulesOptions = (
options?: Options<GetBuiltInModulesData>
) => {
export const getModulesOptions = (options?: Options<GetModulesData>) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await getBuiltInModules({
const { data } = await getModules({
...options,
...queryKey[0],
signal,
@ -1053,7 +1050,7 @@ export const getBuiltInModulesOptions = (
});
return data;
},
queryKey: getBuiltInModulesQueryKey(options),
queryKey: getModulesQueryKey(options),
});
};

View File

@ -127,8 +127,6 @@ import type {
GetBoardsData,
GetBoardsErrors,
GetBoardsResponses,
GetBuiltInModulesData,
GetBuiltInModulesResponses,
GetClientsData,
GetClientsErrors,
GetClientsResponses,
@ -149,6 +147,8 @@ import type {
GetMarketplacesData,
GetMarketplacesErrors,
GetMarketplacesResponses,
GetModulesData,
GetModulesResponses,
GetProductBarcodePdfData,
GetProductBarcodePdfErrors,
GetProductBarcodePdfResponses,
@ -313,8 +313,6 @@ import {
zGetBaseMarketplacesResponse2,
zGetBoardsData,
zGetBoardsResponse2,
zGetBuiltInModulesData,
zGetBuiltInModulesResponse,
zGetClientsData,
zGetClientsResponse2,
zGetDealProductsData,
@ -329,6 +327,8 @@ import {
zGetDealTagsResponse2,
zGetMarketplacesData,
zGetMarketplacesResponse2,
zGetModulesData,
zGetModulesResponse,
zGetProductBarcodePdfData,
zGetProductBarcodePdfResponse2,
zGetProductsData,
@ -859,22 +859,22 @@ export const getDealTagColors = <ThrowOnError extends boolean = false>(
};
/**
* Get Built In Modules
* Get Modules
*/
export const getBuiltInModules = <ThrowOnError extends boolean = false>(
options?: Options<GetBuiltInModulesData, ThrowOnError>
export const getModules = <ThrowOnError extends boolean = false>(
options?: Options<GetModulesData, ThrowOnError>
) => {
return (options?.client ?? _heyApiClient).get<
GetBuiltInModulesResponses,
GetModulesResponses,
unknown,
ThrowOnError
>({
requestValidator: async data => {
return await zGetBuiltInModulesData.parseAsync(data);
return await zGetModulesData.parseAsync(data);
},
responseType: "json",
responseValidator: async data => {
return await zGetBuiltInModulesResponse.parseAsync(data);
return await zGetModulesResponse.parseAsync(data);
},
url: "/crm/v1/module/built-in/",
...options,

View File

@ -137,92 +137,6 @@ export type BodyUploadProductImage = {
upload_file: Blob | File;
};
/**
* BuiltInModuleSchema
*/
export type BuiltInModuleSchemaInput = {
/**
* Id
*/
id: number;
/**
* Key
*/
key: string;
/**
* Label
*/
label: string;
/**
* Description
*/
description: string;
/**
* Dependson
*/
dependsOn: Array<BuiltInModuleSchemaInput>;
/**
* Tabs
*/
tabs: Array<BuiltInModuleTabSchema>;
};
/**
* BuiltInModuleSchema
*/
export type BuiltInModuleSchemaOutput = {
/**
* Id
*/
id: number;
/**
* Key
*/
key: string;
/**
* Label
*/
label: string;
/**
* Description
*/
description: string;
/**
* Dependson
*/
dependsOn: Array<BuiltInModuleSchemaOutput>;
/**
* Tabs
*/
tabs: Array<BuiltInModuleTabSchema>;
};
/**
* BuiltInModuleTabSchema
*/
export type BuiltInModuleTabSchema = {
/**
* Id
*/
id: number;
/**
* Key
*/
key: string;
/**
* Label
*/
label: string;
/**
* Iconname
*/
iconName: string;
/**
* Device
*/
device: string;
};
/**
* ClientDetailsSchema
*/
@ -1277,13 +1191,13 @@ export type DeleteStatusResponse = {
};
/**
* GetAllBuiltInModulesResponse
* GetAllModulesResponse
*/
export type GetAllBuiltInModulesResponse = {
export type GetAllModulesResponse = {
/**
* Items
*/
items: Array<BuiltInModuleSchemaOutput>;
items: Array<ModuleSchemaOutput>;
};
/**
@ -1550,6 +1464,92 @@ export type MarketplaceSchema = {
};
};
/**
* ModuleSchema
*/
export type ModuleSchemaInput = {
/**
* Id
*/
id: number;
/**
* Key
*/
key: string;
/**
* Label
*/
label: string;
/**
* Description
*/
description: string;
/**
* Dependson
*/
dependsOn: Array<ModuleSchemaInput>;
/**
* Tabs
*/
tabs: Array<ModuleTabSchema>;
};
/**
* ModuleSchema
*/
export type ModuleSchemaOutput = {
/**
* Id
*/
id: number;
/**
* Key
*/
key: string;
/**
* Label
*/
label: string;
/**
* Description
*/
description: string;
/**
* Dependson
*/
dependsOn: Array<ModuleSchemaOutput>;
/**
* Tabs
*/
tabs: Array<ModuleTabSchema>;
};
/**
* ModuleTabSchema
*/
export type ModuleTabSchema = {
/**
* Id
*/
id: number;
/**
* Key
*/
key: string;
/**
* Label
*/
label: string;
/**
* Iconname
*/
iconName: string;
/**
* Device
*/
device: string;
};
/**
* PaginationInfoSchema
*/
@ -1746,9 +1746,9 @@ export type ProjectSchema = {
*/
name: string;
/**
* Builtinmodules
* Modules
*/
builtInModules: Array<BuiltInModuleSchemaOutput>;
modules: Array<ModuleSchemaOutput>;
/**
* Tags
*/
@ -2383,9 +2383,9 @@ export type UpdateProjectSchema = {
*/
name?: string | null;
/**
* Builtinmodules
* Modules
*/
builtInModules?: Array<BuiltInModuleSchemaInput>;
modules?: Array<ModuleSchemaInput>;
};
/**
@ -3116,22 +3116,21 @@ export type GetDealTagColorsResponses = {
export type GetDealTagColorsResponse =
GetDealTagColorsResponses[keyof GetDealTagColorsResponses];
export type GetBuiltInModulesData = {
export type GetModulesData = {
body?: never;
path?: never;
query?: never;
url: "/crm/v1/module/built-in/";
};
export type GetBuiltInModulesResponses = {
export type GetModulesResponses = {
/**
* Successful Response
*/
200: GetAllBuiltInModulesResponse;
200: GetAllModulesResponse;
};
export type GetBuiltInModulesResponse =
GetBuiltInModulesResponses[keyof GetBuiltInModulesResponses];
export type GetModulesResponse = GetModulesResponses[keyof GetModulesResponses];
export type GetClientsData = {
body?: never;

View File

@ -73,53 +73,6 @@ export const zBodyUploadProductImage = z.object({
upload_file: z.any(),
});
/**
* BuiltInModuleTabSchema
*/
export const zBuiltInModuleTabSchema = z.object({
id: z.int(),
key: z.string(),
label: z.string(),
iconName: z.string(),
device: z.string(),
});
/**
* BuiltInModuleSchema
*/
export const zBuiltInModuleSchemaInput = z.object({
id: z.int(),
key: z.string(),
label: z.string(),
description: z.string(),
get dependsOn() {
return z.array(
z.lazy((): any => {
return zBuiltInModuleSchemaInput;
})
);
},
tabs: z.array(zBuiltInModuleTabSchema),
});
/**
* BuiltInModuleSchema
*/
export const zBuiltInModuleSchemaOutput = z.object({
id: z.int(),
key: z.string(),
label: z.string(),
description: z.string(),
get dependsOn() {
return z.array(
z.lazy((): any => {
return zBuiltInModuleSchemaOutput;
})
);
},
tabs: z.array(zBuiltInModuleTabSchema),
});
/**
* ClientDetailsSchema
*/
@ -608,13 +561,42 @@ export const zCreateProjectRequest = z.object({
entity: zCreateProjectSchema,
});
/**
* ModuleTabSchema
*/
export const zModuleTabSchema = z.object({
id: z.int(),
key: z.string(),
label: z.string(),
iconName: z.string(),
device: z.string(),
});
/**
* ModuleSchema
*/
export const zModuleSchemaOutput = z.object({
id: z.int(),
key: z.string(),
label: z.string(),
description: z.string(),
get dependsOn() {
return z.array(
z.lazy((): any => {
return zModuleSchemaOutput;
})
);
},
tabs: z.array(zModuleTabSchema),
});
/**
* ProjectSchema
*/
export const zProjectSchema = z.object({
id: z.int(),
name: z.string(),
builtInModules: z.array(zBuiltInModuleSchemaOutput),
modules: z.array(zModuleSchemaOutput),
tags: z.array(zDealTagSchema),
});
@ -889,10 +871,10 @@ export const zDeleteStatusResponse = z.object({
});
/**
* GetAllBuiltInModulesResponse
* GetAllModulesResponse
*/
export const zGetAllBuiltInModulesResponse = z.object({
items: z.array(zBuiltInModuleSchemaOutput),
export const zGetAllModulesResponse = z.object({
items: z.array(zModuleSchemaOutput),
});
/**
@ -1085,6 +1067,24 @@ export const zHttpValidationError = z.object({
detail: z.optional(z.array(zValidationError)),
});
/**
* ModuleSchema
*/
export const zModuleSchemaInput = z.object({
id: z.int(),
key: z.string(),
label: z.string(),
description: z.string(),
get dependsOn() {
return z.array(
z.lazy((): any => {
return zModuleSchemaInput;
})
);
},
tabs: z.array(zModuleTabSchema),
});
/**
* ProductServicesDuplicateRequest
*/
@ -1410,7 +1410,7 @@ export const zUpdateProductServiceResponse = z.object({
*/
export const zUpdateProjectSchema = z.object({
name: z.optional(z.union([z.string(), z.null()])),
builtInModules: z.optional(z.array(zBuiltInModuleSchemaInput)),
modules: z.optional(z.array(zModuleSchemaInput)),
});
/**
@ -1758,7 +1758,7 @@ export const zGetDealTagColorsData = z.object({
*/
export const zGetDealTagColorsResponse = zGetTagColorsResponse;
export const zGetBuiltInModulesData = z.object({
export const zGetModulesData = z.object({
body: z.optional(z.never()),
path: z.optional(z.never()),
query: z.optional(z.never()),
@ -1767,7 +1767,7 @@ export const zGetBuiltInModulesData = z.object({
/**
* Successful Response
*/
export const zGetBuiltInModulesResponse = zGetAllBuiltInModulesResponse;
export const zGetModulesResponse = zGetAllModulesResponse;
export const zGetClientsData = z.object({
body: z.optional(z.never()),