Files
CoHaiSe/backend/crm/src/utils/validation.ts
T
Esiah 09cf07d79b feat: migrate showcase to Next.js and overhaul CRM UI
- rebuild the public site on the Next.js App Router with static export,
  per-section SEO pages, metadata, sitemap, robots and a generated OG image
- add full-screen scroll-snap regions, staged scroll reveals, a hash-free
  tab navigation with a sliding indicator and region-by-region menu scrolling
- replace the theme text toggle with animated sun/moon icons
- restructure the CRM API into config, middleware, models, routes, services
  and utils layers
- redesign the CRM shell with a single surface, tab rail, full-width blurred
  DataTable, record dialogs and mask-based icons
- update Docker/Nginx publishing, Makefile targets, shared UI polish and docs
2026-11-16 00:52:29 +01:00

21 lines
583 B
TypeScript

import { z } from "zod";
import { AppError } from "@cohaise/server";
/** Identifiant UUID v4 tel que stocké par les tables du CRM. */
export const uuidSchema = z
.string()
.regex(
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
"Identifiant invalide.",
);
/** Erreur 400 homogène pour un corps JSON invalide. */
export const invalidBody = (error: z.ZodError): AppError => {
const issue = error.issues[0];
return AppError.badRequest(
issue
? `${issue.path.join(".") || "corps"} : ${issue.message}`
: "Corps invalide.",
);
};