change according to connection from frontend

This commit is contained in:
Julian Krauser 2025-06-04 14:30:57 +02:00
parent 2609ecc1bf
commit e3db523a0e
36 changed files with 611 additions and 173 deletions

18
src/helpers/typeTester.ts Normal file
View file

@ -0,0 +1,18 @@
import { PlanTimeDefinition } from "../viewmodel/admin/unit/inspection/inspectionPlan.models";
export default abstract class TypeTester {
static testPlanTimeDefinition(val: string, key: string = "", throwErr: boolean = false): PlanTimeDefinition | null {
if (/^(\d+-(d|m|y)|\d+\/(\d+|\*))$/.test(val)) {
return val as PlanTimeDefinition;
} else if (throwErr) {
throw Error(
[
key,
"provided String does not match PlanTimeDefinition Format: ${number}-${'d'|'m'|'y'} or ${number}/${number|'*'}",
].join(": ")
);
} else {
return null;
}
}
}