From 9023b07c658745e144d59a556a4c8b6e7bcf14d4 Mon Sep 17 00:00:00 2001 From: AlexSserb Date: Sat, 18 Oct 2025 13:06:37 +0400 Subject: [PATCH] refactor: moved ProjectEditorDrawer into common drawers directory --- .../drawers/ProjectEditorDrawer/index.ts | 3 - .../ProjectEditorDrawer.module.css | 0 .../ProjectEditorDrawer.tsx | 2 +- .../components/ProjectEditorBody.tsx | 5 +- .../common/ProjectEditorDrawer/index.ts | 3 + .../tabs/GeneralTab/GeneralTab.tsx | 2 +- .../tabs/GeneralTab/components/Footer.tsx | 0 .../tabs/ModulesTab/ModulesTab.tsx | 2 +- .../ModulesTab/components/ModulesTable.tsx | 2 +- .../hooks/useModulesTableColumns.tsx | 0 .../ModulesTab/utils/resolveDependencies.ts | 0 .../common}/ProjectEditorDrawer/tabs/index.ts | 0 src/drawers/drawersRegistry.tsx | 2 +- src/lib/client/@tanstack/react-query.gen.ts | 192 ++++++++++++ src/lib/client/sdk.gen.ts | 151 ++++++++++ src/lib/client/types.gen.ts | 280 ++++++++++++++++++ src/lib/client/zod.gen.ts | 154 ++++++++++ 17 files changed, 786 insertions(+), 12 deletions(-) delete mode 100644 src/app/deals/drawers/ProjectEditorDrawer/index.ts rename src/{app/deals/drawers => drawers/common}/ProjectEditorDrawer/ProjectEditorDrawer.module.css (100%) rename src/{app/deals/drawers => drawers/common}/ProjectEditorDrawer/ProjectEditorDrawer.tsx (93%) rename src/{app/deals/drawers => drawers/common}/ProjectEditorDrawer/components/ProjectEditorBody.tsx (92%) create mode 100644 src/drawers/common/ProjectEditorDrawer/index.ts rename src/{app/deals/drawers => drawers/common}/ProjectEditorDrawer/tabs/GeneralTab/GeneralTab.tsx (91%) rename src/{app/deals/drawers => drawers/common}/ProjectEditorDrawer/tabs/GeneralTab/components/Footer.tsx (100%) rename src/{app/deals/drawers => drawers/common}/ProjectEditorDrawer/tabs/ModulesTab/ModulesTab.tsx (92%) rename src/{app/deals/drawers => drawers/common}/ProjectEditorDrawer/tabs/ModulesTab/components/ModulesTable.tsx (88%) rename src/{app/deals/drawers => drawers/common}/ProjectEditorDrawer/tabs/ModulesTab/hooks/useModulesTableColumns.tsx (100%) rename src/{app/deals/drawers => drawers/common}/ProjectEditorDrawer/tabs/ModulesTab/utils/resolveDependencies.ts (100%) rename src/{app/deals/drawers => drawers/common}/ProjectEditorDrawer/tabs/index.ts (100%) diff --git a/src/app/deals/drawers/ProjectEditorDrawer/index.ts b/src/app/deals/drawers/ProjectEditorDrawer/index.ts deleted file mode 100644 index 65fd2e2..0000000 --- a/src/app/deals/drawers/ProjectEditorDrawer/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import ProjectEditorDrawer from "@/app/deals/drawers/ProjectEditorDrawer/ProjectEditorDrawer"; - -export default ProjectEditorDrawer; diff --git a/src/app/deals/drawers/ProjectEditorDrawer/ProjectEditorDrawer.module.css b/src/drawers/common/ProjectEditorDrawer/ProjectEditorDrawer.module.css similarity index 100% rename from src/app/deals/drawers/ProjectEditorDrawer/ProjectEditorDrawer.module.css rename to src/drawers/common/ProjectEditorDrawer/ProjectEditorDrawer.module.css diff --git a/src/app/deals/drawers/ProjectEditorDrawer/ProjectEditorDrawer.tsx b/src/drawers/common/ProjectEditorDrawer/ProjectEditorDrawer.tsx similarity index 93% rename from src/app/deals/drawers/ProjectEditorDrawer/ProjectEditorDrawer.tsx rename to src/drawers/common/ProjectEditorDrawer/ProjectEditorDrawer.tsx index 603100d..91edafa 100644 --- a/src/app/deals/drawers/ProjectEditorDrawer/ProjectEditorDrawer.tsx +++ b/src/drawers/common/ProjectEditorDrawer/ProjectEditorDrawer.tsx @@ -2,10 +2,10 @@ import React, { FC, useState } from "react"; import { Drawer } from "@mantine/core"; -import ProjectEditorBody from "@/app/deals/drawers/ProjectEditorDrawer/components/ProjectEditorBody"; import { DrawerProps } from "@/drawers/types"; import useIsMobile from "@/hooks/utils/useIsMobile"; import { ProjectSchema } from "@/lib/client"; +import ProjectEditorBody from "@/drawers/common/ProjectEditorDrawer/components/ProjectEditorBody"; type Props = { value: ProjectSchema; diff --git a/src/app/deals/drawers/ProjectEditorDrawer/components/ProjectEditorBody.tsx b/src/drawers/common/ProjectEditorDrawer/components/ProjectEditorBody.tsx similarity index 92% rename from src/app/deals/drawers/ProjectEditorDrawer/components/ProjectEditorBody.tsx rename to src/drawers/common/ProjectEditorDrawer/components/ProjectEditorBody.tsx index 07c4243..baf99e9 100644 --- a/src/app/deals/drawers/ProjectEditorDrawer/components/ProjectEditorBody.tsx +++ b/src/drawers/common/ProjectEditorDrawer/components/ProjectEditorBody.tsx @@ -1,12 +1,9 @@ import { FC } from "react"; import { IconBlocks, IconEdit } from "@tabler/icons-react"; import { Tabs } from "@mantine/core"; -import { - GeneralTab, - ModulesTab, -} from "@/app/deals/drawers/ProjectEditorDrawer/tabs"; import { ProjectSchema } from "@/lib/client"; import styles from "../ProjectEditorDrawer.module.css"; +import { GeneralTab, ModulesTab } from "@/drawers/common/ProjectEditorDrawer/tabs"; type Props = { value: ProjectSchema; diff --git a/src/drawers/common/ProjectEditorDrawer/index.ts b/src/drawers/common/ProjectEditorDrawer/index.ts new file mode 100644 index 0000000..0239d46 --- /dev/null +++ b/src/drawers/common/ProjectEditorDrawer/index.ts @@ -0,0 +1,3 @@ +import ProjectEditorDrawer from "./ProjectEditorDrawer"; + +export default ProjectEditorDrawer; diff --git a/src/app/deals/drawers/ProjectEditorDrawer/tabs/GeneralTab/GeneralTab.tsx b/src/drawers/common/ProjectEditorDrawer/tabs/GeneralTab/GeneralTab.tsx similarity index 91% rename from src/app/deals/drawers/ProjectEditorDrawer/tabs/GeneralTab/GeneralTab.tsx rename to src/drawers/common/ProjectEditorDrawer/tabs/GeneralTab/GeneralTab.tsx index b097dd8..95e0dc2 100644 --- a/src/app/deals/drawers/ProjectEditorDrawer/tabs/GeneralTab/GeneralTab.tsx +++ b/src/drawers/common/ProjectEditorDrawer/tabs/GeneralTab/GeneralTab.tsx @@ -1,8 +1,8 @@ import { FC } from "react"; import { Stack, TextInput } from "@mantine/core"; import { useForm } from "@mantine/form"; -import Footer from "@/app/deals/drawers/ProjectEditorDrawer/tabs/GeneralTab/components/Footer"; import { ProjectSchema } from "@/lib/client"; +import Footer from "./components/Footer"; type Props = { value: ProjectSchema; diff --git a/src/app/deals/drawers/ProjectEditorDrawer/tabs/GeneralTab/components/Footer.tsx b/src/drawers/common/ProjectEditorDrawer/tabs/GeneralTab/components/Footer.tsx similarity index 100% rename from src/app/deals/drawers/ProjectEditorDrawer/tabs/GeneralTab/components/Footer.tsx rename to src/drawers/common/ProjectEditorDrawer/tabs/GeneralTab/components/Footer.tsx diff --git a/src/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/ModulesTab.tsx b/src/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/ModulesTab.tsx similarity index 92% rename from src/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/ModulesTab.tsx rename to src/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/ModulesTab.tsx index 2ac6183..2ba58e3 100644 --- a/src/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/ModulesTab.tsx +++ b/src/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/ModulesTab.tsx @@ -1,7 +1,7 @@ import { FC } from "react"; import { Button, Stack } from "@mantine/core"; import { useForm } from "@mantine/form"; -import resolveDependencies from "@/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/utils/resolveDependencies"; +import resolveDependencies from "@/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/utils/resolveDependencies"; import { ProjectSchema } from "@/lib/client"; import ModulesTable from "./components/ModulesTable"; diff --git a/src/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/components/ModulesTable.tsx b/src/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/components/ModulesTable.tsx similarity index 88% rename from src/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/components/ModulesTable.tsx rename to src/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/components/ModulesTable.tsx index 3ec35bc..045ac59 100644 --- a/src/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/components/ModulesTable.tsx +++ b/src/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/components/ModulesTable.tsx @@ -1,7 +1,7 @@ import { FC } from "react"; import { Divider, Stack } from "@mantine/core"; -import useModulesTableColumns from "@/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/hooks/useModulesTableColumns"; import BaseTable from "@/components/ui/BaseTable/BaseTable"; +import useModulesTableColumns from "@/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/hooks/useModulesTableColumns"; import useBuiltInModulesList from "@/hooks/lists/useBuiltInModulesList"; import { BuiltInModuleSchemaOutput } from "@/lib/client"; diff --git a/src/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/hooks/useModulesTableColumns.tsx b/src/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/hooks/useModulesTableColumns.tsx similarity index 100% rename from src/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/hooks/useModulesTableColumns.tsx rename to src/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/hooks/useModulesTableColumns.tsx diff --git a/src/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/utils/resolveDependencies.ts b/src/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/utils/resolveDependencies.ts similarity index 100% rename from src/app/deals/drawers/ProjectEditorDrawer/tabs/ModulesTab/utils/resolveDependencies.ts rename to src/drawers/common/ProjectEditorDrawer/tabs/ModulesTab/utils/resolveDependencies.ts diff --git a/src/app/deals/drawers/ProjectEditorDrawer/tabs/index.ts b/src/drawers/common/ProjectEditorDrawer/tabs/index.ts similarity index 100% rename from src/app/deals/drawers/ProjectEditorDrawer/tabs/index.ts rename to src/drawers/common/ProjectEditorDrawer/tabs/index.ts diff --git a/src/drawers/drawersRegistry.tsx b/src/drawers/drawersRegistry.tsx index 1cccb3a..506ef1a 100644 --- a/src/drawers/drawersRegistry.tsx +++ b/src/drawers/drawersRegistry.tsx @@ -1,9 +1,9 @@ import ClientMarketplaceDrawer from "@/app/clients/drawers/ClientMarketplacesDrawer"; import BoardsMobileEditorDrawer from "@/app/deals/drawers/BoardsMobileEditorDrawer"; import DealEditorDrawer from "@/app/deals/drawers/DealEditorDrawer"; -import ProjectEditorDrawer from "@/app/deals/drawers/ProjectEditorDrawer"; import ProjectsMobileEditorDrawer from "@/app/deals/drawers/ProjectsMobileEditorDrawer"; import StatusesMobileEditorDrawer from "../app/deals/drawers/StatusesMobileEditorDrawer"; +import ProjectEditorDrawer from "./common/ProjectEditorDrawer"; const drawerRegistry = { projectsMobileEditorDrawer: ProjectsMobileEditorDrawer, diff --git a/src/lib/client/@tanstack/react-query.gen.ts b/src/lib/client/@tanstack/react-query.gen.ts index 738c8d0..e29e685 100644 --- a/src/lib/client/@tanstack/react-query.gen.ts +++ b/src/lib/client/@tanstack/react-query.gen.ts @@ -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 = [ @@ -777,6 +795,180 @@ export const updateDealsInGroupMutation = ( return mutationOptions; }; +/** + * Update Tag + */ +export const updateTagMutation = ( + options?: Partial> +): UseMutationOptions< + UpdateTagResponse, + AxiosError, + Options +> => { + const mutationOptions: UseMutationOptions< + UpdateTagResponse, + AxiosError, + Options + > = { + mutationFn: async localOptions => { + const { data } = await updateTag({ + ...options, + ...localOptions, + throwOnError: true, + }); + return data; + }, + }; + return mutationOptions; +}; + +export const createTagQueryKey = (options: Options) => + createQueryKey("createTag", options); + +/** + * Create Tag + */ +export const createTagOptions = (options: Options) => { + 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> +): UseMutationOptions< + CreateTagResponse, + AxiosError, + Options +> => { + const mutationOptions: UseMutationOptions< + CreateTagResponse, + AxiosError, + Options + > = { + mutationFn: async localOptions => { + const { data } = await createTag({ + ...options, + ...localOptions, + throwOnError: true, + }); + return data; + }, + }; + return mutationOptions; +}; + +/** + * Delete Tag + */ +export const deleteTagMutation = ( + options?: Partial> +): UseMutationOptions< + DeleteTagResponse, + AxiosError, + Options +> => { + const mutationOptions: UseMutationOptions< + DeleteTagResponse, + AxiosError, + Options + > = { + mutationFn: async localOptions => { + const { data } = await deleteTag({ + ...options, + ...localOptions, + throwOnError: true, + }); + return data; + }, + }; + return mutationOptions; +}; + +export const switchDealTagQueryKey = (options: Options) => + createQueryKey("switchDealTag", options); + +/** + * Switch Deal Tag + */ +export const switchDealTagOptions = (options: Options) => { + 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> +): UseMutationOptions< + SwitchDealTagResponse2, + AxiosError, + Options +> => { + const mutationOptions: UseMutationOptions< + SwitchDealTagResponse2, + AxiosError, + Options + > = { + mutationFn: async localOptions => { + const { data } = await switchDealTag({ + ...options, + ...localOptions, + throwOnError: true, + }); + return data; + }, + }; + return mutationOptions; +}; + +export const getDealTagColorsQueryKey = ( + options?: Options +) => createQueryKey("getDealTagColors", options); + +/** + * Get Deal Tag Colors + */ +export const getDealTagColorsOptions = ( + options?: Options +) => { + 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 ) => createQueryKey("getBuiltInModules", options); diff --git a/src/lib/client/sdk.gen.ts b/src/lib/client/sdk.gen.ts index 891edf4..8da1ff2 100644 --- a/src/lib/client/sdk.gen.ts +++ b/src/lib/client/sdk.gen.ts @@ -54,6 +54,9 @@ import type { CreateStatusData, CreateStatusErrors, CreateStatusResponses, + CreateTagData, + CreateTagErrors, + CreateTagResponses, DeleteBarcodeTemplateData, DeleteBarcodeTemplateErrors, DeleteBarcodeTemplateResponses, @@ -99,6 +102,9 @@ import type { DeleteStatusData, DeleteStatusErrors, DeleteStatusResponses, + DeleteTagData, + DeleteTagErrors, + DeleteTagResponses, DuplicateProductServicesData, DuplicateProductServicesErrors, DuplicateProductServicesResponses, @@ -127,6 +133,8 @@ import type { GetDealServicesErrors, GetDealServicesResponses, GetDealsResponses, + GetDealTagColorsData, + GetDealTagColorsResponses, GetMarketplacesData, GetMarketplacesErrors, GetMarketplacesResponses, @@ -150,6 +158,9 @@ import type { GetStatusHistoryData, GetStatusHistoryErrors, GetStatusHistoryResponses, + SwitchDealTagData, + SwitchDealTagErrors, + SwitchDealTagResponses, UpdateBarcodeTemplateData, UpdateBarcodeTemplateErrors, UpdateBarcodeTemplateResponses, @@ -198,6 +209,9 @@ import type { UpdateStatusData, UpdateStatusErrors, UpdateStatusResponses, + UpdateTagData, + UpdateTagErrors, + UpdateTagResponses, } from "./types.gen"; import { zAddKitToDealData, @@ -234,6 +248,8 @@ import { zCreateServicesKitResponse2, zCreateStatusData, zCreateStatusResponse2, + zCreateTagData, + zCreateTagResponse, zDeleteBarcodeTemplateData, zDeleteBarcodeTemplateResponse2, zDeleteBoardData, @@ -264,6 +280,8 @@ import { zDeleteServicesKitResponse2, zDeleteStatusData, zDeleteStatusResponse2, + zDeleteTagData, + zDeleteTagResponse, zDuplicateProductServicesData, zDuplicateProductServicesResponse, zGetBarcodeTemplateAttributesData, @@ -286,6 +304,8 @@ import { zGetDealServicesData, zGetDealServicesResponse2, zGetDealsResponse2, + zGetDealTagColorsData, + zGetDealTagColorsResponse, zGetMarketplacesData, zGetMarketplacesResponse2, zGetProductBarcodePdfData, @@ -304,6 +324,8 @@ import { zGetStatusesResponse2, zGetStatusHistoryData, zGetStatusHistoryResponse2, + zSwitchDealTagData, + zSwitchDealTagResponse2, zUpdateBarcodeTemplateData, zUpdateBarcodeTemplateResponse2, zUpdateBoardData, @@ -336,6 +358,8 @@ import { zUpdateServicesKitResponse2, zUpdateStatusData, zUpdateStatusResponse2, + zUpdateTagData, + zUpdateTagResponse, } from "./zod.gen"; export type Options< @@ -659,6 +683,133 @@ export const updateDealsInGroup = ( }); }; +/** + * Update Tag + */ +export const updateTag = ( + options: Options +) => { + return (options.client ?? _heyApiClient).patch< + UpdateTagResponses, + UpdateTagErrors, + ThrowOnError + >({ + requestValidator: async data => { + return await zUpdateTagData.parseAsync(data); + }, + responseType: "json", + responseValidator: async data => { + return await zUpdateTagResponse.parseAsync(data); + }, + url: "/crm/v1/deal-tag/", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); +}; + +/** + * Create Tag + */ +export const createTag = ( + options: Options +) => { + return (options.client ?? _heyApiClient).post< + CreateTagResponses, + CreateTagErrors, + ThrowOnError + >({ + requestValidator: async data => { + return await zCreateTagData.parseAsync(data); + }, + responseType: "json", + responseValidator: async data => { + return await zCreateTagResponse.parseAsync(data); + }, + url: "/crm/v1/deal-tag/", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); +}; + +/** + * Delete Tag + */ +export const deleteTag = ( + options: Options +) => { + return (options.client ?? _heyApiClient).delete< + DeleteTagResponses, + DeleteTagErrors, + ThrowOnError + >({ + requestValidator: async data => { + return await zDeleteTagData.parseAsync(data); + }, + responseType: "json", + responseValidator: async data => { + return await zDeleteTagResponse.parseAsync(data); + }, + url: "/crm/v1/deal-tag/{deal_tag_id}", + ...options, + }); +}; + +/** + * Switch Deal Tag + */ +export const switchDealTag = ( + options: Options +) => { + return (options.client ?? _heyApiClient).post< + SwitchDealTagResponses, + SwitchDealTagErrors, + ThrowOnError + >({ + requestValidator: async data => { + return await zSwitchDealTagData.parseAsync(data); + }, + responseType: "json", + responseValidator: async data => { + return await zSwitchDealTagResponse2.parseAsync(data); + }, + url: "/crm/v1/deal-tag/switch", + ...options, + headers: { + "Content-Type": "application/json", + ...options.headers, + }, + }); +}; + +/** + * Get Deal Tag Colors + */ +export const getDealTagColors = ( + options?: Options +) => { + return (options?.client ?? _heyApiClient).get< + GetDealTagColorsResponses, + unknown, + ThrowOnError + >({ + requestValidator: async data => { + return await zGetDealTagColorsData.parseAsync(data); + }, + responseType: "json", + responseValidator: async data => { + return await zGetDealTagColorsResponse.parseAsync(data); + }, + url: "/crm/v1/deal-tag/colors", + ...options, + }); +}; + /** * Get Built In Modules */ diff --git a/src/lib/client/types.gen.ts b/src/lib/client/types.gen.ts index 2a28384..6677c59 100644 --- a/src/lib/client/types.gen.ts +++ b/src/lib/client/types.gen.ts @@ -492,6 +492,42 @@ export type CreateDealServiceSchema = { price: number; }; +/** + * CreateDealTagRequest + */ +export type CreateDealTagRequest = { + entity: CreateDealTagSchema; +}; + +/** + * CreateDealTagResponse + */ +export type CreateDealTagResponse = { + /** + * Message + */ + message: string; + entity: DealTagSchema; +}; + +/** + * CreateDealTagSchema + */ +export type CreateDealTagSchema = { + /** + * Name + */ + name: string; + /** + * Projectid + */ + projectId: number; + /** + * Tagcolorid + */ + tagColorId: number; +}; + /** * CreateMarketplaceRequest */ @@ -987,6 +1023,51 @@ export type DealServiceSchema = { isFixedPrice: boolean; }; +/** + * DealTagColorSchema + */ +export type DealTagColorSchema = { + /** + * Id + */ + id: number; + /** + * Color + */ + color: string; + /** + * Backgroundcolor + */ + backgroundColor: string; + /** + * Label + */ + label: string; +}; + +/** + * DealTagSchema + */ +export type DealTagSchema = { + /** + * Name + */ + name: string; + /** + * Projectid + */ + projectId: number; + /** + * Tagcolorid + */ + tagColorId: number; + /** + * Id + */ + id: number; + tagColor: DealTagColorSchema; +}; + /** * DeleteBarcodeTemplateResponse */ @@ -1057,6 +1138,16 @@ export type DeleteDealServiceResponse = { message: string; }; +/** + * DeleteDealTagResponse + */ +export type DeleteDealTagResponse = { + /** + * Message + */ + message: string; +}; + /** * DeleteMarketplaceResponse */ @@ -1355,6 +1446,16 @@ export type GetStatusesResponse = { items: Array; }; +/** + * GetTagColorsResponse + */ +export type GetTagColorsResponse = { + /** + * Items + */ + items: Array; +}; + /** * HTTPValidationError */ @@ -1700,6 +1801,34 @@ export type StatusSchema = { color: string; }; +/** + * SwitchDealTagRequest + */ +export type SwitchDealTagRequest = { + /** + * Tagid + */ + tagId: number; + /** + * Dealid + */ + dealId?: number | null; + /** + * Groupid + */ + groupId?: number | null; +}; + +/** + * SwitchDealTagResponse + */ +export type SwitchDealTagResponse = { + /** + * Message + */ + message: string; +}; + /** * UpdateBarcodeTemplateRequest */ @@ -1944,6 +2073,34 @@ export type UpdateDealServiceSchema = { isFixedPrice: boolean; }; +/** + * UpdateDealTagRequest + */ +export type UpdateDealTagRequest = { + entity: UpdateDealTagSchema; +}; + +/** + * UpdateDealTagResponse + */ +export type UpdateDealTagResponse = { + /** + * Message + */ + message: string; +}; + +/** + * UpdateDealTagSchema + */ +export type UpdateDealTagSchema = { + /** + * Name + */ + name?: string | null; + tagColor?: DealTagColorSchema | null; +}; + /** * UpdateDealsInGroupRequest */ @@ -2694,6 +2851,129 @@ export type UpdateDealsInGroupResponses = { export type UpdateDealsInGroupResponse2 = UpdateDealsInGroupResponses[keyof UpdateDealsInGroupResponses]; +export type UpdateTagData = { + body: UpdateDealTagRequest; + path?: never; + query?: never; + url: "/crm/v1/deal-tag/"; +}; + +export type UpdateTagErrors = { + /** + * Validation Error + */ + 422: HttpValidationError; +}; + +export type UpdateTagError = UpdateTagErrors[keyof UpdateTagErrors]; + +export type UpdateTagResponses = { + /** + * Successful Response + */ + 200: UpdateDealTagResponse; +}; + +export type UpdateTagResponse = UpdateTagResponses[keyof UpdateTagResponses]; + +export type CreateTagData = { + body: CreateDealTagRequest; + path?: never; + query?: never; + url: "/crm/v1/deal-tag/"; +}; + +export type CreateTagErrors = { + /** + * Validation Error + */ + 422: HttpValidationError; +}; + +export type CreateTagError = CreateTagErrors[keyof CreateTagErrors]; + +export type CreateTagResponses = { + /** + * Successful Response + */ + 200: CreateDealTagResponse; +}; + +export type CreateTagResponse = CreateTagResponses[keyof CreateTagResponses]; + +export type DeleteTagData = { + body?: never; + path: { + /** + * Deal Tag Id + */ + deal_tag_id: number; + }; + query?: never; + url: "/crm/v1/deal-tag/{deal_tag_id}"; +}; + +export type DeleteTagErrors = { + /** + * Validation Error + */ + 422: HttpValidationError; +}; + +export type DeleteTagError = DeleteTagErrors[keyof DeleteTagErrors]; + +export type DeleteTagResponses = { + /** + * Successful Response + */ + 200: DeleteDealTagResponse; +}; + +export type DeleteTagResponse = DeleteTagResponses[keyof DeleteTagResponses]; + +export type SwitchDealTagData = { + body: SwitchDealTagRequest; + path?: never; + query?: never; + url: "/crm/v1/deal-tag/switch"; +}; + +export type SwitchDealTagErrors = { + /** + * Validation Error + */ + 422: HttpValidationError; +}; + +export type SwitchDealTagError = SwitchDealTagErrors[keyof SwitchDealTagErrors]; + +export type SwitchDealTagResponses = { + /** + * Successful Response + */ + 200: SwitchDealTagResponse; +}; + +export type SwitchDealTagResponse2 = + SwitchDealTagResponses[keyof SwitchDealTagResponses]; + +export type GetDealTagColorsData = { + body?: never; + path?: never; + query?: never; + url: "/crm/v1/deal-tag/colors"; +}; + +export type GetDealTagColorsResponses = { + /** + * Successful Response + */ + 200: GetTagColorsResponse; +}; + +export type GetDealTagColorsResponse = + GetDealTagColorsResponses[keyof GetDealTagColorsResponses]; + export type GetBuiltInModulesData = { body?: never; path?: never; diff --git a/src/lib/client/zod.gen.ts b/src/lib/client/zod.gen.ts index 1d3233e..b754f99 100644 --- a/src/lib/client/zod.gen.ts +++ b/src/lib/client/zod.gen.ts @@ -411,6 +411,51 @@ export const zCreateDealServiceResponse = z.object({ entity: zDealServiceSchema, }); +/** + * CreateDealTagSchema + */ +export const zCreateDealTagSchema = z.object({ + name: z.string(), + projectId: z.int(), + tagColorId: z.int(), +}); + +/** + * CreateDealTagRequest + */ +export const zCreateDealTagRequest = z.object({ + entity: zCreateDealTagSchema, +}); + +/** + * DealTagColorSchema + */ +export const zDealTagColorSchema = z.object({ + id: z.int(), + color: z.string(), + backgroundColor: z.string(), + label: z.string(), +}); + +/** + * DealTagSchema + */ +export const zDealTagSchema = z.object({ + name: z.string(), + projectId: z.int(), + tagColorId: z.int(), + id: z.int(), + tagColor: zDealTagColorSchema, +}); + +/** + * CreateDealTagResponse + */ +export const zCreateDealTagResponse = z.object({ + message: z.string(), + entity: zDealTagSchema, +}); + /** * CreateMarketplaceSchema */ @@ -728,6 +773,13 @@ export const zDeleteDealServiceResponse = z.object({ message: z.string(), }); +/** + * DeleteDealTagResponse + */ +export const zDeleteDealTagResponse = z.object({ + message: z.string(), +}); + /** * DeleteMarketplaceResponse */ @@ -951,6 +1003,13 @@ export const zGetStatusesResponse = z.object({ items: z.array(zStatusSchema), }); +/** + * GetTagColorsResponse + */ +export const zGetTagColorsResponse = z.object({ + items: z.array(zDealTagColorSchema), +}); + /** * ValidationError */ @@ -994,6 +1053,22 @@ export const zProductServicesDuplicateResponse = z.object({ export const zSortDir = z.enum(["asc", "desc"]); +/** + * SwitchDealTagRequest + */ +export const zSwitchDealTagRequest = z.object({ + tagId: z.int(), + dealId: z.optional(z.union([z.int(), z.null()])), + groupId: z.optional(z.union([z.int(), z.null()])), +}); + +/** + * SwitchDealTagResponse + */ +export const zSwitchDealTagResponse = z.object({ + message: z.string(), +}); + /** * UpdateBarcodeTemplateSchema */ @@ -1159,6 +1234,28 @@ export const zUpdateDealServiceResponse = z.object({ message: z.string(), }); +/** + * UpdateDealTagSchema + */ +export const zUpdateDealTagSchema = z.object({ + name: z.optional(z.union([z.string(), z.null()])), + tagColor: z.optional(z.union([zDealTagColorSchema, z.null()])), +}); + +/** + * UpdateDealTagRequest + */ +export const zUpdateDealTagRequest = z.object({ + entity: zUpdateDealTagSchema, +}); + +/** + * UpdateDealTagResponse + */ +export const zUpdateDealTagResponse = z.object({ + message: z.string(), +}); + /** * UpdateDealsInGroupRequest */ @@ -1531,6 +1628,63 @@ export const zUpdateDealsInGroupData = z.object({ */ export const zUpdateDealsInGroupResponse2 = zUpdateDealsInGroupResponse; +export const zUpdateTagData = z.object({ + body: zUpdateDealTagRequest, + path: z.optional(z.never()), + query: z.optional(z.never()), +}); + +/** + * Successful Response + */ +export const zUpdateTagResponse = zUpdateDealTagResponse; + +export const zCreateTagData = z.object({ + body: zCreateDealTagRequest, + path: z.optional(z.never()), + query: z.optional(z.never()), +}); + +/** + * Successful Response + */ +export const zCreateTagResponse = zCreateDealTagResponse; + +export const zDeleteTagData = z.object({ + body: z.optional(z.never()), + path: z.object({ + deal_tag_id: z.int(), + }), + query: z.optional(z.never()), +}); + +/** + * Successful Response + */ +export const zDeleteTagResponse = zDeleteDealTagResponse; + +export const zSwitchDealTagData = z.object({ + body: zSwitchDealTagRequest, + path: z.optional(z.never()), + query: z.optional(z.never()), +}); + +/** + * Successful Response + */ +export const zSwitchDealTagResponse2 = zSwitchDealTagResponse; + +export const zGetDealTagColorsData = z.object({ + body: z.optional(z.never()), + path: z.optional(z.never()), + query: z.optional(z.never()), +}); + +/** + * Successful Response + */ +export const zGetDealTagColorsResponse = zGetTagColorsResponse; + export const zGetBuiltInModulesData = z.object({ body: z.optional(z.never()), path: z.optional(z.never()),