/** * @file 认证模块Schema定义 * @author AI Assistant * @date 2024-12-19 * @description 定义认证模块的用户注册Schema */ import { t, type Static } from 'elysia'; /** * 用户注册Schema * @description 用户注册请求参数验证规则,基于sys_users表结构 */ export const RegisterSchema = t.Object({ /** 用户名,2-50字符,对应sys_users.username */ username: t.String({ minLength: 2, maxLength: 50, description: '用户名,2-50字符', examples: ['admin', 'testuser'] }), /** 邮箱地址,对应sys_users.email */ email: t.String({ format: 'email', maxLength: 100, description: '邮箱地址', examples: ['user@example.com'] }), /** 密码,6-50字符 */ password: t.String({ minLength: 6, maxLength: 50, description: '密码,6-50字符', examples: ['password123'] }), /** 图形验证码 */ captcha: t.String({ minLength: 4, maxLength: 6, description: '图形验证码', examples: ['a1b2'] }), /** 验证码会话ID */ captchaId: t.String({ description: '验证码会话ID', examples: ['uuid-string-here'] }) }); /** 用户注册请求类型 */ export type RegisterRequest = Static;