🏗️ reconstruct all system in user module

This commit is contained in:
Rafi Arrafif
2025-07-16 23:42:13 +07:00
parent 558891ade7
commit 29b76fb91a
25 changed files with 85 additions and 548 deletions

View File

@ -1,19 +1,17 @@
import Joi from "joi";
import z from "zod";
export const createUserSchema = Joi.object({
name: Joi.string()
.min(4)
.max(255)
.required(),
username: Joi.string()
.min(4)
.max(255)
.required(),
email: Joi.string()
.email()
.required(),
password: Joi.string()
.min(8)
.max(255)
.required(),
export const createUserSchema = z.object({
name: z.string(),
username: z
.string()
.min(4) //Total all username character must over 4 character
.regex(/^[a-zA-Z0-9_-]+$/), //Prohibiting the use of spaces and symbols other than - and _
email: z.email(),
password: z
.string()
.min(8) //Total all password chaacter must over 8 character
.regex(/[A-Z]/) //Min has 1 uppercase letter
.regex(/[a-z]/) //Min has 1 lowercase letter
.regex(/[0-9]/) //Min has 1 number
.regex(/[^A-Za-z0-9"]/), //Min has 1 symbol character
});