2025-10-08 16:31:42 +09:00
|
|
|
/**
|
|
|
|
|
* Common Domain - Validation Utilities
|
2025-12-25 17:30:02 +09:00
|
|
|
*
|
2026-02-24 11:57:43 +09:00
|
|
|
* Generic validation schemas used across all domains.
|
|
|
|
|
* These are pure schemas with no infrastructure dependencies.
|
2025-10-08 16:31:42 +09:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { z } from "zod";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* UUID validation schema (v4)
|
|
|
|
|
*/
|
|
|
|
|
export const uuidSchema = z.string().uuid();
|
|
|
|
|
|
2025-10-08 16:50:51 +09:00
|
|
|
/**
|
|
|
|
|
* Required non-empty string schema (trimmed)
|
|
|
|
|
* Use for any string that must have a value
|
|
|
|
|
*/
|
|
|
|
|
export const requiredStringSchema = z.string().min(1, "This field is required").trim();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Customer number / account number schema
|
|
|
|
|
* Generic schema for customer/account identifiers
|
|
|
|
|
*/
|
|
|
|
|
export const customerNumberSchema = z.string().min(1, "Customer number is required").trim();
|