From 9db254e9d50dc2714b02fc33e03a242ec2871b08 Mon Sep 17 00:00:00 2001 From: almog8k Date: Mon, 24 Nov 2025 13:46:52 +0200 Subject: [PATCH] feat: add validation error types and update report type to use them --- src/constants/ingestion/constants.ts | 13 +++++++++++++ src/schemas/ingestion/index.ts | 1 + src/types/ingestion/report.type.ts | 9 ++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/constants/ingestion/constants.ts b/src/constants/ingestion/constants.ts index 500481b..63df2e0 100644 --- a/src/constants/ingestion/constants.ts +++ b/src/constants/ingestion/constants.ts @@ -88,3 +88,16 @@ export const ShapefileExtensions = { export type ShapefileExtensions = (typeof ShapefileExtensions)[keyof typeof ShapefileExtensions]; export const SHAPEFILE_EXTENSIONS_LIST = Object.values(ShapefileExtensions); + +/* eslint-disable @typescript-eslint/naming-convention */ +export const ValidationErrorType = { + GEOMETRY_VALIDITY: 'Geometry_Validity', + VERTICES: 'Vertices', + METADATA: 'Metadata', + SMALL_GEOMETRY: 'Small_Geometry', + SMALL_HOLES: 'Small_Holes', + RESOLUTION: 'Resolution', +} as const; +/* eslint-enable @typescript-eslint/naming-convention */ + +export type ValidationErrorType = (typeof ValidationErrorType)[keyof typeof ValidationErrorType]; diff --git a/src/schemas/ingestion/index.ts b/src/schemas/ingestion/index.ts index ba8424a..18d408c 100644 --- a/src/schemas/ingestion/index.ts +++ b/src/schemas/ingestion/index.ts @@ -6,3 +6,4 @@ export * from './job.schema'; export * from './task.schema'; export * from './layerNameFormats.schema'; export * from './callback.schema'; +export * from './validationTask.schema'; diff --git a/src/types/ingestion/report.type.ts b/src/types/ingestion/report.type.ts index 8dd5e81..21c49d3 100644 --- a/src/types/ingestion/report.type.ts +++ b/src/types/ingestion/report.type.ts @@ -1,6 +1,13 @@ +import { ValidationErrorType } from '../../constants'; + +export type PolygonPartValidationErrorsType = Pick< + typeof ValidationErrorType, + 'RESOLUTION' | 'GEOMETRY_VALIDITY' | 'SMALL_GEOMETRY' | 'SMALL_HOLES' +>[keyof Pick]; + export interface PolygonPartValidationError { id: string; - errors: string[]; + errors: PolygonPartValidationErrorsType[]; } export interface PolygonPartsChunkValidationResult { parts: PolygonPartValidationError[];