Merge branch 'main' into new-admin

This commit is contained in:
baldo 2022-08-04 18:41:39 +02:00
commit 81579cbac4
9 changed files with 13 additions and 17 deletions

View file

@ -3,8 +3,8 @@ import ErrorTypes from "../utils/errorTypes";
import * as MailService from "../services/mailService";
import * as Resources from "../utils/resources";
import {handleJSONWithData, RequestData} from "../utils/resources";
import {normalizeString, parseInteger} from "../utils/strings";
import {forConstraint} from "../validation/validator";
import {normalizeString, parseInteger} from "../shared/utils/strings";
import {forConstraint} from "../shared/validation/validator";
import {Request, Response} from "express";
import {isString, Mail, MailId} from "../types";

View file

@ -3,8 +3,8 @@ import ErrorTypes from "../utils/errorTypes";
import * as MonitoringService from "../services/monitoringService";
import * as Resources from "../utils/resources";
import {handleJSONWithData} from "../utils/resources";
import {normalizeString} from "../utils/strings";
import {forConstraint} from "../validation/validator";
import {normalizeString} from "../shared/utils/strings";
import {forConstraint} from "../shared/validation/validator";
import {Request, Response} from "express";
import {isMonitoringToken, JSONObject, MonitoringResponse, MonitoringToken, toMonitoringResponse} from "../types";

View file

@ -2,8 +2,8 @@ import Constraints from "../shared/validation/constraints";
import ErrorTypes from "../utils/errorTypes";
import * as MonitoringService from "../services/monitoringService";
import * as NodeService from "../services/nodeService";
import {normalizeMac, normalizeString} from "../utils/strings";
import {forConstraint, forConstraints} from "../validation/validator";
import {normalizeMac, normalizeString} from "../shared/utils/strings";
import {forConstraint, forConstraints} from "../shared/validation/validator";
import * as Resources from "../utils/resources";
import {handleJSONWithData} from "../utils/resources";
import {Request, Response} from "express";

View file

@ -3,8 +3,8 @@ import ErrorTypes from "../utils/errorTypes";
import * as Resources from "../utils/resources";
import {handleJSONWithData, RequestData} from "../utils/resources";
import {getTasks, Task, TaskState} from "../jobs/scheduler";
import {normalizeString} from "../utils/strings";
import {forConstraint} from "../validation/validator";
import {normalizeString} from "../shared/utils/strings";
import {forConstraint} from "../shared/validation/validator";
import {Request, Response} from "express";
import {isString, isTaskSortField} from "../types";

View file

@ -11,10 +11,10 @@ import * as MailService from "../services/mailService";
import * as NodeService from "../services/nodeService";
import * as Resources from "../utils/resources";
import {RestParams} from "../utils/resources";
import {normalizeMac, parseInteger} from "../utils/strings";
import {normalizeMac, parseInteger} from "../shared/utils/strings";
import {monitoringDisableUrl} from "../utils/urlBuilder";
import CONSTRAINTS from "../shared/validation/constraints";
import {forConstraint} from "../validation/validator";
import {forConstraint} from "../shared/validation/validator";
import {
Domain,
DurationSeconds,

View file

@ -8,7 +8,7 @@ import ErrorTypes from "../utils/errorTypes";
import Logger from "../logger";
import logger from "../logger";
import * as MailService from "../services/mailService";
import {normalizeString} from "../utils/strings";
import {normalizeString} from "../shared/utils/strings";
import {monitoringConfirmUrl, monitoringDisableUrl} from "../utils/urlBuilder";
import {
BaseNode,

View file

@ -1,4 +1,3 @@
import _ from "lodash"
import {isString, MAC} from "../types";
export function normalizeString(str: string): string {
@ -19,7 +18,7 @@ export function normalizeMac(mac: MAC): MAC {
}
export function parseInteger(str: string): number {
const parsed = _.parseInt(str, 10);
const parsed = parseInt(str, 10);
if (parsed.toString() === str) {
return parsed;
} else {

View file

@ -1,5 +1,4 @@
import {parseInteger} from "../utils/strings";
import Logger from "../logger";
import {isBoolean, isNumber, isObject, isOptional, isRegExp, isString, toIsArray} from "../types";
export interface Constraint {
@ -117,7 +116,6 @@ function isValid(constraint: Constraint, acceptUndefined: boolean, value: unknow
return isValidString(constraint, value);
}
Logger.tag('validation').error('No validation method for constraint type: {}', constraint.type);
return false;
}
@ -131,7 +129,6 @@ function areValid(constraints: Constraints, acceptUndefined: boolean, values: Va
for (const field of Object.keys(values)) {
if (!fields.has(field)) {
Logger.tag('validation').error('Validation failed: No constraint for field: {}', field);
return false;
}
}

View file

@ -3,7 +3,7 @@ import _ from "lodash";
import CONSTRAINTS from "../shared/validation/constraints";
import ErrorTypes from "../utils/errorTypes";
import Logger from "../logger";
import {Constraints, forConstraints, isConstraints} from "../validation/validator";
import {Constraints, forConstraints, isConstraints} from "../shared/validation/validator";
import {Request, Response} from "express";
import {
EnumTypeGuard,