From 75a7e144cd081275ef7c7782cacef50d48304acc Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 2 Mar 2026 19:26:20 +0000 Subject: [PATCH] remove comments --- server/src/validation/shared.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/server/src/validation/shared.ts b/server/src/validation/shared.ts index 0265fd290..778330dfc 100644 --- a/server/src/validation/shared.ts +++ b/server/src/validation/shared.ts @@ -1,15 +1,9 @@ import { z } from "zod"; import { type UserRole } from "@/types/user.js"; -/** - * Password pattern: requires at least one lowercase, uppercase, number, and special character - */ export const passwordPattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!?@#$%^&*()\-_=+[\]{};:'",.~`|\\/])[A-Za-z0-9!?@#$%^&*()\-_=+[\]{};:'",.~`|\\/]+$/; -/** - * Reusable name validation schema - */ export const nameValidation = z .string() .trim() @@ -19,9 +13,6 @@ export const nameValidation = z "Names must contain at least 1 letter and may only include letters, currency symbols, spaces, apostrophes, hyphens (-), periods (.), and parentheses ()." ); -/** - * Reusable email validation with lowercase enforcement - */ export const lowercaseEmailValidation = z .email() .transform((val) => val.toLowerCase()) @@ -29,19 +20,12 @@ export const lowercaseEmailValidation = z message: "Email must be in lowercase", }); -/** - * Helper to properly coerce boolean from strings (handles "true"/"false" strings) - * Needed for query parameters and form data where Express sends strings - */ export const booleanCoercion = z.preprocess((val) => { if (val === "true" || val === true) return true; if (val === "false" || val === false) return false; return val; // Let Zod validation handle invalid values }, z.boolean()); -/** - * Custom validator for role-based authorization - */ export const roleValidator = (allowedRoles: UserRole[]) => { return z.array(z.custom()).refine((userRoles) => allowedRoles.some((role) => userRoles.includes(role)), { message: `You do not have the required authorization. Required roles: ${allowedRoles.join(", ")}`,