Skip to content
Closed
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
6 changes: 5 additions & 1 deletion src/schemas/core/job.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { IJobResponse, OperationStatus } from '@map-colonies/mc-priority-queue';
import { INGESTION_VALIDATIONS, RASTER_DOMAIN, RasterProductTypes } from '../../constants';
import { createTaskResponseSchema } from './task.schema';

export const rasterProductTypeSchema: ZodType<RasterProductTypes> = z.nativeEnum(RasterProductTypes);
// PostgreSQL table name limit: 63 chars (productID: 37 + separator: 1 + productType: 17 + suffix: 8)
const productTypeMaxLength = 17;
export const rasterProductTypeSchema: ZodType<RasterProductTypes> = z
.nativeEnum(RasterProductTypes)
.refine((productTypeValue) => productTypeValue.length <= productTypeMaxLength, { message: 'Product type must be at most 17 characters' });
export const resourceIdSchema = z
.string()
.regex(new RegExp(INGESTION_VALIDATIONS.productId.pattern), {
Expand Down