From 9d2bd7e1a5ef08d03141b95d90c4e36cb2761bee Mon Sep 17 00:00:00 2001 From: xiangning Date: Thu, 2 Jul 2026 14:55:23 +0800 Subject: [PATCH] =?UTF-8?q?style(auth):=20=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E5=99=A8=E4=BB=A3=E7=A0=81=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 LoginCommandValidator 中添加空行以改善代码可读性 - 在 RegisterCommandValidator 中添加空行以改善代码可读性 - 统一验证器代码格式规范 --- .../rag/Application/Auth/Validators/LoginCommandValidator.cs | 1 + .../Application/Auth/Validators/RegisterCommandValidator.cs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/rag/Application/Auth/Validators/LoginCommandValidator.cs b/src/modules/rag/Application/Auth/Validators/LoginCommandValidator.cs index e929667..022b974 100644 --- a/src/modules/rag/Application/Auth/Validators/LoginCommandValidator.cs +++ b/src/modules/rag/Application/Auth/Validators/LoginCommandValidator.cs @@ -13,6 +13,7 @@ public class LoginCommandValidator : AbstractValidator RuleFor(x => x.Username).NotEmpty().WithMessage("用户名不能为空") .MaximumLength(50).WithMessage("用户名长度不能超过 50 个字符") .Must(u => u == u.Trim()).WithMessage("用户名前后不能有空格"); + RuleFor(x => x.Password).NotEmpty().WithMessage("密码不能为空") .MaximumLength(100).WithMessage("密码长度不能超过 100 个字符"); } diff --git a/src/modules/rag/Application/Auth/Validators/RegisterCommandValidator.cs b/src/modules/rag/Application/Auth/Validators/RegisterCommandValidator.cs index 95c5b9f..c2d1efe 100644 --- a/src/modules/rag/Application/Auth/Validators/RegisterCommandValidator.cs +++ b/src/modules/rag/Application/Auth/Validators/RegisterCommandValidator.cs @@ -12,9 +12,11 @@ public class RegisterCommandValidator : AbstractValidator { RuleFor(x => x.Username).NotEmpty().WithMessage("用户名不能为空") .Length(3, 50).WithMessage("用户名长度 3-50 个字符"); + RuleFor(x => x.Email).NotEmpty().WithMessage("邮箱不能为空") .EmailAddress().WithMessage("邮箱格式不正确"); + RuleFor(x => x.Password).NotEmpty().WithMessage("密码不能为空") .Length(6, 100).WithMessage("密码长度 6-100 个字符"); } -} +} \ No newline at end of file