Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding polygon-parts table name type and valdiation #241

Merged
merged 11 commits into from
Nov 28, 2024
3 changes: 3 additions & 0 deletions src/models/raster/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ export const VALIDATIONS = {
sensor: {
pattern: '^(?!\\s).+(?<!\\s)$',
},
polygonPartsTableName: {
CL-SHLOMIKONCHA marked this conversation as resolved.
Show resolved Hide resolved
pattern: '^[a-zA-Z][a-zA-Z0-9_]{0,62}$',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,13 @@ export const partSchema = z
message: 'Imaging time begin UTC should be less than or equal to imaging time end UTC and both less than or equal to current timestamp',
})
.describe('partSchema');

export const polygonPartsEntityNameSchema = z
.object({
polygonPartsTableName: z.string().regex(new RegExp(VALIDATIONS.polygonPartsTableName.pattern), {
message: 'Polygon parts table name must be a valid table name',
}),
})
.describe('polygonPartsTableNameSchema');

export type PolygonPartsEntityName = z.infer<typeof polygonPartsEntityNameSchema>;
Loading