Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export type CatalogUpdateMetadata = Partial<RasterLayerMetadata>;
//#endregion catalogClient

//#region PolygonPartsManagerClient
export type PolygonPartsProcessPayload = Pick<PolygonPartsPayload, 'productId' | 'productType' | 'jobType'>;
export type PolygonPartsProcessPayload = Pick<PolygonPartsPayload, 'productId' | 'productType'> & { shouldClearEntities?: boolean };
//#endregion PolygonPartsManagerClient

//#region seedingJobCreator
Expand Down
4 changes: 2 additions & 2 deletions src/job/models/ingestion/newJobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ export class NewJobHandler
activeSpan?.addEvent('layerNames.valid', { layerName });

if (!processedParts) {
const { type, resourceId, productType } = job;
await this.polygonPartsMangerClient.process({ jobType: type, productId: resourceId, productType });
const { resourceId, productType } = job;
await this.polygonPartsMangerClient.process({ productId: resourceId, productType });
finalizeTaskParams = await this.markFinalizeStepAsCompleted(job.id, task.id, finalizeTaskParams, 'processedParts');

activeSpan?.addEvent('processPolygonParts.success', { ...finalizeTaskParams });
Expand Down
4 changes: 2 additions & 2 deletions src/job/models/ingestion/swapJobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ export class SwapJobHandler
const { tileOutputFormat, displayPath } = job.parameters.additionalParams;

if (!processedParts) {
const { type, resourceId, productType } = job;
const { resourceId, productType } = job;

await this.polygonPartsMangerClient.process({ jobType: type, productId: resourceId, productType });
await this.polygonPartsMangerClient.process({ shouldClearEntities: true, productId: resourceId, productType });
finalizeTaskParams = await this.markFinalizeStepAsCompleted(job.id, task.id, finalizeTaskParams, 'processedParts');

activeSpan?.addEvent('processPolygonParts.success', { ...finalizeTaskParams });
Expand Down
4 changes: 2 additions & 2 deletions src/job/models/ingestion/updateJobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ export class UpdateJobHandler
activeSpan?.addEvent('layerNameFormat.valid', { layerName: layerNameFormats.layerName });

if (!processedParts) {
const { type, resourceId, productType } = job;
const { resourceId, productType } = job;

await this.polygonPartsMangerClient.process({ jobType: type, productId: resourceId, productType });
await this.polygonPartsMangerClient.process({ productId: resourceId, productType });
finalizeTaskParams = await this.markFinalizeStepAsCompleted(job.id, task.id, finalizeTaskParams, 'processedParts');

activeSpan?.addEvent('processPolygonParts.success', { ...finalizeTaskParams });
Expand Down
20 changes: 18 additions & 2 deletions tests/unit/httpClients/polygonPartMangerClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,24 @@ describe('polygonPartsManagerClient', () => {

const baseUrl = configMock.get<string>('servicesUrl.polygonPartsManager');
const payload: PolygonPartsProcessPayload = {
jobType: 'Ingestion_New',
productId: 'test_layer',
productType: RasterProductTypes.ORTHOPHOTO,
};
const url = '/polygonParts/process';
nock(baseUrl).put(url, payload).reply(200);

const action = polygonPartsManagerClient.process(payload);

await expect(action).resolves.toBeUndefined();
expect(nock.isDone()).toBe(true);
});

it('should process polygon parts and replacing old data successfully', async () => {
polygonPartsManagerClient = new PolygonPartsMangerClient(configMock, jsLogger({ enabled: false }));

const baseUrl = configMock.get<string>('servicesUrl.polygonPartsManager');
const payload: PolygonPartsProcessPayload = {
shouldClearEntities: true,
productId: 'test_layer',
productType: RasterProductTypes.ORTHOPHOTO,
};
Expand All @@ -43,7 +60,6 @@ describe('polygonPartsManagerClient', () => {

const baseUrl = configMock.get<string>('servicesUrl.polygonPartsManager');
const payload: PolygonPartsProcessPayload = {
jobType: 'Ingestion_New',
productId: 'test_layer',
productType: RasterProductTypes.ORTHOPHOTO,
};
Expand Down