summary refs log tree commit diff
path: root/api/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'api/src/util')
-rw-r--r--api/src/util/String.ts2
-rw-r--r--api/src/util/route.ts13
2 files changed, 6 insertions, 9 deletions
diff --git a/api/src/util/String.ts b/api/src/util/String.ts

index 2fe32d2c..67d87e37 100644 --- a/api/src/util/String.ts +++ b/api/src/util/String.ts
@@ -1,8 +1,6 @@ import { Request } from "express"; import { ntob } from "./Base64"; import { FieldErrors } from "./FieldError"; -export const EMAIL_REGEX = - /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; export function checkLength(str: string, min: number, max: number, key: string, req: Request) { if (str.length < min || str.length > max) { diff --git a/api/src/util/route.ts b/api/src/util/route.ts
index b7e6296b..e7c7ed1c 100644 --- a/api/src/util/route.ts +++ b/api/src/util/route.ts
@@ -1,4 +1,4 @@ -import { DiscordApiErrors, Event, EventData, getPermission, PermissionResolvable, Permissions } from "@fosscord/util"; +import { DiscordApiErrors, EVENT, Event, EventData, getPermission, PermissionResolvable, Permissions } from "@fosscord/util"; import { NextFunction, Request, Response } from "express"; import fs from "fs"; import path from "path"; @@ -29,17 +29,16 @@ declare global { } } -export type RouteSchema = string; // typescript interface name -export type RouteResponse = { status?: number; body?: RouteSchema; headers?: Record<string, string> }; +export type RouteResponse = { status?: number; body?: `${string}Response`; headers?: Record<string, string> }; export interface RouteOptions { permission?: PermissionResolvable; - body?: RouteSchema; - response?: RouteResponse; - example?: { + body?: `${string}Schema`; // typescript interface name + test?: { + response?: RouteResponse; body?: any; path?: string; - event?: EventData; + event?: EVENT | EVENT[]; headers?: Record<string, string>; }; }