From 94de9a89637e92eb5e62addfcfc1a76477795552 Mon Sep 17 00:00:00 2001 From: almog8k Date: Sun, 1 Dec 2024 13:31:50 +0200 Subject: [PATCH] fix: remove unnecessary schema --- src/common/interfaces.ts | 5 +++++ src/httpClients/catalogClient.ts | 11 +++-------- src/utils/zod/schemas/jobParametersSchema.ts | 8 -------- tests/unit/httpClients/catalogClient.spec.ts | 2 +- .../{catalogCLientSetup.ts => catalogClientSetup.ts} | 0 .../unit/httpClients/polygonPartMangerClient.spec.ts | 2 +- 6 files changed, 10 insertions(+), 18 deletions(-) rename tests/unit/httpClients/{catalogCLientSetup.ts => catalogClientSetup.ts} (100%) diff --git a/src/common/interfaces.ts b/src/common/interfaces.ts index c1d12af..73684b3 100644 --- a/src/common/interfaces.ts +++ b/src/common/interfaces.ts @@ -239,6 +239,11 @@ export interface CatalogUpdateRequestBody { } export type CatalogUpdateMetadata = Partial; + +export interface CatalogUpdateAdditionalParams { + displayPath?: string; + polygonPartsEntityName: string; +} //#endregion catalogClient //#region seedingJobCreator diff --git a/src/httpClients/catalogClient.ts b/src/httpClients/catalogClient.ts index 3bc52a7..0536b91 100644 --- a/src/httpClients/catalogClient.ts +++ b/src/httpClients/catalogClient.ts @@ -13,13 +13,8 @@ import { import { inject, injectable } from 'tsyringe'; import { IngestionJobTypes } from '../utils/configUtil'; import { INJECTION_VALUES, SERVICES } from '../common/constants'; -import { ExtendedNewRasterLayer, CatalogUpdateRequestBody, LayerName } from '../common/interfaces'; -import { - catalogSwapUpdateAdditionalParamsSchema, - CatalogUpdateAdditionalParams, - catalogUpdateAdditionalParamsSchema, - internalIdSchema, -} from '../utils/zod/schemas/jobParametersSchema'; +import { ExtendedNewRasterLayer, CatalogUpdateRequestBody, LayerName, CatalogUpdateAdditionalParams } from '../common/interfaces'; +import { catalogSwapUpdateAdditionalParamsSchema, internalIdSchema } from '../utils/zod/schemas/jobParametersSchema'; import { PublishLayerError, UpdateLayerError } from '../common/errors'; import { ILinkBuilderData, LinkBuilder } from '../utils/linkBuilder'; import { PolygonPartsMangerClient } from './polygonPartsMangerClient'; @@ -152,7 +147,7 @@ export class CatalogClient extends HttpClient { let validParams; switch (updateMode) { case this.jobTypes.Ingestion_Update: - validParams = catalogUpdateAdditionalParamsSchema.parse(additionalParams); + validParams = polygonPartsEntityNameSchema.parse(additionalParams); break; case this.jobTypes.Ingestion_Swap_Update: validParams = catalogSwapUpdateAdditionalParamsSchema.parse(additionalParams); diff --git a/src/utils/zod/schemas/jobParametersSchema.ts b/src/utils/zod/schemas/jobParametersSchema.ts index e22a7ff..97a6c43 100644 --- a/src/utils/zod/schemas/jobParametersSchema.ts +++ b/src/utils/zod/schemas/jobParametersSchema.ts @@ -17,14 +17,6 @@ export const updateAdditionalParamsSchema = swapUpdateAdditionalParamsSchema.ext displayPath: displayPathSchema, }); -export const catalogUpdateAdditionalParamsSchema = z - .object({ - displayPath: displayPathSchema.optional(), - }) - .merge(polygonPartsEntityNameSchema); - -export type CatalogUpdateAdditionalParams = z.infer; - export const catalogSwapUpdateAdditionalParamsSchema = z .object({ displayPath: displayPathSchema, diff --git a/tests/unit/httpClients/catalogClient.spec.ts b/tests/unit/httpClients/catalogClient.spec.ts index c769f1d..654640c 100644 --- a/tests/unit/httpClients/catalogClient.spec.ts +++ b/tests/unit/httpClients/catalogClient.spec.ts @@ -2,7 +2,7 @@ import nock from 'nock'; import { clear as clearConfig, configMock, registerDefaultConfig } from '../mocks/configMock'; import { PublishLayerError, UpdateLayerError } from '../../../src/common/errors'; import { ingestionNewJob, ingestionNewJobExtended, ingestionSwapUpdateJob, ingestionUpdateJob } from '../mocks/jobsMockData'; -import { createFakeAggregatedPartData, setupCatalogClientTest } from './catalogCLientSetup'; +import { createFakeAggregatedPartData, setupCatalogClientTest } from './catalogClientSetup'; describe('CatalogClient', () => { beforeEach(() => { diff --git a/tests/unit/httpClients/catalogCLientSetup.ts b/tests/unit/httpClients/catalogClientSetup.ts similarity index 100% rename from tests/unit/httpClients/catalogCLientSetup.ts rename to tests/unit/httpClients/catalogClientSetup.ts diff --git a/tests/unit/httpClients/polygonPartMangerClient.spec.ts b/tests/unit/httpClients/polygonPartMangerClient.spec.ts index 0bed202..f206703 100644 --- a/tests/unit/httpClients/polygonPartMangerClient.spec.ts +++ b/tests/unit/httpClients/polygonPartMangerClient.spec.ts @@ -3,7 +3,7 @@ import { faker } from '@faker-js/faker'; import nock from 'nock'; import { PolygonPartsMangerClient } from '../../../src/httpClients/polygonPartsMangerClient'; import { configMock, registerDefaultConfig } from '../mocks/configMock'; -import { createFakeAggregatedPartData } from './catalogCLientSetup'; +import { createFakeAggregatedPartData } from './catalogClientSetup'; describe('polygonPartsManagerClient', () => { let polygonPartsManagerClient: PolygonPartsMangerClient;