Users

Users
object
id
string
required
username
string
required, min: 3, max: 20
email
string
required, regex
password
string
required, min: 8
age
number
min: 13
isActive
boolean
required
role
enum
required[user, admin, moderator]
lastLogin
date
profile
object
fullName
string
required
bio
string
max: 500
avatarUrl
string
regex
socialMedia
array
account
object
platform
enum
required[twitter, facebook, instagram, linkedin]
username
string
required
url
string
regex

Generated Zod Schema

import { z } from 'zod';

const UsersSchema = z.object({
    id: z.string().describe("Unique identifier for the user"),
    username: z.string().min(3).max(20).describe("Unique username for the user"),
    email: z.string().regex(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/).describe("Email address"),
    password: z.string().min(8).describe("User password (min 8 characters)"),
    age: z.coerce.number().min(13).describe("User age (must be at least 13)"),
    isActive: z.boolean().describe("Active status"),
    role: z.enum(['user', 'admin', 'moderator']).describe("User role in the system"),
    lastLogin: z.coerce.date().describe("Last login timestamp"),
    profile: z.object({
    fullName: z.string().describe("Full name of the user"),
    bio: z.string().max(500).describe("User biography (max 500 characters)"),
    avatarUrl: z.string().regex(/^https?://.*$/).describe("URL to user's avatar image")
  }),
    socialMedia: z.array(z.object({
    platform: z.enum(['twitter', 'facebook', 'instagram', 'linkedin']),
    username: z.string(),
    url: z.string().regex(/^https?://.*$/)
  })).describe("List of user's social media accounts")
  });

export default UsersSchema;