Skip to content

Commit

Permalink
fix: remove unnecessary schema
Browse files Browse the repository at this point in the history
  • Loading branch information
almog8k committed Dec 1, 2024
1 parent 3c87ca5 commit 94de9a8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 18 deletions.
5 changes: 5 additions & 0 deletions src/common/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ export interface CatalogUpdateRequestBody {
}

export type CatalogUpdateMetadata = Partial<LayerMetadata>;

export interface CatalogUpdateAdditionalParams {
displayPath?: string;
polygonPartsEntityName: string;
}
//#endregion catalogClient

//#region seedingJobCreator
Expand Down
11 changes: 3 additions & 8 deletions src/httpClients/catalogClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions src/utils/zod/schemas/jobParametersSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof catalogUpdateAdditionalParamsSchema>;

export const catalogSwapUpdateAdditionalParamsSchema = z
.object({
displayPath: displayPathSchema,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/httpClients/catalogClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/httpClients/polygonPartMangerClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 94de9a8

Please sign in to comment.