From dda66c67bd4f8a0771604c2103c6b1ebe1972b12 Mon Sep 17 00:00:00 2001 From: baldo Date: Thu, 4 Aug 2022 15:31:01 +0200 Subject: [PATCH] Move shared code into own directory for use in new frontend. --- server/resources/mailResource.ts | 2 +- server/resources/monitoringResource.ts | 2 +- server/resources/nodeResource.ts | 2 +- server/resources/taskResource.ts | 2 +- server/services/monitoringService.ts | 2 +- server/{types/shared.ts => shared/types/index.ts} | 0 server/{ => shared}/validation/constraints.ts | 0 server/types/config.ts | 2 +- server/types/index.ts | 4 ++-- server/utils/resources.ts | 2 +- 10 files changed, 9 insertions(+), 9 deletions(-) rename server/{types/shared.ts => shared/types/index.ts} (100%) rename server/{ => shared}/validation/constraints.ts (100%) diff --git a/server/resources/mailResource.ts b/server/resources/mailResource.ts index 240ce16..8c48ce7 100644 --- a/server/resources/mailResource.ts +++ b/server/resources/mailResource.ts @@ -1,4 +1,4 @@ -import CONSTRAINTS from "../validation/constraints"; +import CONSTRAINTS from "../shared/validation/constraints"; import ErrorTypes from "../utils/errorTypes"; import * as MailService from "../services/mailService"; import * as Resources from "../utils/resources"; diff --git a/server/resources/monitoringResource.ts b/server/resources/monitoringResource.ts index 1a78bb3..38f7573 100644 --- a/server/resources/monitoringResource.ts +++ b/server/resources/monitoringResource.ts @@ -1,4 +1,4 @@ -import CONSTRAINTS from "../validation/constraints"; +import CONSTRAINTS from "../shared/validation/constraints"; import ErrorTypes from "../utils/errorTypes"; import * as MonitoringService from "../services/monitoringService"; import * as Resources from "../utils/resources"; diff --git a/server/resources/nodeResource.ts b/server/resources/nodeResource.ts index 7b0cee6..69de0b1 100644 --- a/server/resources/nodeResource.ts +++ b/server/resources/nodeResource.ts @@ -1,4 +1,4 @@ -import Constraints from "../validation/constraints"; +import Constraints from "../shared/validation/constraints"; import ErrorTypes from "../utils/errorTypes"; import * as MonitoringService from "../services/monitoringService"; import * as NodeService from "../services/nodeService"; diff --git a/server/resources/taskResource.ts b/server/resources/taskResource.ts index 8f2e939..e983f38 100644 --- a/server/resources/taskResource.ts +++ b/server/resources/taskResource.ts @@ -1,4 +1,4 @@ -import CONSTRAINTS from "../validation/constraints"; +import CONSTRAINTS from "../shared/validation/constraints"; import ErrorTypes from "../utils/errorTypes"; import * as Resources from "../utils/resources"; import {handleJSONWithData, RequestData} from "../utils/resources"; diff --git a/server/services/monitoringService.ts b/server/services/monitoringService.ts index 11c9231..1c00f04 100644 --- a/server/services/monitoringService.ts +++ b/server/services/monitoringService.ts @@ -13,7 +13,7 @@ import * as Resources from "../utils/resources"; import {RestParams} from "../utils/resources"; import {normalizeMac, parseInteger} from "../utils/strings"; import {monitoringDisableUrl} from "../utils/urlBuilder"; -import CONSTRAINTS from "../validation/constraints"; +import CONSTRAINTS from "../shared/validation/constraints"; import {forConstraint} from "../validation/validator"; import { Domain, diff --git a/server/types/shared.ts b/server/shared/types/index.ts similarity index 100% rename from server/types/shared.ts rename to server/shared/types/index.ts diff --git a/server/validation/constraints.ts b/server/shared/validation/constraints.ts similarity index 100% rename from server/validation/constraints.ts rename to server/shared/validation/constraints.ts diff --git a/server/types/config.ts b/server/types/config.ts index 7710b39..98e0b61 100644 --- a/server/types/config.ts +++ b/server/types/config.ts @@ -1,5 +1,5 @@ import {ArrayField, Field, RawJsonField} from "sparkson" -import {ClientConfig, DurationMilliseconds, isString, toIsNewtype, Url} from "./shared"; +import {ClientConfig, DurationMilliseconds, isString, toIsNewtype, Url} from "../shared/types"; export type Username = string & { readonly __tag: unique symbol }; export const isUsername = toIsNewtype(isString, "" as Username); diff --git a/server/types/index.ts b/server/types/index.ts index 5324418..f0d76c3 100644 --- a/server/types/index.ts +++ b/server/types/index.ts @@ -15,12 +15,12 @@ import { StoredNode, toIsEnum, toIsNewtype, -} from "./shared"; +} from "../shared/types"; export * from "./config"; export * from "./database"; export * from "./logger"; -export * from "./shared"; +export * from "../shared/types"; export type NodeStateData = { site?: Site, diff --git a/server/utils/resources.ts b/server/utils/resources.ts index 5f1116b..fe8b85d 100644 --- a/server/utils/resources.ts +++ b/server/utils/resources.ts @@ -1,6 +1,6 @@ import _ from "lodash"; -import CONSTRAINTS from "../validation/constraints"; +import CONSTRAINTS from "../shared/validation/constraints"; import ErrorTypes from "../utils/errorTypes"; import Logger from "../logger"; import {Constraints, forConstraints, isConstraints} from "../validation/validator";