diff --git a/src/constants/deletion/constants.ts b/src/constants/deletion/constants.ts new file mode 100644 index 0000000..5a5fe5f --- /dev/null +++ b/src/constants/deletion/constants.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +export const DeletionJobTypes = { + Delete_Layer: 'Delete_Layer', +} as const; + +export type DeletionJobTypes = (typeof DeletionJobTypes)[keyof typeof DeletionJobTypes]; + +export const DeletionTaskTypes = { + Delete: 'delete', + LayerTilesDeletion: 'full-layer-tiles-deletion', + ArtifactsDeletion: 'artifacts-deletion', +} as const; + +export type DeletionTaskTypes = (typeof DeletionTaskTypes)[keyof typeof DeletionTaskTypes]; +/* eslint-enable @typescript-eslint/naming-convention */ diff --git a/src/constants/deletion/index.ts b/src/constants/deletion/index.ts new file mode 100644 index 0000000..c94f80f --- /dev/null +++ b/src/constants/deletion/index.ts @@ -0,0 +1 @@ +export * from './constants'; diff --git a/src/constants/index.ts b/src/constants/index.ts index 88e754e..73ddaf1 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -1,3 +1,4 @@ export * from './core'; export * from './ingestion'; export * from './export'; +export * from './deletion'; diff --git a/src/schemas/deletion/index.ts b/src/schemas/deletion/index.ts new file mode 100644 index 0000000..5e69007 --- /dev/null +++ b/src/schemas/deletion/index.ts @@ -0,0 +1,2 @@ +export * from './task.schema'; +export * from './job.schema'; diff --git a/src/schemas/deletion/job.schema.ts b/src/schemas/deletion/job.schema.ts new file mode 100644 index 0000000..59a74b8 --- /dev/null +++ b/src/schemas/deletion/job.schema.ts @@ -0,0 +1,7 @@ +import { z } from 'zod'; + +export const deleteLayerJobParamsSchema = z + .object({ + approver: z.string(), + }) + .describe('deleteLayerJobParamsSchema'); diff --git a/src/schemas/deletion/task.schema.ts b/src/schemas/deletion/task.schema.ts new file mode 100644 index 0000000..6989a99 --- /dev/null +++ b/src/schemas/deletion/task.schema.ts @@ -0,0 +1,27 @@ +import { z } from 'zod'; +import { SourceType } from '../../constants/core/constants'; + +export const sourceProviderSchema = z.union([z.literal(SourceType.S3), z.literal(SourceType.FS)]); + +export const deleteTaskParamsSchema = z + .object({ + deleteFromCatalog: z.boolean().default(false), + deleteFromMapproxy: z.boolean().default(false), + deleteFromGeoserver: z.boolean().default(false), + deletePolygonParts: z.boolean().default(false), + }) + .describe('deleteTaskParamsSchema'); + +export const layerTilesDeletionParamsSchema = z + .object({ + catalogId: z.string().uuid(), + sourceProvider: sourceProviderSchema, + }) + .describe('layerTilesDeletionParamsSchema'); + +export const artifactsDeletionParamsSchema = z + .object({ + sourceProvider: sourceProviderSchema, + paths: z.array(z.string().min(1)).min(1), // explicit thumbnail/legend object keys (s3) or file paths (fs) + }) + .describe('artifactsDeletionParamsSchema'); diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 88e754e..73ddaf1 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -1,3 +1,4 @@ export * from './core'; export * from './ingestion'; export * from './export'; +export * from './deletion'; diff --git a/src/types/deletion/index.ts b/src/types/deletion/index.ts new file mode 100644 index 0000000..164369b --- /dev/null +++ b/src/types/deletion/index.ts @@ -0,0 +1,2 @@ +export * from './task.type'; +export * from './job.type'; diff --git a/src/types/deletion/job.type.ts b/src/types/deletion/job.type.ts new file mode 100644 index 0000000..e4f67e4 --- /dev/null +++ b/src/types/deletion/job.type.ts @@ -0,0 +1,4 @@ +import z from 'zod'; +import { deleteLayerJobParamsSchema } from '../../schemas/deletion/job.schema'; + +export type DeleteLayerJobParams = z.infer; diff --git a/src/types/deletion/task.type.ts b/src/types/deletion/task.type.ts new file mode 100644 index 0000000..afe8c6e --- /dev/null +++ b/src/types/deletion/task.type.ts @@ -0,0 +1,6 @@ +import z from 'zod'; +import { deleteTaskParamsSchema, layerTilesDeletionParamsSchema, artifactsDeletionParamsSchema } from '../../schemas/deletion/task.schema'; + +export type DeleteTaskParams = z.infer; +export type LayerTilesDeletionParams = z.infer; +export type ArtifactsDeletionParams = z.infer; diff --git a/src/types/index.ts b/src/types/index.ts index 88e754e..73ddaf1 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,3 +1,4 @@ export * from './core'; export * from './ingestion'; export * from './export'; +export * from './deletion';